Ejemplo n.º 1
0
 /**
  * @inheritDoc
  */
 public function flow(NodeInterface $node)
 {
     if (!$node instanceof NodeCollectionInterface) {
         throw new InvalidArgumentException("The supplied {$node} is not a NodeCollectionInterface");
     }
     return $node->filter($this->callback);
 }
Ejemplo n.º 2
0
 /**
  * @inheritDoc
  */
 public function flow(NodeInterface $node)
 {
     if (!$node instanceof NodeCollectionInterface) {
         throw new InvalidArgumentException("The supplied {$node} is not a NodeCollectionInterface");
     }
     $this->log(LogLevel::DEBUG, "Selecting the first entry from {node}", ['node' => $node]);
     return $node->first($this->callback);
 }
Ejemplo n.º 3
0
 /**
  * @param NodeInterface $node
  *
  * @return LocalFile
  * @throws InvalidCompressionTypeException
  */
 public function flow(NodeInterface $node)
 {
     if (!$node instanceof LocalFile) {
         throw new InvalidArgumentException("Node: {$node} should be an instance of LocalFile");
     }
     $factory = new CompressionFactory();
     $compressor = $factory->getDeCompressor($node->getCompression());
     $this->log(LogLevel::INFO, "DeCompressing file: '{file}'", ['file' => $node]);
     return $compressor->decompress($node, $this->options);
 }
Ejemplo n.º 4
0
 /**
  * @param NodeInterface $node
  *
  * @return FileNode
  */
 public function flow(NodeInterface $node)
 {
     if (!$node instanceof FileNode) {
         throw new InvalidArgumentException("Node: {$node} should be an instance of FileNode");
     }
     if (substr($this->target->getPath(), -1) == '/') {
         $target = $this->target->getClone()->setPath($this->target->getPath() . $node->getFilename());
     } else {
         $target = $this->target;
     }
     return $this->moveTo($node, $target);
 }