Example #1
0
 protected function parseElement(dom\element $el)
 {
     $sOwner = $el->readAttribute('owner', $this->getNamespace());
     $sGroup = $el->readAttribute('group', $this->getNamespace());
     $sMode = $el->readAttribute('mode', $this->getNamespace());
     return array('user' => $sOwner, 'group' => $sGroup, 'mode' => intval($sMode));
 }
Example #2
0
 public function buildArgument(dom\element $arg, fs\file $file, dom\element $test)
 {
     require_once 'core/functions/Path.php';
     $sName = core\functions\path\urlize($file->getName() . '-' . $test->readAttribute('name'));
     $tmp = $this->exportDirectory->createFile($sName . '.xml');
     $doc = $this->getManager('dom')->createDocument($arg);
     $doc->saveFile($tmp, true);
     $result = $this->getManager()->load($tmp, array(), true);
     //$result->setBaseDirectory($file->getParent());
     return $result;
 }
Example #3
0
 /**
  *
  * @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;
 }
Example #4
0
 protected function getFileName(dom\element $el, $sClass)
 {
     $sFile = $el->readAttribute('file', null, false);
     if ($sFile) {
         $sResult = $sFile;
     } else {
         $sResult = str_replace('/', '\\', $sClass) . '.php';
     }
     return $sResult;
 }
Example #5
0
 protected function catchExceptionCheck($sException, dom\element $test, core\exception $e, fs\file $file)
 {
     $bResult = false;
     if ($sException && $e instanceof $sException) {
         $bResult = true;
     } else {
         $e->addPath($file->asToken());
         $e->addPath('Test ID : ' . $test->readAttribute('name'));
         if ($sException) {
             $e->addPath(sprintf('Exception of type %s expected', $sException));
         }
         //$e->addPath($test->asString());
         $e->save(false);
     }
     return $bResult;
 }
Example #6
0
 protected function parseArgument(dom\element $el, $iKey)
 {
     if (!($mKey = $el->readAttribute('name', $this->getNamespace(), false))) {
         $mKey = $iKey;
     }
     return array('name' => $mKey, 'value' => $this->getManager()->parse($el));
 }
Example #7
0
 protected function addNamespace($sValue, dom\element $el, dom\element $context)
 {
     list($sNamespace) = $this->parseName($sValue, null, $context);
     if (!$el->readAttribute('ns', $sNamespace, false)) {
         if ($sPrefix = $context->lookupPrefix($sNamespace)) {
             $el->createAttribute("{$sPrefix}:ns", 'ns', $sNamespace);
         }
     }
 }