本文整理汇总了PHP中static::instances方法的典型用法代码示例。如果您正苦于以下问题:PHP static::instances方法的具体用法?PHP static::instances怎么用?PHP static::instances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::instances方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: instance
/**
* @return Model_Search_Stemmer_Decorator
*/
public static function instance()
{
if (!isset(static::$instances)) {
static::$instances = new static();
}
return static::$instances;
}
示例2: create
/**
* Create new instance of Xinix\Theme\Components\Pagination via static method
*
* @param Norm\Cursor $entries Entries that we want to page
*
* @return Xinix\Theme\Components\Pagination New instance of Pagination class
*/
public static function create(Cursor $entries)
{
$Class = get_called_class();
if (is_null(static::$instances[$Class])) {
static::$instances = new $Class($entries);
}
return static::$instances;
}
示例3: resetInstance
/**
* As this is a singleton instance, we wanna be able to re-instatiate (e.g. during
* tests as the same instance will be used for unit and integrated tests)
* @return void
*/
public function resetInstance($name = null)
{
if (is_null($name)) {
static::$instances = array();
} else {
unset(static::$instances[$name]);
}
}
示例4: delete
/**
* Delete an instance from the facade.
*
* @param mixed $name instance name or true for all
*/
public static function delete($name)
{
if ($name === true) {
static::$instances = array();
} elseif (isset(static::$instances[$name])) {
unset(static::$instances[$name]);
}
}
示例5: __callStatic
public static function __callStatic($name, $arguments)
{
static $bindings = ['A' => 'Auth', 'C' => 'Config', 'D' => 'Db', 'L' => 'Log', 'R' => 'Redirect', 'S' => 'Session', 'T' => 'Template', 'U' => 'Url'];
if (!is_array(static::$instances)) {
static::$instances = [];
}
if (!isset(static::$instances[$name])) {
static::$instances[$name] = new $bindings[$name]();
}
return static::$instances[$name];
}
示例6: __callStatic
/**
* @param $name
* @param $arguments
* @return static
* @throws Exception
*/
public static function __callStatic($name, $arguments)
{
if (!defined("static::" . $name)) {
throw new Exception("Unknown enum '" . $name . "'");
}
if (!is_array(static::$instances)) {
static::$instances = [];
}
if (!isset(static::$instances[$name])) {
static::$instances[$name] = new static($name, constant("static::" . $name));
}
return static::$instances[$name];
}
示例7: reset
/**
* Method to reset class static members for testing and other various issues.
*
* @return void
*
* @since 11.1
*/
public static function reset()
{
static::$instances = array();
static::$base = array();
static::$root = array();
static::$current = '';
}
示例8: reset
/**
* Resets all metadata instances.
*/
public static function reset()
{
static::$instances = [];
}
示例9: reset
public static function reset()
{
static::$prophecy = [];
static::$instances = [];
}
示例10: setProxyContainer
public static function setProxyContainer(ContainerInterface $container = null)
{
static::$instances = [];
static::$container = $container;
}
示例11: clearInternalCache
/**
* Clears the internal memory cache of model instances.
* @return void
*/
public static function clearInternalCache()
{
static::$instances = [];
}
示例12: clear
/**
* Clears the registry of configuration and instances.
*
* @return void
*/
public static function clear()
{
static::$instances = [];
}
示例13: clears
/**
* Clear all of the resolved instances.
*/
public static function clears()
{
static::$instances = array();
}
示例14: flushInstances
/**
* Remove saved instances
*
* @param array $ids Array of instance ids to unset. If omitted all saved instances are removed
* @return void
*/
static function flushInstances(array $ids = [])
{
if (!empty($ids)) {
foreach ($ids as $id) {
if (is_string($id) && isset(static::$instances[$id])) {
unset(static::$instances[$id]);
}
}
} else {
static::$instances = [];
}
}
示例15: reset
public static function reset($name = null)
{
if (is_null($name)) {
$name = static::DEFAULT_INSTANCE_NAME;
}
static::$instances = null;
}