src/WMS/Library/BusinessRulesEngine/Loader/XmlFileLoader.php
protected function parseImport(RuleCollection $collection, \DOMElement $node, $path, $file)
    {
        if ('' === $resource = $node->getAttribute('resource')) {
            throw new \InvalidArgumentException(sprintf('The <import> element in file "%s" must have a "resource" attribute.', $path));
        }

        $type = $node->getAttribute('type');
        list($tags) = $this->parseConfigs($node, $path);

        $this->setCurrentDir(dirname($path));

        $subCollection = $this->import($resource, ('' !== $type ? $type : null), false, $file);

        /* @var $subCollection RuleCollection */
        foreach ($tags as $tagName => $tagAttrs) {
            $subCollection->addTag($tagName, $tagAttrs);
        }

        $collection->addCollection($subCollection);
    }
protected function parseImport(RuleCollection $collection, \DOMElement $node, $path, $file)
    {
        if ('' === $resource = $node->getAttribute('resource')) {
            throw new \InvalidArgumentException(sprintf('The <import> element in file "%s" must have a "resource" attribute.', $path));
        }

        $type = $node->getAttribute('type');
        list($tags) = $this->parseConfigs($node, $path);

        $this->setCurrentDir(dirname($path));

        $subCollection = $this->import($resource, ('' !== $type ? $type : null), false, $file);

        /* @var $subCollection RuleCollection */
        foreach ($tags as $tagName => $tagAttrs) {
            $subCollection->addTag($tagName, $tagAttrs);
        }

        $collection->addCollection($subCollection);
    }
protected function parseImport ( RuleCollection $ collection , \ DOMElement $ node , $ path , $ file ) { if ( '' === $ resource = $ node -> getAttribute ( 'resource' ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The <import> element in file "%s" must have a "resource" attribute.' , $ path ) ) ; } $ type = $ node -> getAttribute ( 'type' ) ; list ( $ tags ) = $ this -> parseConfigs ( $ node , $ path ) ; $ this -> setCurrentDir ( dirname ( $ path ) ) ; $ subCollection = $ this -> import ( $ resource , ( '' !== $ type ? $ type : null ) , false , $ file ) ; /* @var $subCollection RuleCollection */ foreach ( $ tags as $ tagName => $ tagAttrs ) { $ subCollection -> addTag ( $ tagName , $ tagAttrs ) ; } $ collection -> addCollection ( $ subCollection ) ; }
Parses an import and adds the rules in the resource to the RuleCollection.

@param RuleCollection $collection RuleCollection instance
@param \DOMElement    $node       Element to parse that represents a Rule
@param string         $path       Full path of the XML file being processed
@param string         $file       Loaded file name

@throws \InvalidArgumentException When the XML is invalid
Parses an import and adds the rules in the resource to the RuleCollection .