Example #1
0
 /**
  * @return Model_Search_Stemmer_Decorator
  */
 public static function instance()
 {
     if (!isset(static::$instances)) {
         static::$instances = new static();
     }
     return static::$instances;
 }
 /**
  * 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;
 }
Example #3
0
 /**
  * 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]);
     }
 }
Example #4
0
 /**
  * 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]);
     }
 }
Example #5
0
 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];
 }
Example #6
0
 /**
  * @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];
 }
Example #7
0
 /**
  * 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 = '';
 }
Example #8
0
 /**
  * Resets all metadata instances.
  */
 public static function reset()
 {
     static::$instances = [];
 }
Example #9
0
 public static function reset()
 {
     static::$prophecy = [];
     static::$instances = [];
 }
Example #10
0
 public static function setProxyContainer(ContainerInterface $container = null)
 {
     static::$instances = [];
     static::$container = $container;
 }
Example #11
0
 /**
  * Clears the internal memory cache of model instances.
  * @return void
  */
 public static function clearInternalCache()
 {
     static::$instances = [];
 }
 /**
  * Clears the registry of configuration and instances.
  *
  * @return void
  */
 public static function clear()
 {
     static::$instances = [];
 }
Example #13
0
 /**
  * Clear all of the resolved instances.
  */
 public static function clears()
 {
     static::$instances = array();
 }
Example #14
0
 /**
  * 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 = [];
     }
 }
Example #15
0
 public static function reset($name = null)
 {
     if (is_null($name)) {
         $name = static::DEFAULT_INSTANCE_NAME;
     }
     static::$instances = null;
 }
Example #16
0
 /**
  * Removes all map classes and instances
  */
 public static function removeAll()
 {
     static::$classAliases = static::$classNames = static::$instances = [];
 }