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


PHP core\Object类代码示例

本文整理汇总了PHP中lithium\core\Object的典型用法代码示例。如果您正苦于以下问题:PHP Object类的具体用法?PHP Object怎么用?PHP Object使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: _init

 /**
  * Perform initialization.
  *
  * @return void
  */
 protected function _init()
 {
     Object::_init();
     $type = isset($this->_config['type']) ? $this->_config['type'] : null;
     if ($type === 'text') {
         $h = function ($data) {
             return $data;
         };
     } else {
         $encoding = 'UTF-8';
         if ($this->_message) {
             $encoding =& $this->_message->charset;
         }
         $h = function ($data) use(&$encoding) {
             return htmlspecialchars((string) $data, ENT_QUOTES, $encoding);
         };
     }
     $this->outputFilters += compact('h') + $this->_config['outputFilters'];
     foreach (array('loader', 'renderer') as $key) {
         if (is_object($this->_config[$key])) {
             $this->{'_' . $key} = $this->_config[$key];
             continue;
         }
         $class = $this->_config[$key];
         $config = array('view' => $this) + $this->_config;
         $path = 'adapter.template.mail';
         $instance = Libraries::instance($path, $class, $config);
         $this->{'_' . $key} = $instance;
     }
 }
开发者ID:atelierdisko,项目名称:li3_mailer,代码行数:35,代码来源:Mail.php

示例2: _init

 /**
  * Initializer function called by the constructor unless the constructor
  *
  * @see lithium\core\Object::_init()
  * @throws ConfigException
  */
 protected function _init()
 {
     parent::_init();
     if (!$this->_connection) {
         throw new ConfigException("The `'connection'` option must be set.");
     }
 }
开发者ID:unionofrad,项目名称:li3_fixtures,代码行数:13,代码来源:Connection.php

示例3: __construct

	/**
	 * Object constructor
	 *
	 * Instantiates the `Redis` object and connects it to the configured server.
	 *
	 * @todo Implement configurable & optional authentication
	 * @see lithium\storage\Cache::config()
	 * @see lithium\storage\cache\adapter\Redis::_ttl()
	 * @param array $config Configuration parameters for this cache adapter.
	 *        These settings are indexed by name and queryable through `Cache::config('name')`. The
	 *        available settings for this adapter are as follows:
	 *        - `'host'` _string_: A string in the form of `'host:port'` indicating the Redis server
	 *          to connect to. Defaults to `'127.0.0.1:6379'`.
	 *        - `'expiry'` _mixed_: Default expiration for cache values written through this
	 *          adapter. Defaults to `'+1 hour'`. For acceptable values, see the `$expiry` parameter
	 *          of `Redis::_ttl()`.
	 *        - `'persistent'` _boolean_: Indicates whether the adapter should use a persistent
	 *          connection when attempting to connect to the Redis server. If `true`, it will
	 *          attempt to reuse an existing connection when connecting, and the connection will
	 *          not close when the request is terminated. Defaults to `false`.
	 */
	public function __construct(array $config = array()) {
		$defaults = array(
			'host' => '127.0.0.1:6379',
			'expiry' => '+1 hour',
			'persistent' => false
		);
		parent::__construct($config + $defaults);
	}
开发者ID:niel,项目名称:lithium,代码行数:29,代码来源:Redis.php

示例4: _init

 protected function _init()
 {
     parent::_init();
     unset($this->_config['type']);
     foreach ($this->_config as $key => $val) {
         if (method_exists($this, $key) && $val !== null) {
             $this->_config[$key] = is_array($this->_config[$key]) ? array() : null;
             $this->{$key}($val);
         }
     }
     if ($list = $this->_config['whitelist']) {
         $this->_config['whitelist'] = array_combine($list, $list);
     }
     if ($this->_config['with']) {
         $this->_associate($this->_config['with']);
     }
     $joins = $this->_config['joins'];
     $this->_config['joins'] = array();
     foreach ($joins as $i => $join) {
         $this->join($i, $join);
     }
     if ($this->_entity && !$this->_config['model']) {
         $this->model($this->_entity->model());
     }
     unset($this->_config['entity'], $this->_config['init'], $this->_config['with']);
 }
开发者ID:rmarscher,项目名称:lithium,代码行数:26,代码来源:Query.php

示例5: _init

	/**
	 * Initializes default rules to use.
	 *
	 * @return void
	 */
	protected function _init() {
		parent::_init();

		$this->_rules += array(
			'allowAll' => function() {
				return true;
			},
			'denyAll' => function() {
				return false;
			},
			'allowAnyUser' => function($user) {
				return $user ? true : false;
			},
			'allowIp' => function($user, $request, $options) {
				$options += array('ip' => false);

				if (is_string($options['ip']) && strpos($options['ip'], '/') === 0) {
					return (boolean) preg_match($options['ip'], $request->env('REMOTE_ADDR'));
				}
				if (is_array($options['ip'])) {
					return in_array($request->env('REMOTE_ADDR'), $options['ip']);
				}
				return $request->env('REMOTE_ADDR') == $options['ip'];
			}
		);
	}
开发者ID:nateabele,项目名称:li3_access,代码行数:31,代码来源:Rules.php

