获取Core对象

@param array $paths
@param array $confPath

@return AgileCore
@throws \Exception
553882
public static function init(array $paths = [], array $confPath = []) : AgileCore
    {
        if(!(self::$core instanceof AgileCore)) {
            self::$core = new self($paths, $confPath);
        }

        return self::$core;
    }
1114000
public function put($path, $contents, array $config = []) {
        return $this->getFileSystem()->put($path, $contents, $config);
    }
235856
public function put($path, $contents, array $config = [])
    {
        return $this->fileSystem->put($path, $contents, $config);
    }
311848
public static function create($paths)
    {
        $backends = array(
            new Backend\Inotifywait($paths),
            new Backend\Fswatch($paths),
            new Backend\Watchmedo($paths),
            new Backend\Inotify($paths),
            new Backend\Poll($paths),
        );
        foreach ($backends as $b) {
            if ($b->isAvailable()) {
                $backend = $b;
                break;
            }
        }
        return $backend;
    }
603016
public function setPaths($paths)
    {
        $paths = (array)$paths;
        //Append framework's view path
        $paths[] = realpath(__DIR__ . '/../../views');

        $this->paths = $paths;
        return $this;
    }
1317189
public function commonDir($paths)
	{
		// $this->debug->groupCollapsed(__CLASS__.'->'.__FUNCTION__);
		$re_split = '#[\\\/]#';
		$count = 0;
		foreach ($paths as $k => $path) {
			if (empty($path)) {
				unset($paths[$k]);
				continue;
			}
			$ds = strpos($path, '/') !== false
				? '/'
				: $this->cfg['ds'];
			$levels = preg_split($re_split, $path);
			if (count($levels) > $count) {
				$count = count($levels);
			}
		}
		foreach ($paths as $path) {
			$parts = preg_split($re_split, $path);
			while ($count >= 0) {
				if (array_slice($levels, 0, $count) == array_slice($parts, 0, $count)) {
					$levels = array_slice($levels, 0, $count);
					continue 2;
				}
				$count--;
			}
		}
		$return = !empty($levels)
			? implode($ds, $levels)
			: '';
		// $this->debug->groupEnd();
		return $return;
	}
967891
public function load($configPath, $targetPath)
  {
    $mapper = new AssetMapper();
    $configDir = dirname($configPath);

    $parameters = $this->parser->load($configPath);
    foreach ($parameters as $key => $value) {
      if (in_array($key, $this->dirs)) {
        $mapper->map(
          $configDir . "/" . $value,
          $targetPath . "/" . $value
        );
      }
    }

    return $mapper;
  }
1061217
protected function runConfigFile($configPath)
    {
        if (is_array($configPath)) {
            return $this->recurseArg($configPath, array($this, "runConfigFile"));
        } else {
            if ($this->runFrom) {
                $curdir = getcwd();
                chdir($this->phpci->buildPath . DIRECTORY_SEPARATOR . $this->runFrom);
            }

            $phpunit = $this->phpci->findBinary('phpunit');

            $cmd = $phpunit . ' --tap %s -c "%s" ' . $this->coverage . $this->path;
            $success = $this->phpci->executeCommand($cmd, $this->args, $this->phpci->buildPath . $configPath);

            if ($this->runFrom) {
                chdir($curdir);
            }

            return $success;
        }
    }
608544
public function setConfig($paths = [], $value = null)
    {
        if (!is_array($paths)) {
            $paths = [$paths => $value];
        }

        foreach ($paths as $path=>$value) {
            $pos = &$this->_lookupConfigElement($path, true);

            if (is_array($pos) && !empty($pos) && is_array($value)) {
                // special treatment for arrays - merge them
                $pos = array_merge($pos, $value);
            } else {
                // otherwise just assign value
                $pos = $value;
            }
        }

        return $this;
    }
