protected function lookupClass($sPath, core\argument $args, $bDebug = true) { $args->registerToken(self::DIRECTORY_TOKEN); $args->registerToken(self::CLASSBASE_TOKEN); $result = parent::lookupClass($sPath, $args, $bDebug); $args->unRegisterToken(self::DIRECTORY_TOKEN); $args->unRegisterToken(self::CLASSBASE_TOKEN); return $result; }
protected function connect(core\argument $arg) { try { $sLink = 'mysql:dbname=' . $arg->read('database') . ';host=' . $arg->read('host') . ';charset=UTF8'; $result = new \PDO($sLink, $arg->read('user'), $arg->read('password'), array(\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'')); } catch (\PDOException $e) { $this->throwException(sprintf('Connection failed : %s', $e->getMessage())); } return $result; }
protected function loadArguments(core\argument $arg = null) { if ($sArguments = static::ARGUMENTS) { if ($this->getDirectory('', false)) { $manager = $this->getManager(static::ARGUMENT_MANAGER); $this->setArguments($manager->createArguments($this->getFile($sArguments))); } } else { if ($arg and $sArguments = $arg->read('arguments', null, false)) { $this->setArguments($sArguments); $this->setSettings($this->getArguments(false)); // TODO : settings will replace arguments } } }
protected function normalizeArgument(core\argument $arg, $bEmpty = false) { return $arg->asArray($bEmpty); }
protected function buildModule(core\argument $module) { return array('dummy' => $module->read('@dummy'), '_alias' => 'module'); }
protected function loadArguments(core\argument $arg = null) { if ($arg and $sArguments = $arg->read('arguments', null, false)) { $this->setArguments($sArguments); } }
/** * Create an object from an argument using @method buildClass() * * @param argument $class The argument object containing the classes infos * Ex : array(classes' => array('keyname' => array('name' => 'classname', 'file' => 'filename'))) * @param* array $aArguments The list of arguments to send to __construct * * @return mixed The object created */ public function createObject(core\argument $class, array $aArguments = array()) { $result = null; if (!($sClass = $class->read('name', false))) { // has name ? $this->throwException(sprintf('Cannot build object. No "name" defined in class'), array(), 3); } if (self::includeClass($sClass, $class->read('file', false))) { $result = $this->buildClass($sClass, $aArguments); } //$this->getManager('init')->addStat($sClass); return $result; }
public function setOptions(core\argument $arg) { $this->setNamespace($arg->getNamespace()); $this->setName($arg->getRoot()); $this->options = $arg; }
public function argumentAsDOM(core\argument $arg) { $result = null; $node = $arg->asDOM(); $doc = $this->createDocument(); $doc->addElement('window', null, array(), $this->getNamespace('self')); $doc->add($node->getx('self:items', $this->getNS(), false)); //dsp($doc); if (!$doc->isEmpty()) { $result = $this->getTemplate(static::PHP_TEMPLATE)->parseDocument($doc); } return $result; }
protected function testRoute(core\argument $alt, $sCurrent, $iKey) { $sPattern = $alt->read('pattern', false); $iResult = 0; if (!$sPattern || preg_match($sPattern, $sCurrent)) { $iWeight = $alt->read('weight', false); $iResult = $iWeight ? $iWeight : $iKey; } return $iResult; }
protected function loadNamespaces(core\argument $namespaces) { $this->aNamespaces = $namespaces->asArray(); }
protected function normalizeArgument(core\argument $arg, $bEmpty = false) { if ($bEmpty) { $result = $arg->asArray($bEmpty); } else { $result = $arg->asDOM(); } return $result; }
protected function setArgument(core\argument $arg) { $doc = $arg->asDOM(); return $this->setObject($doc); }
protected function loadVariable(core\argument $step, array &$aStep) { if ($var = $step->get('variable', false)) { $aStep['variable'][] = array('name' => $var->read('@name')); } }