You are here

AAction.php in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2

File

src/Flmngr/FileUploaderServer/lib/action/AAction.php
View source
<?php

namespace Drupal\n1ed\Flmngr\FileUploaderServer\lib\action;


/**
 * Abstract action - processor for any request.
 * External code executes run() method of set config and returnes Resp* object
 * as data structure to return via HTTP.
 */
abstract class AAction {
  protected $config;

  /**
   * Sets a config.
   */
  public function setConfig($config) {
    $this->config = $config;
  }

  /**
   * Returnes name of action.
   */
  public abstract function getName();

  /**
   * Runs action.
   */
  public abstract function run($req);

  /**
   * Validates boolean and returns default value if null.
   */
  protected function validateBoolean($b, $defaultValue) {
    return $b === NULL ? $defaultValue : $b;
  }

  /**
   * Validates integer and returns default value if null.
   */
  protected function validateInteger($i, $defaultValue) {
    return $i === NULL ? $defaultValue : $i;
  }

  /**
   * Validates string and returns default value if null.
   */
  protected function validateString($s, $defaultValue) {
    return $s === NULL ? $defaultValue : $s;
  }

}

Classes

Namesort descending Description
AAction Abstract action - processor for any request. External code executes run() method of set config and returnes Resp* object as data structure to return via HTTP.