protected function parseXml(SplFileInfo $file)
    {
        $dom = XmlUtils::loadFile($file, realpath(dirname(__DIR__) . DS . 'Schema' . DS . 'smarty_filter.xsd'));
        /** @var \Symfony\Component\DependencyInjection\SimpleXMLElement $xml */
        $xml = simplexml_import_dom($dom, '\\Symfony\\Component\\DependencyInjection\\SimpleXMLElement');

        $parsedConfig = [];
        /** @var \Symfony\Component\DependencyInjection\SimpleXMLElement $smartyFilterDefinition */
        foreach ($xml->smartyfilter as $smartyFilterDefinition) {
            $descriptive = [];
            /** @var \Symfony\Component\DependencyInjection\SimpleXMLElement $descriptiveDefinition */
            foreach ($smartyFilterDefinition->descriptive as $descriptiveDefinition) {
                $descriptive[] = [
                    'locale' => $descriptiveDefinition->getAttributeAsPhp('locale'),
                    'title' => (string)$descriptiveDefinition->title,
                    'description' => (string)$descriptiveDefinition->description,
                    'type' => (string)$descriptiveDefinition->type
                ];
            }

            $parsedConfig['smarty_filter'][] = [
                'code' => $smartyFilterDefinition->getAttributeAsPhp('code'),
                'descriptive' => $descriptive
            ];
        }


        return $parsedConfig;
    }
protected function parseXml(SplFileInfo $file)
    {
        $dom = XmlUtils::loadFile($file, realpath(dirname(__DIR__) . DS . 'Schema' . DS . 'smarty_filter.xsd'));
        /** @var \Symfony\Component\DependencyInjection\SimpleXMLElement $xml */
        $xml = simplexml_import_dom($dom, '\\Symfony\\Component\\DependencyInjection\\SimpleXMLElement');

        $parsedConfig = [];
        /** @var \Symfony\Component\DependencyInjection\SimpleXMLElement $smartyFilterDefinition */
        foreach ($xml->smartyfilter as $smartyFilterDefinition) {
            $descriptive = [];
            /** @var \Symfony\Component\DependencyInjection\SimpleXMLElement $descriptiveDefinition */
            foreach ($smartyFilterDefinition->descriptive as $descriptiveDefinition) {
                $descriptive[] = [
                    'locale' => $descriptiveDefinition->getAttributeAsPhp('locale'),
                    'title' => (string)$descriptiveDefinition->title,
                    'description' => (string)$descriptiveDefinition->description,
                    'type' => (string)$descriptiveDefinition->type
                ];
            }

            $parsedConfig['smarty_filter'][] = [
                'code' => $smartyFilterDefinition->getAttributeAsPhp('code'),
                'descriptive' => $descriptive
            ];
        }


        return $parsedConfig;
    }
protected function parseXml ( SplFileInfo $ file ) { $ dom = XmlUtils :: loadFile ( $ file , realpath ( dirname ( __DIR__ ) . DS . 'Schema' . DS . 'smarty_filter.xsd' ) ) ; /** @var \Symfony\Component\DependencyInjection\SimpleXMLElement $xml */ $ xml = simplexml_import_dom ( $ dom , '\\Symfony\\Component\\DependencyInjection\\SimpleXMLElement' ) ; $ parsedConfig = [ ] ; /** @var \Symfony\Component\DependencyInjection\SimpleXMLElement $smartyFilterDefinition */ foreach ( $ xml -> smartyfilter as $ smartyFilterDefinition ) { $ descriptive = [ ] ; /** @var \Symfony\Component\DependencyInjection\SimpleXMLElement $descriptiveDefinition */ foreach ( $ smartyFilterDefinition -> descriptive as $ descriptiveDefinition ) { $ descriptive [ ] = [ 'locale' => $ descriptiveDefinition -> getAttributeAsPhp ( 'locale' ) , 'title' => ( string ) $ descriptiveDefinition -> title , 'description' => ( string ) $ descriptiveDefinition -> description , 'type' => ( string ) $ descriptiveDefinition -> type ] ; } $ parsedConfig [ 'smarty_filter' ] [ ] = [ 'code' => $ smartyFilterDefinition -> getAttributeAsPhp ( 'code' ) , 'descriptive' => $ descriptive ] ; } return $ parsedConfig ; }
Get config from xml file

@param SplFileInfo $file XML file

@return array Smarty Filter module configuration
Get config from xml file