当前位置: 首页>>代码示例>>PHP>>正文


PHP static::params方法代码示例

本文整理汇总了PHP中static::params方法的典型用法代码示例。如果您正苦于以下问题:PHP static::params方法的具体用法?PHP static::params怎么用?PHP static::params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在static的用法示例。


在下文中一共展示了static::params方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getParam

 /**
  * Returns a test configuration param from /data/config.php
  * @param  string $name params name
  * @param  mixed $default default value to use when param is not set.
  * @return mixed  the value of the configuration param
  */
 public static function getParam($name, $default = null)
 {
     if (static::$params === null) {
         static::$params = (require __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'config.php');
     }
     return isset(static::$params[$name]) ? static::$params[$name] : $default;
 }
开发者ID:lebedyncrs,项目名称:yii2-attrswatcher,代码行数:13,代码来源:TestCase.php

示例2: parse

 public static function parse($name, $src, $docendpos = 0)
 {
     $info = new static();
     $info->name($name);
     if ($docendpos > 0) {
         $doc = trim(substr($src, 0, $docendpos));
         $startpos = strrpos($doc, '/**');
         if ($startpos !== false) {
             $doc = substr($doc, $startpos);
             if (preg_match('/\\/\\*\\*(.+?)\\*\\//s', $doc, $m)) {
                 $doc = preg_replace('/^[\\s]*\\*[\\s]{0,1}/m', '', $m[1]);
             } else {
                 $doc = '';
             }
         } else {
             $doc = '';
         }
     } else {
         $doc = $src;
     }
     $params = \ebi\Dt\DocParam::parse('param', $doc);
     if (!empty($params)) {
         $info->params($params);
     }
     if (preg_match("/@return\\s+([^\\s]+)(.*)/", $doc, $m)) {
         $info->return(new \ebi\Dt\DocParam('return', $m[1], $m[2]));
     }
     $info->document(trim(preg_replace('/@.+/', '', preg_replace("/^[\\s]*\\*[\\s]{0,1}/m", '', str_replace('*' . '/', '', $doc)))));
     return $info;
 }
开发者ID:tokushima,项目名称:ebi,代码行数:30,代码来源:DocInfo.php

示例3: getParam

 /**
  * Returns a test configuration param from /data/config.php
  * @param  string $name params name
  * @param  mixed $default default value to use when param is not set.
  * @return mixed  the value of the configuration param
  */
 public static function getParam($name, $default = null)
 {
     if (static::$params === null) {
         static::$params = (require __DIR__ . '/data/config.php');
     }
     return isset(static::$params[$name]) ? static::$params[$name] : $default;
 }
开发者ID:ICHydro,项目名称:anaconda,代码行数:13,代码来源:TestCase.php

示例4: getParams

 public static function getParams()
 {
     if (isset(static::$params)) {
         return static::$params;
     }
     JLoader::import('joomla.application.component.helper');
     static::$params = JComponentHelper::getParams('com_fileuploadform');
     return static::$params;
 }
开发者ID:sankam-nikolya,项目名称:FileUploadForm,代码行数:9,代码来源:params.php

示例5: __construct

 /**
  * @inheritDoc
  */
 public function __construct($connectionName = null, $driverClass = null, array $params = [])
 {
     if (!static::$flagInitData) {
         static::$connectionName = $connectionName;
         static::$driverClass = $driverClass;
         static::$params = $params;
         static::$flagInitData = true;
     }
 }
开发者ID:old-town,项目名称:workflow-zf2-toolkit,代码行数:12,代码来源:InitTestAppListener.php

示例6: get

 public static function get($name = null, $default = null)
 {
     if (!static::$params) {
         static::$params = Router::getInstance()->request()->params();
     }
     if ($name) {
         return isset(static::$params[$name]) ? static::$params[$name] : $default;
     } else {
         return static::$params;
     }
 }
开发者ID:CFLOVEYR,项目名称:hook,代码行数:11,代码来源:Input.php

示例7: setUp

 /**
  * SetUp for Tests
  */
 public function setUp()
 {
     parent::setUp();
     // provide config json for running the tests
     if (!file_exists(__DIR__ . '/config.json')) {
         die('Must provide config.json in the tests/ directory');
     } else {
         $file = file_get_contents(__DIR__ . '/config.json');
         static::$params = json_decode($file, true);
     }
 }
