src/lib/Herrera/Wise/Loader/AbstractFileLoader.php
public function process($data, $file)
    {
        if (empty($data)) {
            return array();
        }

        if (isset($data['imports'])) {
            if (false === is_array($data['imports'])) {
                throw ImportException::format(
                    'The "imports" value is not valid in "%s".',
                    $file
                );
            }

            $dir = dirname($file);

            foreach ($data['imports'] as $i => $import) {
                if (false === is_array($import)) {
                    throw ImportException::format(
                        'One of the "imports" values (#%d) is not valid in "%s".',
                        $i,
                        $file
                    );
                }

                if (false === isset($import['resource'])) {
                    throw ImportException::format(
                        'A resource was not defined for an import in "%s".',
                        $file
                    );
                }

                $this->setCurrentDir($dir);

                $data = array_replace_recursive(
                    $this->import(
                        $import['resource'],
                        null,
                        isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : false
                    ),
                    $data
                );
            }
        }

        $global = $this->wise ? $this->wise->getGlobalParameters() : array();
        $_this = $this;

        ArrayUtil::walkRecursive(
            $data,
            function (&$value, $key, &$array) use (&$data, $global, $_this) {
                $value = $_this->doReplace($value, $data, $global);

                if (false !== strpos($key, '%')) {
                    unset($array[$key]);

                    $key = $_this->doReplace($key, $data, $global);

                    $array[$key] = $value;
                }
            }
        );

        return $data;
    }
public function process($data, $file)
    {
        if (empty($data)) {
            return array();
        }

        if (isset($data['imports'])) {
            if (false === is_array($data['imports'])) {
                throw ImportException::format(
                    'The "imports" value is not valid in "%s".',
                    $file
                );
            }

            $dir = dirname($file);

            foreach ($data['imports'] as $i => $import) {
                if (false === is_array($import)) {
                    throw ImportException::format(
                        'One of the "imports" values (#%d) is not valid in "%s".',
                        $i,
                        $file
                    );
                }

                if (false === isset($import['resource'])) {
                    throw ImportException::format(
                        'A resource was not defined for an import in "%s".',
                        $file
                    );
                }

                $this->setCurrentDir($dir);

                $data = array_replace_recursive(
                    $this->import(
                        $import['resource'],
                        null,
                        isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : false
                    ),
                    $data
                );
            }
        }

        $global = $this->wise ? $this->wise->getGlobalParameters() : array();
        $_this = $this;

        ArrayUtil::walkRecursive(
            $data,
            function (&$value, $key, &$array) use (&$data, $global, $_this) {
                $value = $_this->doReplace($value, $data, $global);

                if (false !== strpos($key, '%')) {
                    unset($array[$key]);

                    $key = $_this->doReplace($key, $data, $global);

                    $array[$key] = $value;
                }
            }
        );

        return $data;
    }
public function process ( $ data , $ file ) { if ( empty ( $ data ) ) { return array ( ) ; } if ( isset ( $ data [ 'imports' ] ) ) { if ( false === is_array ( $ data [ 'imports' ] ) ) { throw ImportException :: format ( 'The "imports" value is not valid in "%s".' , $ file ) ; } $ dir = dirname ( $ file ) ; foreach ( $ data [ 'imports' ] as $ i => $ import ) { if ( false === is_array ( $ import ) ) { throw ImportException :: format ( 'One of the "imports" values (#%d) is not valid in "%s".' , $ i , $ file ) ; } if ( false === isset ( $ import [ 'resource' ] ) ) { throw ImportException :: format ( 'A resource was not defined for an import in "%s".' , $ file ) ; } $ this -> setCurrentDir ( $ dir ) ; $ data = array_replace_recursive ( $ this -> import ( $ import [ 'resource' ] , null , isset ( $ import [ 'ignore_errors' ] ) ? ( bool ) $ import [ 'ignore_errors' ] : false ) , $ data ) ; } } $ global = $ this -> wise ? $ this -> wise -> getGlobalParameters ( ) : array ( ) ; $ _this = $ this ; ArrayUtil :: walkRecursive ( $ data , function ( & $ value , $ key , & $ array ) use ( & $ data , $ global , $ _this ) { $ value = $ _this -> doReplace ( $ value , $ data , $ global ) ; if ( false !== strpos ( $ key , '%' ) ) { unset ( $ array [ $ key ] ) ; $ key = $ _this -> doReplace ( $ key , $ data , $ global ) ; $ array [ $ key ] = $ value ; } } ) ; return $ data ; }
Imports other configuration files and resolves references.

@param array  $data The data.
@param string $file The file source.

@return array The processed data.

@throws ImportException           If "imports" is invalid.
@throws InvalidReferenceException If an invalid reference is used.
Imports other configuration files and resolves references .