本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
示例14: __construct
/**
* Constructeur
*/
private function __construct()
{
static::$params = new \stdClass();
static::$input = new Input();
Session::add('bow.old', static::$input->all());
}
示例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}`.");
}
}