示例6: __construct

 /**
  * Constructor.
  *
  * @param array $config Configuration array. You can override the default algorithm.
  */
 public function __construct(array $config = [])
 {
     if (!isset($config['secret'])) {
         throw new ConfigException('Jwt strategy requires a secret key.');
     }
     parent::__construct($config + $this->_defaults);
 }
开发者ID:jasonroyle,项目名称:li3_jwt,代码行数:12,代码来源:Jwt.php

示例7: __construct

 /**
  * Constructor.
  *
  * @param array $config Optional configuration parameters.
  * @return void
  */
 public function __construct(array $config = [])
 {
     if (!isset($config['header'])) {
         throw new ConfigException('Token adapter requires a header.');
     }
     parent::__construct($config + $this->_defaults);
 }
开发者ID:jasonroyle,项目名称:li3_jwt,代码行数:13,代码来源:Token.php

示例8: _init

 protected function _init()
 {
     parent::_init();
     $this->_methods += array('GET' => array('view' => 'id', 'index' => null), 'POST' => array('edit' => 'id', 'add' => null), 'PUT' => array('edit' => 'id'), 'PATCH' => array('edit' => 'id'), 'DELETE' => array('delete' => 'id'));
     $this->_classes += array('entity' => 'lithium\\data\\Entity', 'response' => 'lithium\\action\\Response', 'resources' => 'li3_resources\\net\\http\\Resources', 'responder' => 'li3_resources\\action\\resource\\Responder');
     $this->_responder = $this->_responder ?: $this->_instance('responder');
 }
开发者ID:nateabele,项目名称:li3_resources,代码行数:7,代码来源:Resource.php

示例9: __construct

 /**
  * Class constructor.
  *
  * Takes care of setting appropriate configurations for this object.
  *
  * @param array $config Optional configuration parameters.
  */
 public function __construct(array $config = array())
 {
     if (empty($config['name'])) {
         $config['name'] = basename(LITHIUM_APP_PATH) . 'cookie';
     }
     parent::__construct($config + $this->_defaults);
 }
开发者ID:newmight2015,项目名称:Blockchain-2,代码行数:14,代码来源:Cookie.php

示例10: __construct

 /**
  * Constructor.
  *
  * Takes care of setting appropriate configurations for this object.
  *
  * @param array $config Optional configuration parameters.
  * @return void
  */
 public function __construct(array $config = array())
 {
     if (empty($config['name'])) {
         $config['name'] = basename(Libraries::get(true, 'path')) . 'cookie';
     }
     parent::__construct($config + $this->_defaults);
 }
开发者ID:unionofrad,项目名称:lithium,代码行数:15,代码来源:Cookie.php

示例11: _init

 protected function _init()
 {
     parent::_init();
     if ($this->_config['autoConnect']) {
         $this->connect();
     }
 }
开发者ID:EHER,项目名称:chegamos,代码行数:7,代码来源:Source.php

示例12: __construct

 /**
  * Constructor.
  *
  * @see lithium\util\String::insert()
  * @param array $config Settings used to configure the adapter. Available options:
  *        - `'path'` _string_: The directory to write log files to. Defaults to
  *          `<app>/resources/tmp/logs`.
  *        - `'timestamp'` _string_: The `date()`-compatible timestamp format. Defaults to
  *          `'Y-m-d H:i:s'`.
  *        - `'file'` _\Closure_: A closure which accepts two parameters: an array
  *          containing the current log message details, and an array containing the `File`
  *          adapter's current configuration. It must then return a file name to write the
  *          log message to. The default will produce a log file name corresponding to the
  *          priority of the log message, i.e. `"debug.log"` or `"alert.log"`.
  *        - `'format'` _string_: A `String::insert()`-compatible string that specifies how
  *          the log message should be formatted. The default format is
  *          `"{:timestamp} {:message}\n"`.
  * @return void
  */
 public function __construct(array $config = array())
 {
     $defaults = array('path' => Libraries::get(true, 'resources') . '/tmp/logs', 'timestamp' => 'Y-m-d H:i:s', 'file' => function ($data, $config) {
         return "{$data['priority']}.log";
     }, 'format' => "{:timestamp} {:message}\n");
     parent::__construct($config + $defaults);
 }
开发者ID:fedeisas,项目名称:lithium,代码行数:26,代码来源:File.php

示例13: __construct

	/**
	 * Class constructor.
	 *
	 * @param array $config
	 */
	public function __construct(array $config = array()) {
		$defaults = array(
			'prefix' => '',
			'expiry' => '+1 hour'
		);
		parent::__construct($config + $defaults);
	}
开发者ID:niel,项目名称:lithium,代码行数:12,代码来源:Apc.php

示例14: _init

 /**
  * Initialization of the cookie adapter.
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     if (!$this->_config['name']) {
         $this->_config['name'] = Inflector::slug(basename(LITHIUM_APP_PATH)) . 'cookie';
     }
 }
开发者ID:EHER,项目名称:monopolis,代码行数:12,代码来源:Cookie.php

示例15: __construct

	/**
	 * Class constructor.
	 *
	 * @param array $config
	 */
	public function __construct(array $config = array()) {
		$defaults = array(
			'config' => null,
			'expiry' => '+999 days',
			'key' => 'log_{:type}_{:timestamp}'
		);
		parent::__construct($config + $defaults);
	}
开发者ID:niel,项目名称:lithium,代码行数:13,代码来源:Cache.php


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