本文整理汇总了PHP中static::paths方法的典型用法代码示例。如果您正苦于以下问题:PHP static::paths方法的具体用法?PHP static::paths怎么用?PHP static::paths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::paths方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: path
/**
* Add paths
* @param Array|String $path
*/
public static function path($path)
{
if (!is_array($path)) {
$path = array($path);
}
static::$paths = static::$paths + $path;
}
示例2: addPath
/**
* Adds a template path to search in.
*
* @param string|array $path
*/
public static function addPath($path, $prepend = false)
{
if ($prepend) {
static::$paths = array_merge([$path], static::$paths);
} else {
static::$paths[] = $path;
}
}
示例3: set_path
public static function set_path($name, $value = null)
{
if (is_array($name)) {
static::$paths = array_replace(static::$paths, $name);
} else {
static::$paths[$name] = $value;
}
}
示例4: initialize
public static function initialize($paths, $baseNamespace = 'App')
{
static::$baseNamespace = rtrim($baseNamespace, '\\') . '\\';
static::$config = new Config(APP_LOCAL ? $paths['config'] . 'local/' : $paths['config']);
static::$paths = $paths;
static::$loader = new Loader();
static::$loader->registerNamespaces([static::$baseNamespace . 'Assets' => $paths['assets'], static::$baseNamespace . 'Bootstrap' => $paths['bootstrap'], static::$baseNamespace . 'Components' => $paths['components'], static::$baseNamespace . 'Helpers' => $paths['helpers'], static::$baseNamespace . 'Libraries' => $paths['libraries'], static::$baseNamespace . 'Models' => $paths['models'], static::$baseNamespace . 'Modules' => $paths['modules']]);
static::$loader->register();
}
示例5: initialize
protected static function initialize()
{
if (static::$initialized) {
return;
}
static::$initialized = true;
static::$parentPath = __FILE__;
for ($i = substr_count(get_class(), static::$nsChar); $i >= 0; $i--) {
static::$parentPath = dirname(static::$parentPath);
}
static::$paths = array();
static::$files = array(__FILE__);
}
示例6: getPath
/**
* @param string $type
*
* @return bool|array|string
*/
private static function getPath($type = null)
{
if (null === static::$paths) {
$rootDir = getcwd();
$appDir = $rootDir . '/app';
$srcDir = $rootDir . '/src';
$venDir = $rootDir . '/vendor';
static::$paths = array('root' => $rootDir, 'app' => $appDir, 'config' => $appDir . '/config', 'cache' => $appDir . '/cache', 'source' => $srcDir, 'vendor' => $venDir);
}
if (null === $type) {
return static::$paths;
}
if (!isset(static::$paths[$type])) {
return false;
}
return static::$paths[$type];
}
示例7: setAppRootPath
/**
* Set the application root directory.
*
* @param string $rootPath Path of the application's root.
*/
public function setAppRootPath($rootPath = null)
{
$root = $this->removeTrailingSlash($rootPath === null ? getcwd() : $rootPath);
static::$paths = array_merge(static::$paths, ['app' => $root, 'web' => "{$root}/Web", 'vendor' => "{$root}/vendor", 'config' => "{$root}/Config", 'layouts' => "{$root}/Layouts", 'modules' => "{$root}/Modules"]);
return $this;
}
示例8: paths
static function paths($paths)
{
static::$paths = static::norm_paths($paths);
}
示例9: reset
/**
* @return void
*/
public static function reset()
{
static::$paths = array(__DIR__);
static::$exts = array('php');
}
示例10: setPaths
public static function setPaths($options)
{
static::$paths = $options;
}
示例11: setPaths
/**
* @param $paths
* @return $this
*/
protected function setPaths($paths)
{
static::$paths = $paths;
return $this;
}
示例12: _init
/**
* Static init load the paths and urls from the configuration
*
* @return void
*/
public static function _init()
{
static::$paths = ClanCats::$config->get('storage.paths');
static::$urls = ClanCats::$config->get('storage.urls');
}
示例13: run
/**
* Run loader
*
* @param array $paths autoload directories
*
* @return boolean
*/
public static function run(array $paths = array())
{
static::$paths = array_merge(static::$paths, $paths);
return spl_autoload_register('Chochan\\Autoload\\Loader::load');
}
示例14: set_paths
/**
* 设置paths
*/
protected static function set_paths($name = null)
{
if (is_null($name)) {
$name = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
}
if (!empty($name)) {
$paths = trim($name, '/');
if ($paths !== '') {
static::$paths = explode('/', $paths);
}
}
}
示例15: add_path
/**
* Add paths
*
* @param string|array $path
*/
public static function add_path($path)
{
static::$paths = array_merge(static::$paths, (array) $path);
}