本文整理汇总了PHP中static::handler方法的典型用法代码示例。如果您正苦于以下问题:PHP static::handler方法的具体用法?PHP static::handler怎么用?PHP static::handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::handler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bootstrap
/**
* Bootstrap the session.
*
* @param Config $config The session config
*/
public static function bootstrap(Config $config)
{
if (!$config->cookie_name) {
$config->cookie_name = 'session_id';
}
if (!$config->id_format) {
$config->id_format = Handler::DEFAULT_ID_FORMAT;
}
// Create and set the session save handler
static::$handler = new Handler($config);
session_set_save_handler(static::$handler, true);
// Set the session name
session_name($config->cookie_name);
// Set the cookie parameters
$app = Application::instance();
$path = $app->config->base_uri ?: '/';
$domain = $app->config->domain ?: $_SERVER['HTTP_HOST'];
$secure = $app->request->isSecure();
$lifetime = $config->lifetime ?: 2592000;
session_set_cookie_params($lifetime, $path, $domain, $secure, true);
// Start the session
session_start();
// Register session_write_close() as a shutdown function
session_register_shutdown();
}
示例2: getHandler
/**
* share gateway
*/
public static function getHandler()
{
if (is_null(static::$handler)) {
static::$handler = new RequestHandler(new TokenResolver());
}
return static::$handler;
}
示例3: getIns
/**
* Get the handhandle instance.
*
* @return self
*/
public static function getIns()
{
if (!isset(static::$handler)) {
static::$handler = new self();
}
return static::$handler;
}
示例4: resolveFacadeInstance
/**
* Resolves the facade instance
* @return object FormHandler
*/
public static function resolveFacadeInstance()
{
if (is_object(static::$handler)) {
return static::$handler;
}
$decorator = static::getDecorator();
return static::$handler = new FormHandler($decorator);
}
示例5: __constructStatic
/**
* __constructStatic
*
* @return void
*/
public static function __constructStatic()
{
static::$handler = new static();
}
示例6: getHandler
/**
* Return \PDO database handler
*
* @return \PDO
*/
protected static function getHandler()
{
if (!isset(static::$handler)) {
static::$handler = static::connectToDb();
}
return static::$handler;
}
示例7: setHandler
/**
* 테마 핸들러를 지정한다.
*
* @param ThemeHandler $handler 테마 핸들러
*
* @return void
*/
public static function setHandler(ThemeHandler $handler)
{
static::$handler = $handler;
}
示例8: using
/**
* Load a Template Handler
* @param class $handler The template handler class instance
*/
public static function using(View\Adapter $handler)
{
static::$handler = $handler;
}
示例9: setHandler
static function setHandler(Handler\IOutputHandler $handler)
{
static::$handler = $handler;
}
示例10: upload
/**
* Upload a file
*
* @param string $localFile Path to the file
* @param string $remoteFileName Name of this file on remote server
* @param string $error Error detail
*
* @throws Exception\ServerTypeMustSet
* @throws Exception\ServerTypeNotSupported
* @throws Exception\ServerHandlerInterfaceInvalid
* @throws Exception\TargetFileUnreadable
*
* @return mixed Return path on the remote server when success, false otherwise
*/
public static function upload($localFile, $remoteFileName = '', &$error = '')
{
$handler = null;
if (!is_readable($localFile)) {
throw new Exception\TargetFileUnreadable($localFile);
}
// Create handler instance
if (!static::$handler) {
foreach (static::$servers as $serverNo => $server) {
if (!isset($server['Type'][0])) {
throw new Exception\ServerTypeMustSet($serverNo);
}
$operatorName = static::getOperator($server['Type']);
if (!class_exists($operatorName)) {
throw new Exception\ServerTypeNotSupported($serverNo);
}
$handler = new $operatorName(isset($server['Option']) ? $server['Option'] : array());
if (!$handler instanceof OperatorImplement) {
throw new Exception\ServerHandlerInterfaceInvalid($serverNo);
}
if ($result = static::runHandler($handler, $localFile, $remoteFileName, $error)) {
static::$handler = $handler;
return $result;
} else {
unset($handler);
}
}
} else {
return static::runHandler(static::$handler, $localFile, $remoteFileName, $error);
}
return false;
}
示例11: addCommand
/**
* Add an argument(sub command) setting.
*
* @param string|AbstractCommand $command The argument name or Console object.
* If we just send a string, the object will auto create.
* @param string $description Console description.
* @param Option[] $options Console options.
* @param \Closure $handler The closure to execute.
*
* @return AbstractCommand Return this object to support chaining.
*
* @since 2.0
*/
public function addCommand($command, $description = null, $options = array(), \Closure $handler = null)
{
if (!$command instanceof AbstractCommand) {
$command = new static($command, $this->io, $this);
}
// Set argument detail
$command->setApplication($this->app)->setIO($this->io);
if ($description !== null) {
$command->description($description);
}
if (count($options)) {
$command->setOptions($options);
}
if ($handler) {
$command->handler($handler);
}
// Set parent
$command->setParent($this);
// Set global options to sub command
/** @var $option Option */
foreach ($this->globalOptions as $option) {
$command->addGlobalOption($option);
}
$name = $command->getName();
$this->children[$name] = $command;
return $command;
}
示例12: getHandler
/**
* Return instance of the entity manager
*
* @return \Doctrine\ORM\EntityManager
*/
protected static function getHandler()
{
if (!isset(static::$handler)) {
static::$handler = \Doctrine\ORM\EntityManager::create(static::getDSN(), static::getConfig());
\XLite\Core\Database::registerCustomTypes(static::$handler);
}
return static::$handler;
}
示例13: 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();
}
示例14: getHandler
/**
* @param bool $display
* @param Logger|null $logger
* @return Debug
*/
public static function getHandler($display = true, Logger $logger = null)
{
if (null === static::$handler) {
static::$handler = new static($display, $logger);
}
return static::$handler;
}
示例15: using
/**
* Load a Template Handler
* @param class $handler The template handler class instance
*/
public static function using(&$handler)
{
static::$handler = $handler;
}