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;
    }