Esempio n. 1
0
 /**
  * Default constructor for directory base
  * @param string $path
  */
 function __construct($path)
 {
     if (!Str::endsWith($path, '/')) {
         $path .= '/';
     }
     if (!Str::startsWith($path, '/')) {
         $path = '/' . $path;
     }
     $cwd = getcwd();
     if (strpos($path, $cwd) === false) {
         $path = $cwd . $path;
     }
     $path = Str::flipDS($path);
     $this->path = $path;
 }
Esempio n. 2
0
File: Set.php Progetto: jgswift/xral
 protected function updateNode(&$node, $aggregateName, $name, $value)
 {
     $nodeName = $this->getElementName($node);
     if ($nodeName === $name || $aggregateName === $name || qtil\StringUtil::endsWith($nodeName, $name)) {
         if ($node instanceof \SimpleXMLElement) {
             $node[0] = $value;
         } elseif ($node instanceof \DOMNode) {
             $node->nodeValue = $value;
         }
     }
     if ($node instanceof \SimpleXMLElement) {
         $children = $node->children();
     } elseif ($node instanceof \DOMNode) {
         $children = $node->childNodes;
     }
     if (!empty($children)) {
         foreach ($children as $child) {
             $this->updateNode($child, $aggregateName . '/' . $this->getElementName($child), $name, $value);
         }
     }
 }
Esempio n. 3
0
 /**
  * Retrieves cache destination of specific source asset
  * @param \qio\Asset $asset
  * @return \qio\File\Asset
  */
 public function getTarget(qio\Asset $asset)
 {
     $path = qtil\StringUtil::flipDS($asset->getPath());
     $nfo = pathinfo($path);
     $basename = $nfo['basename'];
     $targetPath = $this->getDestination()->getPath() . DIRECTORY_SEPARATOR . $basename;
     return new \qio\File\Asset($this, $targetPath);
 }
Esempio n. 4
0
 function testPadZero()
 {
     $num = 34;
     $pad = \qtil\StringUtil::padZero($num, 3);
     $this->assertEquals('00034', $num);
 }