开发者ID:petflow,项目名称:litle,代码行数:14,代码来源:FunctionalTestCase.php

示例8: getParam

 /**
  * Returns a test configuration param from config
  * @param string $name params name
  * @param mixed $default default value to use when param is not set.
  * @return mixed the value of the configuration param
  */
 public function getParam($name, $default = null)
 {
     if (static::$params === null) {
         static::$params = (require __DIR__ . '/config/main.php');
         $main_local = __DIR__ . '/config/main-local.php';
         if (file_exists($main_local)) {
             static::$params = array_merge(static::$params, require $main_local);
         }
     }
     return isset(static::$params[$name]) ? static::$params[$name] : $default;
 }
开发者ID:rmrevin,项目名称:yii2-postman,代码行数:17,代码来源:TestCase.php

示例9: init

 /**
  * init
  *
  * @param   \JDocument $template JDcoument object.
  * @param   \JRegistry $params   Template params.
  *
  * @return  Template
  */
 public function init(\JDocument $template, \JRegistry $params)
 {
     include_once static::windwalkerPath();
     static::$template = $template;
     static::$params = $params;
     static::$asset = Container::getInstance('tpl_' . static::$name)->get('helper.asset');
     // Reset AssetHelper
     static::$asset->resetPaths();
     static::$asset->setDoc($template);
     static::registerStylesheet($template);
     static::registerScript($template);
     return $this;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:21,代码来源:Template.php

示例10: get_params

 public static function get_params()
 {
     if (static::$params !== []) {
         return static::$params;
     }
     \Config::load('db', true);
     $dsn = \Config::get('db.default.connection.dsn');
     list($driver, $tmp) = explode(':', $dsn);
     list($hostStr, $dbnameStr) = explode(';', $tmp);
     list($tmp, $host) = explode('=', $hostStr);
     list($tmp, $dbname) = explode('=', $dbnameStr);
     $username = \Config::get('db.default.connection.username');
     $password = \Config::get('db.default.connection.password');
     static::$params = ['host' => $host, 'dbname' => $dbname, 'username' => $username, 'password' => $password];
     return static::$params;
 }
开发者ID:pagmovel,项目名称:php-orm-benchmark,代码行数:16,代码来源:dbconfig.php

示例11: init

 public static function init()
 {
     $uri = explode('?', $_SERVER['REQUEST_URI']);
     $ajax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ? true : false;
     static::$params = ['user_agent' => $_SERVER['HTTP_USER_AGENT'], 'status' => $_SERVER['REDIRECT_STATUS'], 'host' => $_SERVER['SERVER_NAME'], 'port' => $_SERVER['SERVER_PORT'], 'ip_address' => $_SERVER['REMOTE_ADDR'], 'method' => strtolower($_SERVER['REQUEST_METHOD']), 'query_string' => $_SERVER['QUERY_STRING'], 'uri' => $uri[0], 'ajax' => $ajax, 'accept' => $_SERVER['HTTP_ACCEPT'], 'accept_encoding' => $_SERVER['HTTP_ACCEPT_ENCODING'], 'accept_language' => $_SERVER['HTTP_ACCEPT_LANGUAGE']];
     if (isset($_POST['_method'])) {
         static::$params['method'] = strtolower($_POST['_method']);
         unset($_POST['_method']);
     }
     foreach ($_GET as $key => $value) {
         static::$inputs[$key] = $value;
     }
     foreach ($_POST as $key => $value) {
         static::$inputs[$key] = $value;
     }
     foreach ($_FILES as $input_name => $file_properties) {
         if (is_array($file_properties['name'])) {
             // Closure
             $filter = function ($path) use($input_name) {
                 // get the type as: name, tmp_name, size, error, type (mime-type)
                 $type = substr($path, 0, strpos($path, '.'));
                 // get the value of path in $_FILES array from $path :P
                 $pathWitoutType = substr($path, strpos($path, '.') + 1);
                 if ($type === 'tmp_name') {
                     $file = new File(get_array_value($_FILES, $input_name . '.tmp_name.' . $pathWitoutType), static::$file_error_codes[get_array_value($_FILES, $input_name . '.error.' . $pathWitoutType)], get_array_value($_FILES, $input_name . '.name.' . $pathWitoutType));
                     $file->setArrayPath($input_name . '.' . $pathWitoutType);
                     return $file;
                 }
                 return null;
             };
             static::$files = array_merge(static::$files, array_paths($_FILES[$input_name], [], null, $filter));
         } else {
             $file = new File($file_properties['tmp_name'], static::$file_error_codes[$file_properties['error']], $file_properties['name']);
             $file->setArrayPath($input_name);
             static::$files = array_merge(static::$files, [$file]);
         }
     }
     unset($_FILES);
     unset($_GET);
     unset($_POST);
     unset($_SERVER);
 }
开发者ID:ramee,项目名称:alien-framework,代码行数:42,代码来源:Request.php

示例12: createFromArray

 /**
  * Create a route from an array representation
  *
  * @param array $array
  *
  * @return Route
  */
 public static function createFromArray(array $array)
 {
     $route = new static($array['patterns']);
     if (isset($array['name'])) {
         $route->name($array['name']);
     }
     if (isset($array['params'])) {
         $route->params($array['params']);
     }
     if (isset($array['values'])) {
         $route->values($array['values']);
     }
     if (isset($array['conditions'])) {
         $route->conditions($array['conditions']);
     }
     if (isset($array['attributes'])) {
         $route->attributes($array['attributes']);
     }
     return $route;
 }
开发者ID:aurelienlhx,项目名称:PhpComponents,代码行数:27,代码来源:Route.php

示例13: run

 public static function run($config)
 {
     if (isset($config['db'])) {
         if (isset($config['db']['username'])) {
             static::$db = new DB($config['db']['dsn'], $config['db']['username'], $config['db']['password']);
         } else {
             static::$db = new DB($config['db']['dsn']);
         }
     }
     static::$assets = new Assets(isset($config['assets']) ? $config['assets'] : []);
     static::$user = new User();
     static::$url = new Url();
     static::$request = new Request();
     static::$session = new Session();
     static::$helper = new Helper();
     static::$params = $config['params'];
     $url = str_replace(static::$url->path(), '', $_SERVER['REQUEST_URI']);
     $options = isset($config['route']) ? $config['route'] : [];
     static::$route = new Route($url, $options);
     static::$route->run();
 }
开发者ID:mgilangjanuar,项目名称:helium,代码行数:21,代码来源:App.php

示例14: __construct

 /**
  * Constructeur
  */
 private function __construct()
 {
     static::$params = new \stdClass();
     static::$input = new Input();
     Session::add('bow.old', static::$input->all());
 }
开发者ID:papac,项目名称:framework,代码行数:9,代码来源:Request.php

示例15: prepareParams

 private static function prepareParams($settings)
 {
     self::$params = [];
     foreach ($settings['params'] as $paramStorage) {
         if (is_array($paramStorage)) {
             static::$params = array_merge(self::$params, $paramStorage);
             continue;
         }
         // environment
         if ($paramStorage === 'env' || $paramStorage === 'environment') {
             static::$params = array_merge(self::$params, $_SERVER);
             continue;
         }
         $paramsFile = realpath(self::$dir . '/' . $paramStorage);
         if (!file_exists($paramsFile)) {
             throw new ConfigurationException("Params file {$paramsFile} not found");
         }
         // yaml parameters
         if (preg_match('~\\.yml$~', $paramStorage)) {
             $params = Yaml::parse(file_get_contents($paramsFile));
             if (isset($params['parameters'])) {
                 // Symfony style
                 $params = $params['parameters'];
             }
             static::$params = array_merge(self::$params, $params);
             continue;
         }
         // .env and ini files
         if (preg_match('~(\\.ini$|\\.env(\\.|$))~', $paramStorage)) {
             $params = parse_ini_file($paramsFile);
             static::$params = array_merge(self::$params, $params);
             continue;
         }
         throw new ConfigurationException("Params can't be loaded from `{$paramStorage}`.");
     }
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:36,代码来源:Configuration.php


注:本文中的static::params方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。