Generate PHP config file.

@param string $path
@param string $namespace
421502
public function phpConfigFile($path, array $config = [], $namespace = null)
    {
        $this->file($path)->text(Php\ConfigGenerator::generateText($config, $namespace));
    }
1360218
public function generate($path)
    {
        if ('tabs' === $this->config->get('indent', 'extra')) {
            $indent = "\t";
        } else {
            $indent = '    ';
        }

        $namespace = $this->config->get('namespace');

        foreach ($this->files as $file) {
            $class = $file->getClassDefinition();
            $source = $this->buildClass($class, $indent);

            $filename = ucfirst($class->getName()).'.zep.php';
            $filePath = $path.str_replace(
                $namespace,
                '',
                str_replace($namespace.'\\\\', \DIRECTORY_SEPARATOR, strtolower($class->getNamespace()))
            );
            $filePath = str_replace('\\', \DIRECTORY_SEPARATOR, $filePath);
            $filePath = str_replace(\DIRECTORY_SEPARATOR.\DIRECTORY_SEPARATOR, \DIRECTORY_SEPARATOR, $filePath);

            if (!is_dir($filePath)) {
                mkdir($filePath, 0777, true);
            }

            $filePath = realpath($filePath).'/';
            file_put_contents($filePath.$filename, $source);
        }
    }
458848
public static function any($path, $name, $namespaceOrController) {
        $item = new ConfigurationItem($path, $name, ['GET', 'POST', 'PUT', 'DELETE', 'HEAD'], $namespaceOrController);
        self::$configuration[] = $item;
        return $item;
    }
964720
public function createFromConfig(string $path) : SettingsContract {
        $configData = (array) $this->filesystem->getRequire($path);

        return $this->createFromData($configData);
    }
857157
protected function loadConstantsFrom($path, $namespace = null)
    {
        $constants = require $path;
        $prefix = $namespace ? "$namespace" : '';

        foreach ($constants as $constant => $value) {
            define(strtoupper("{$prefix}{$constant}"), $value);
        }
    }
1056333
public function addPath($path, $namespace = self::MAIN_NAMESPACE)
    {
        // invalidate the cache
        $this->cache = array();

        if (!is_dir($path)) {
            throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist.', $path));
        }

        $this->paths[$namespace][] = rtrim($path, '/\\');
    }
749863
public function register_namespace( $namespace, $paths )
    {
        if ( isset( $this->namespaces[ $namespace ] ) )
        {
            $this->namespaces[ $namespace ] = array_merge(
                $this->namespaces[ $namespace ],
                (array) $paths
            );
        } 
        else 
        {
            $this->namespaces[ $namespace ] = (array) $paths;
            
            // Register PSR_0 as the first autoload filter for every namespace
            $this->register_autoload_filter( $namespace, array( $this, "PSR_0" ) );
        }
    }
763544
public function set_config($name,$data,$path,$namespace = '')
    {
        //写入文件
        $str = '';
        $this->set_head($str,$name,$namespace);
        $this->set_content($data,$str);
        Func:: M('file') ::createDir($path);
        file_put_contents($path.$name.'.php',$str);
        //mkdir($path.$name.'.php',0777);
    }
1016201
public function prependPath($path, $namespace = self::MAIN_NAMESPACE)
    {
        $path = rtrim($path, '/\\');

        if (!isset($this->paths[$namespace])) {
            $this->paths[$namespace][] = $path;
        } else {
            array_unshift($this->paths[$namespace], $path);
        }
    }
362197
public function getModuleConfig(string $namespace) {
		if (array_key_exists($namespace, $this->moduleConfigs)) {
			return $this->moduleConfigs[$namespace];
		}
		
		$module = $this->moduleManager->getModuleByNs($namespace);
		if ($module->hasConfigDescriber()) {
			return $this->moduleConfigs[$namespace] = $module->createConfigDescriber($this)->buildCustomConfig();
		}
		
		return $this->moduleConfigs[$namespace] = null;
	}
426391
protected function load(string $path): void
    {
        $namespace = $this->app->getNamespace();

        /** @var SplFileInfo[] $files */
        $files = (new Finder)->in($path)->files();

        foreach ($files as $file) {
            $file = $namespace.str_replace(
                    ['/', '.php'],
                    ['\\', ''],
                    Str::after($file->getPathname(), app_path().DIRECTORY_SEPARATOR)
                );

            if (is_subclass_of($file, Intent::class) && !(new ReflectionClass($file))->isAbstract()) {
                $this->app['conversation']->registerIntent($file);
            }
        }
    }
565287
public function addConfigComponent($package, $namespace, $path)
    {
        if ($this->hasPackageRepository()) {
            $this->app->make('config')->package($package, $path, $namespace);
        }
    }
103165
public function addPath($path, $namespace = null)
    {
        $key = (is_null($namespace)) ? $path : $namespace . '::' . $path;

        $this->fullQualifiedPathNameWithTemplatePath[$key] = new TemplatePath($path, $namespace);
    }
893334
protected function getMessagesFromSourcePath($path, $namespace)
    {
        $messages = [];
        if (! $this->file->exists($path)) {
            throw new \Exception("${path} doesn't exists!");
        }
        foreach ($this->file->allFiles($path) as $file) {
            $pathName = $file->getRelativePathName();
            if ($this->file->extension($pathName) !== 'php') {
                continue;
            }
            $key = substr($pathName, 0, -4);
            $key = str_replace('\\', '.', $key);
            $key = str_replace('/', '.', $key);

            $array = explode('.', $key, 2);
            $keyWithNamespace = $array[0].'.'.$namespace.'::'.$array[1];
            $messages[$keyWithNamespace] = include "${path}/${pathName}";
        }

        return $messages;
    }
104368
public function addPath($path, $namespace = self::MAIN_NAMESPACE)
    {
        // invalidate the cache
        $this->cache = [];

        $this->paths[$namespace][] = rtrim($path, '/\\');
    }
415190
public static function config($path)
    {
        $data = \UtilsSandboxLoader('application/Config/' . strtr($path, '.', '/') . '.php');

        foreach ($data as $key => $value) {
            self::env($key, $value);
        }

        $data = null;
    }
459465
public function ns($nameSpace)
    {
        // If ! exist try to load a configuration file 
        if ( !isset($this->nameSpaces[$nameSpace]) ) {
            // short sanitize of nameSpace
            if (!filter_var( $nameSpace,FILTER_VALIDATE_REGEXP, 
                array('options'=>array('regexp' => '/^[\w]+$/')))) {
                    throw new InvalidArgumentException("Invalid configuration name.",400);
            }
            $this->nameSpaces[$nameSpace] = new ContextNameSpace($this->loadArrayFromIniFile($nameSpace));
        }
        
        return $this->nameSpaces[$nameSpace];
    }