本文整理汇总了PHP中static::options方法的典型用法代码示例。如果您正苦于以下问题:PHP static::options方法的具体用法?PHP static::options怎么用?PHP static::options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::options方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: input
public static function input($arguments)
{
if (!defined("STDIN")) {
define("STDIN", fopen('php://stdin', 'r'));
}
$_argv = array();
$_argv['command'] = null;
$_argv['args'] = array();
$_argv['options'] = array();
$i = 0;
foreach ($arguments as $k => $v) {
$v = strtolower($v);
if (substr($v, 0, 2) == '--') {
$_argv['options'][] = $v;
} else {
if ($i == 1) {
$_argv['command'] = $v;
}
if ($i > 1) {
$_argv['args'][] = $v;
}
}
$i++;
}
$command = $_argv['command'];
$method = 'help';
if (strpos($command, ':') !== false) {
list($command, $method) = explode(':', $command);
}
static::$command = $command;
static::$method = $method;
static::$arguments = $_argv['args'];
static::$options = $_argv['options'];
return $_argv;
}
示例2: init
public static function init($options)
{
static::$options = $options;
if (empty($options['transports'])) {
$options['transports'] = array('default' => array('driver' => 'smtp', 'host' => 'localhost', 'port' => 25));
}
$first = '';
foreach ($options['transports'] as $key => $value) {
$value['name'] = $key;
if (!isset($value['driver'])) {
throw new \Exception('[Norm] Cannot instantiate transport "' . $key . '", Driver "' . @$value['driver'] . '" not found!');
} elseif (isset(static::$aliases[$value['driver']])) {
$value['driver'] = static::$aliases[$value['driver']];
}
$Driver = $value['driver'];
static::$transports[$key] = new $Driver($value);
if (!static::$transports[$key] instanceof Transport) {
throw new \Exception('BonoMail transport [' . $key . '] should be instance of Transport');
}
if (!$first) {
$first = $key;
}
}
if (!static::$defaultTransport) {
static::$defaultTransport = $first;
}
}
示例3: __construct
public function __construct($options = [], Application $app = null, RepositoryContract $config = null, Dispatcher $dispatcher = null)
{
static::$options = $config !== null ? array_merge($options, $config->get('tracy')) : $options;
TracyDebugger::$time = array_get($_SERVER, 'REQUEST_TIME_FLOAT', microtime(true));
TracyDebugger::$maxDepth = array_get(static::$options, 'maxDepth');
TracyDebugger::$maxLen = array_get(static::$options, 'maxLen');
TracyDebugger::$showLocation = array_get(static::$options, 'showLocation');
TracyDebugger::$strictMode = array_get(static::$options, 'strictMode');
TracyDebugger::$editor = array_get(static::$options, 'editor');
$bar = TracyDebugger::getBar();
foreach (array_get(static::$options, 'panels') as $key => $enabled) {
if ($enabled === true) {
$class = '\\' . __NAMESPACE__ . '\\Panels\\' . ucfirst($key) . 'Panel';
if (class_exists($class) === false) {
$class = $key;
}
$this->panels[$key] = new $class($app, static::$options);
$bar->addPanel($this->panels[$key], $class);
}
}
if ($dispatcher !== null) {
$dispatcher->listen('kernel.handled', function ($request, $response) {
return static::appendDebugbar($request, $response);
});
} else {
TracyDebugger::enable();
}
}
示例4: fetchAll
/**
* Fetch all options
*
* @return mixed
*/
public function fetchAll()
{
if (static::$options === null) {
static::$options = $this->createModel()->orderBy('key', 'asc')->get();
}
return static::$options;
}
示例5: option
/**
* Get an option from the config file
*
* @param string $option The key of the option
*
* @return mixed Its value
*/
public static function option($option)
{
// Get config file
if (!static::$options) {
static::$options = (include __DIR__ . '/../config/config.php');
}
return ArraysMethods::get(static::$options, $option);
}
示例6: configure
/**
* Configure the Logger.
*
* @param null|array $options
*/
public static function configure($options = null)
{
if (empty($options) || !is_array($options)) {
$options = array();
}
$options = array_replace(static::$defaults, static::$options, $options);
static::$options = $options;
}
示例7: opts
protected static function opts($key = null)
{
if (is_null(static::$options)) {
static::$options = App::getInstance()['bind9'] ?: [];
}
if (0 === func_num_args()) {
return static::$options;
} else {
return isset(static::$options[$key]) ? static::$options[$key] : null;
}
}
示例8: config
/**
*
* @param array $options
*/
public static function config(array $options = array())
{
if (!static::$options) {
$defaults = array('session.name' => basename(RADIUM_APP_PATH), 'session.cookie_lifetime' => 1209600, 'session.gc_maxlifetime' => 1209600);
$options += $defaults;
static::$options = $options;
} else {
static::$options = $options + static::$options;
}
return static::$options;
}
示例9: using
public static function using($driver, $options = null)
{
$class = 'Email\\' . ucfirst(strtolower($driver));
if (!class_exists($class)) {
throw new Exception("[core.email] : {$driver} driver not found.");
}
static::$driver_name = $driver;
static::$options = $options;
static::$driver = new $class();
static::$driver->onInit($options);
}
示例10: initialize
/**
* Initializes the cache.
*
* With the $options array it's possible to define:
* - expiration of the key, (time in seconds)
* - a namespace for the key
*
* this last one is useful in the case two applications use
* a shared key/store (for instance a shared Memcached db)
*
* Ex:
* $cfg_ar = ActiveRecord\Config::instance();
* $cfg_ar->set_cache('memcache://localhost:11211',array('namespace' => 'my_cool_app',
* 'expire' => 120
* ));
*
* In the example above all the keys expire after 120 seconds, and the
* all get a postfix 'my_cool_app'.
*
* (Note: expiring needs to be implemented in your cache store.)
*
* @param string $url URL to your cache server
* @param array $options Specify additional options
*/
public static function initialize($url, $options = array())
{
if ($url) {
$url = parse_url($url);
$file = ucwords(Inflector::instance()->camelize($url['scheme']));
$class = "ActiveRecord\\{$file}";
require_once __DIR__ . "/cache/{$file}.php";
static::$adapter = new $class($url);
} else {
static::$adapter = null;
}
static::$options = array_merge(array('expire' => 30, 'namespace' => ''), $options);
}
示例11: toOptionArray
/**
* Return array of options as value-label pairs
*
* @param bool $addEmptyEntry
*
* @return array Format: array(array('value' => '<value>', 'label' => '<label>'), ...)
*/
public function toOptionArray($addEmptyEntry = true)
{
if (null === static::$options) {
static::$options = [];
if ($addEmptyEntry) {
static::$options[] = ['label' => __('No Cms Block ...'), 'value' => ''];
}
/** @var \Magento\Cms\Model\Block $block */
foreach ($this->getCmsBlockCollection() as $block) {
static::$options[] = ['label' => $block->getTitle(), 'value' => $block->getIdentifier()];
}
}
return static::$options;
}
示例12: register
public static function register(Di $di)
{
static::$di = $di;
$di->set('Phalcon\\Http\\Cookie', 'Phwoolcon\\Http\\Cookie');
static::$cookies = static::$di->getShared('cookies');
static::$cookies->reset();
static::$options = $options = Config::get('cookies');
static::$cookies->useEncryption($encrypt = $options['encrypt']);
$encrypt and static::$di->getShared('crypt')->setKey($options['encrypt_key'])->setPadding(Crypt::PADDING_ZERO);
/* @var \Phalcon\Http\Response $response */
if ($response = $di->getShared('response')) {
$response->setCookies(static::$cookies);
}
Events::attach('view:generatePhwoolconJsOptions', function (Event $event) {
$options = $event->getData() ?: [];
$options['cookies'] = ['domain' => static::$options['domain'], 'path' => static::$options['path']];
$event->setData($options);
return $options;
});
}
示例13: init
public static function init($options)
{
static::$options = $options;
$first = null;
if (!empty($options['spools'])) {
foreach ($options['spools'] as $key => $spool) {
$spool['name'] = $key;
if (isset(static::$aliases[$spool['driver']])) {
$spool['driver'] = static::$aliases[$spool['driver']];
}
$Driver = $spool['driver'];
static::$spools[$key] = new $Driver($spool);
if (is_null($first)) {
$first = $key;
}
}
if (!static::$defaultSpool) {
static::$defaultSpool = $first;
}
}
}
示例14: driver
public static function driver($options)
{
static::$options = $options;
static::$cache = Cache::getInstance(static::$options);
}
示例15: setOptions
/**
* Set the options value
*
* @param array $options The options value
*
* @static
*/
public static function setOptions(array $options)
{
static::$options = $options;
}