protected function loadFileBase(core\argument $class, $sDirectory = '') { if ($sInlineDirectory = $this->getArguments()->getLastDirectory()) { $sDirectory = $sInlineDirectory; } if ($sFile = $class->read('file', false)) { $class->set('file', core\functions\path\toAbsolute($sFile, $sDirectory)); } }
protected function resolvePath($sPath, fs\directory $dir = null) { if ($dir) { require_once 'core/functions/Path.php'; $sResult = functions\path\toAbsolute((string) $sPath, $dir); } else { $sResult = (string) $sPath; } return $sResult; }
/** * * @param dom\element $el * @param array $aPaths * @return fs\file */ protected function buildExternal(dom\element $el, array &$aPaths = array()) { $result = null; $sHref = $el->readAttribute('href'); if ($this->getFile()) { $dir = $this->getFile()->getParent(); $fs = $dir->getControler(); } else { $dir = null; $fs = $this->getControler('fs'); } require_once 'core/functions/Path.php'; $sPath = core\functions\path\toAbsolute($sHref, $dir); if (!in_array($sPath, $aPaths)) { $result = $fs->getFile($sPath, $dir); } return $result; }
protected function getClassName($sName) { \Sylma::load('/core/functions/Path.php'); return path\toAbsolute($sName, str_replace('/', '\\', (string) $this->getSourceDirectory()), '\\'); }
protected function parsePath($sPath, $mSource) { $sPath = path\toAbsolute($sPath, $mSource); $aResult = explode('/', $sPath); array_shift($aResult); return $aResult; }
/** * Load content of the file as the YAML content. Allow multiple loads, for stepped controler loads * * @param type $sPath Path to the file * @param type $bFirstLoad If set to TRUE, the file will be replaced by the new one loaded * @return array The YAML datas */ protected function loadYAML($sPath, $bFirstLoad = true) { $aResult = array(); if ($fs = $this->getControler()) { // file controler is ready if ($file = $this->getFile()) { require_once 'core/functions/Path.php'; $sPath = path\toAbsolute($sPath, (string) $file->getParent()); } $file = $fs->getFile($sPath); if (!($sContent = $file->execute())) { $this->throwException(sprintf('@file %s is empty', $file)); } if ($bFirstLoad) { $this->setFile($file); } $aResult = $this->parseYAML($sContent); } else { // file controler is not ready $aResult = $this->loadYAMLFree($sPath); } return $aResult; }