1157974
public function initFromPath($path)
    {
        if ( ! file_exists($path)) {
            throw new \Intervention\Image\Exception\NotReadableException(
                "Unable to find file ({$path})."
            );
        }

        // get mime type of file
        $mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);

        // define core
        switch (strtolower($mime)) {
            case 'image/png':
            case 'image/x-png':
                $core = @imagecreatefrompng($path);
                break;

            case 'image/jpg':
            case 'image/jpeg':
            case 'image/pjpeg':
                $core = @imagecreatefromjpeg($path);
                if (!$core) {
                    $core= @imagecreatefromstring(file_get_contents($path));
                }
                break;

            case 'image/gif':
                $core = @imagecreatefromgif($path);
                break;

            case 'image/webp':
            case 'image/x-webp':
                if ( ! function_exists('imagecreatefromwebp')) {
                    throw new \Intervention\Image\Exception\NotReadableException(
                        "Unsupported image type. GD/PHP installation does not support WebP format."
                    );
                }
                $core = @imagecreatefromwebp($path);
                break;

            default:
                throw new \Intervention\Image\Exception\NotReadableException(
                    "Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files."
                );
        }

        if (empty($core)) {
            throw new \Intervention\Image\Exception\NotReadableException(
                "Unable to decode image from file ({$path})."
            );
        }

        $this->gdResourceToTruecolor($core);

        // build image
        $image = $this->initFromGdResource($core);
        $image->mime = $mime;
        $image->setFileInfoFromPath($path);

        return $image;
    }
77190
public static function generateHashes($configPath = 'FileStorage') {
		if (is_array($configPath)) {
			$imageSizes = $configPath;
		} else {
			$imageSizes = Configure::read($configPath . '.imageSizes');
		}
		if ($imageSizes === null) {
			throw new RuntimeException(sprintf('Image processing configuration in `%s` is missing!', $configPath . '.imageSizes'));
		}

		static::ksortRecursive($imageSizes);
		foreach ($imageSizes as $model => $version) {
			foreach ($version as $name => $operations) {
				Configure::write($configPath . '.imageHashes.' . $model . '.' . $name, static::hashOperations($operations));
			}
		}

		return Configure::read($configPath . '.imageHashes');
	}
1146674
public static function resolve($path, array $config) {
		$ids = Cache::read('default', 'soundcloud_resolved_ids') ?: [];

		if (isset($ids[$path])) {
			return $ids[$path];
		}
		$result = static::_api('resolve', $config, [
			'url' => 'http://soundcloud.com/' . $path
		]);
		if (!$result) {
			return false;
		}
		$ids[$path] = $result['id'];
		Cache::write('default', 'soundcloud_resolved_ids', $ids);
		return $result['id'];
	}
897268
public static function combinePath(...$paths)
    {
        //$paths=func_get_args();
        $value="";
        for($i=0;$i<count($paths);$i++){
            $path=$paths[$i];
            if($i>0){
                $value.="/";
                $path=ltrim($path,"/");
            }
            if($i<count($paths)-1){
                $path=rtrim($path,"/");
            }
            $value.=$path;
        }
        return $value;
    }
1259840
public function loadPaths($basePath = null, $configPath = null)
    {
        if ($basePath) {
            $this->basePath = realpath($basePath);
        }

        $this->paths = $this->loadConfig($configPath);

        return $this;
    }
610006
protected static function convertToTree(array $paths): array
    {
        foreach ($paths as $index => $path) {
            static::convertPathToTree($paths, $index, $path);
        }

        return $paths;
    }
515905
public function tryPath($path, $flags = 0x000000) {
    $flags |= self::VALIDATE;
    try {
      return $this->getPath($path, $flags);
    } catch (Exception $e) {
      if ($e->getCode() === self::VALIDATE) {
        return FALSE;
// @codeCoverageIgnoreStart
      } else {
        throw $e;
      }
// @codeCoverageIgnoreEnd
    }
  }
300052
protected function bladeFilesIn(array $paths)
    {
        return collect(
            Finder::create()
                ->in($paths)
                ->exclude('vendor')
                ->name('*.blade.php')
                ->files()
        );
    }