本文整理汇总了PHP中static::name方法的典型用法代码示例。如果您正苦于以下问题:PHP static::name方法的具体用法?PHP static::name怎么用?PHP static::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: __callStatic
public static function __callStatic($name, $arguments)
{
if ($name == 'getName') {
$self = new static();
return $self->name();
}
}
示例3: getName
/**
* Returns the notifier's name.
*
* @return string
*/
public function getName()
{
if (!static::$name) {
static::$name = str_replace('Notifier', '', join('', array_slice(explode('\\', get_class($this)), -1)));
}
return static::$name;
}
示例4: factory
public static function factory($name)
{
$config = static::service('config');
$assert = static::service('assert');
$dbConfig = $config->get('databases.#1', null, $name);
$assert->notNull($dbConfig);
$db = new static($dbConfig);
$db->name($name);
return $db;
}
示例5: setRequest
/**
* Check the request for the current domain
*
* @param Request $request The request object
*/
public static function setRequest(Request $request)
{
$host = strtolower(preg_replace('/^(.*(\\.|\\/))?([^\\.]+\\.[^\\.]+)$/i', '$3', $request->getHost()));
$sites = Config::get('app.sites');
$name = Config::get('app.fallback_site');
foreach ($sites as $site => $settings) {
$name = in_array($host, $settings['domains']) ? $site : $name;
}
static::$name = $name;
}
示例6: getName
public function getName()
{
if (null !== static::$name) {
return static::$name;
}
$name = get_called_class();
if ($name !== ($nameSegment = explode('\\', $name))) {
$name = $nameSegment[count($nameSegment) - 2];
}
return static::$name = $name;
}
示例7: start
/**
* @param string $name
* @param bool|\Closure $output
* @param bool $cpu
* @param bool $memory
* @param array $ignored
* @return bool
*/
public static function start($name = 'xhprof', $output = false, $cpu = true, $memory = true, $ignored = [])
{
if (!static::checkEnv()) {
return false;
}
static::$name = $name;
static::$output = $output;
$flags = XHPROF_FLAGS_NO_BUILTINS;
if ($cpu) {
$flags = $flags | XHPROF_FLAGS_CPU;
}
if ($memory) {
$flags = $flags | XHPROF_FLAGS_MEMORY;
}
$ignored = $ignored + [__CLASS__ . '::sendData'];
xhprof_enable($flags, ['ignored_functions' => $ignored]);
register_shutdown_function([__CLASS__, 'sendData']);
}
示例8: 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;
}
示例9: migrate
/**
* Run all new migration
*
* @param bool $silent In the silent mode the migrator ignores the migration file
*
* @return void
*/
public static function migrate($silent = false)
{
$migrations = $silent ? static::available() : static::unstaged();
foreach ($migrations as $key => $value) {
if (empty($value)) {
continue;
}
if (\ClanCats::is_cli()) {
\CCCli::info('found new "' . $key . '" migrations.');
}
foreach ($value as $time => $path) {
$migration = new static($path);
// run the migration
$migration->up();
if (\ClanCats::is_cli()) {
\CCCli::success('migrated ' . $migration->name());
}
}
static::$config->set($key . '.revision', $time);
}
if (!$silent) {
static::$config->write();
}
}
示例10: setCacheNameSpace
public static function setCacheNameSpace($name)
{
static::$name = $name;
}
示例11: end
public static function end()
{
static::$sections[static::$name] = ob_get_clean();
static::$name = null;
}
示例12: setting
/**
* Settings Connection Data
*
* @param array $args
* @return void
*/
public static function setting($args)
{
static::$host = $args['host'];
static::$user = $args['user'];
static::$pass = $args['pass'];
static::$name = $args['name'];
}
示例13: init
/**
* Sets database connection settings as properties.
*/
public static function init($dbName, $dbHost, $dbUser, $dbPass, $tablePrefix = '', $dbDriver = 'mysql')
{
static::$name = $dbName;
static::$host = $dbHost;
static::$user = $dbUser;
static::$pass = $dbPass;
static::$prefix = $tablePrefix;
// Skip driver check if reinitializing with same driver.
if (isset(static::$driver) && $dbDriver == static::$driver) {
return;
}
$drivers = PDO::getAvailableDrivers();
if (!in_array($dbDriver, $drivers, true)) {
throw new OutOfBoundsException("Invalid database driver {$dbDriver}.");
}
static::setDriver($dbDriver);
}
示例14: name
/**
* Get the route name of this Restful controller.
*
* @return string
*/
public static function name()
{
if (!isset(static::$name)) {
$explodedClass = explode('\\', static::className());
static::$name = array_pop($explodedClass);
}
return static::$name;
}
示例15: init
public static function init($name = 'alien-session')
{
static::$name = $name;
$handler_class = Config::get('session.handlers')[Config::get('session.handler')];
static::$handler = new $handler_class();
}