ThinkPHP/Library/Vendor/Boris/Config.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

/* vim: set shiftwidth=2 expandtab softtabstop=2: */

namespace Boris;

/**
 * Config handles loading configuration files for boris
 */
class Config {
  private $_searchPaths;
  private $_cascade = false;
  private $_files   = array();

  /**
   * Create a new Config instance, optionally with an array
   * of paths to search for configuration files.
   *
   * Additionally, if the second, optional boolean argument is
   * true, all existing configuration files will be loaded, and
   * effectively merged.
   *
   * @param array $searchPaths
   * @param bool  $cascade
   */
  public function __construct($searchPaths = null, $cascade = false) {
    if (is_null($searchPaths)) {
      $searchPaths = array();

      if ($userHome = getenv('HOME')) {
        $searchPaths[] = "{$userHome}/.borisrc";
      }

      $searchPaths[] = getcwd() . '/.borisrc';
    }

    $this->_cascade     = $cascade;
    $this->_searchPaths = $searchPaths;
  }

  /**
   * Searches for configuration files in the available
   * search paths, and applies them to the provided
   * boris instance.
   *
   * Returns true if any configuration files were found.
   *
   * @param  Boris\Boris $boris
   * @return bool
   */
  public function apply(Boris $boris) {
    $applied = false;

    foreach($this->_searchPaths as $path) {
      if (is_readable($path)) {
        $this->_loadInIsolation($path, $boris);

        $applied = true;
        $this->_files[] = $path;

后面还有 25 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。