find() public method

Plus all it's children-children recursively and returns a generator providing them This is used to collect all blocks, imports and mixins and handle them in a special way If you need a normal array, use ->findArray() instead instead
public find ( string $type ) : Generator
$type string the node type to search for
return Generator a generator of the found children
Exemplo n.º 1
0
 /**
  * Collects all imports and handles them via ->handleImport.
  *
  * @param Node $node the root Node to search imports in
  *
  * @return $this
  * @throws Exception when the allowImports-options is set to false
  */
 protected function handleImports(Node $node)
 {
     foreach ($node->find('import') as $importNode) {
         if (!$this->options['allowImports']) {
             $this->throwException('Imports are not allowed in this compiler instance', $node);
         }
         $this->handleImport($importNode);
     }
     return $this;
 }
Exemplo n.º 2
0
 /**
  * Collects all imports and handles them via ->handleImport.
  *
  * @param Node $node the root Node to search imports in
  *
  * @return $this
  * @throws Exception when the allowImports-options is set to false
  */
 protected function handleImports(Node $node)
 {
     foreach ($node->find('import') as $importNode) {
         if (!$this->options['allow_imports']) {
             $this->throwException('Imports are disabled in this Jade compiler instance through the [`allow_imports`] option. ' . 'Set it to [`false`] (default) to enable imports again', $node);
         }
         $this->handleImport($importNode);
     }
     return $this;
 }