/** * Creates a chain of command instance from an array type representation. * * @param array $map * @return \Chainnn\ChainOfCommand */ public static function createFromArrayMap(array $map) { $chainOfCommand = new ChainOfCommand(); foreach ($map as $method => $children) { if (is_int($method)) { list($method, $children) = array($children, array()); } $chainOfCommand->addCommand(Command::createFromMap($method, $children)); } return $chainOfCommand; }
public function __construct() { parent::__construct(); // Register this object with the chain; ChainOfCommand::registerExecutor($this); // Do the Factory-Singleton method; if (!TheFactoryMethodOfSingleton::checkHasInstance(__CLASS__)) { // Set specific TPL object properties; self::setExeTime(new S(__CLASS__)); self::$objPageTitle = new A(); self::$objPageCSS = new A(); self::$objPageJSS = new A(); self::$objMetaTAG = new A(); self::$objMetaEQV = new A(); self::$objMetaLNK = new A(); self::$objUserAgentCapability = new A(); self::$objPageTitleBackward = new I(0); self::$objContainerHTML = new I(1); self::$objTPLLoaded = new B(TRUE); self::$objRequestIsPHP = new I(1); self::$objTpEXECounter = new I(0); // If this is a CSS File, then setupCSSEnvironmentIfCSSFile for it; self::setupCSSEnvironmentIfCSSFile(); self::setupJSSEnvironmentIfJSSFile(); self::activateDeactiveAjax(); // Output Gzipped content, if that's the case for it; self::setGzippedOutputRequest(new S('set_header_information')); // Set document type, UserAgent stats and more ... if (self::$objRequestIsPHP->toInt() == 1) { // Set the document type to a default; self::setDocumentType(new S('xhtml_strict')); // Set an array of 'f_path' (file path); self::$objFilePathArray = new A(); self::getUserAgentStats(); } } else { // Return the instantiated object; return TheFactoryMethodOfSingleton::getInstance(__CLASS__); } }
public static function registerExecutor($passedObjectParam) { if (self::$objRegisteredExecutors == NULL) { self::$objRegisteredExecutors = new A(); } if ($passedObjectParam != NULL) { if (is_object($passedObjectParam)) { self::$objRegisteredExecutors[] = $passedObjectParam; } else { if (self::checkCanOutputErrorScreen()->toBoolean()) { self::renderScreenOfDeath(new S(__CLASS__), new S(VAR_NOT_OBJECT), new S(VAR_NOT_OBJECT_FIX)); } else { throw new Exception(__CLASS__ . _DCSP . self::ARG_NOT_OBJECT); } } } }