Example #1
1
 /**
  * Get instance 
  *
  * @return static
  */
 public static function getInstance()
 {
     if (!static::$instance instanceof static) {
         static::$instance = new static();
     }
     return static::$instance->getConnection();
 }
Example #2
1
 public static function getInstance($dbSetting = 'default')
 {
     if (is_null(static::$instance)) {
         static::$instance = new static($dbSetting);
     }
     return static::$instance;
 }
Example #3
0
 /**
  * Returns the implementation implementation registered with the Facade.
  *
  * @return Xaamin\Whatsapi\Contracts\WhatsapiInterface
  */
 public static function instance()
 {
     if (!static::$instance) {
         static::$instance = forward_static_call_array(array(get_called_class(), 'create'), func_get_args());
     }
     return static::$instance;
 }
Example #4
0
 /**
  * @return Settings
  */
 static function instance()
 {
     if (!static::$instance) {
         static::$instance = new Settings();
     }
     return static::$instance;
 }
Example #5
0
 /**
  * Init the class.
  *
  * @return \THFWK_ThemosisTheme
  */
 public static function getInstance()
 {
     if (is_null(static::$instance)) {
         static::$instance = new static();
     }
     return static::$instance;
 }
Example #6
0
 /**
  * @param null $args
  * @return self
  */
 public static function instance($args = null)
 {
     if (null === static::$instance) {
         static::$instance = new static($args);
     }
     return static::$instance;
 }
Example #7
0
 static function get_instance()
 {
     if (is_null(static::$instance)) {
         static::$instance = new self();
     }
     return static::$instance;
 }
Example #8
0
 /**
  * Constructor.
  * 
  * @param \wpdb $db
  */
 public function __construct(wpdb $db)
 {
     if (!isset(static::$instance)) {
         static::$instance = $this;
         static::$db = $db;
     }
 }
 /**
  * Get class instance.
  *
  * @since  1.0
  * @return JB_Lib instance
  * @author JACK BUI
  */
 public static function get_instance()
 {
     if (NULL == static::$instance) {
         static::$instance = new static();
     }
     return static::$instance;
 }
Example #10
0
 /**
  * Get a instance.
  *
  * @return \Jobqueue\Context
  */
 public static function instance()
 {
     if (is_null(static::$instance)) {
         static::$instance = new static(\Fuel::$env, \Config::load('jobqueue', 'jobqueue'));
     }
     return static::$instance;
 }
Example #11
0
 /**
  * Returns the singleton instance of this class.
  *
  * @param mixed $args,... Additional arguments.
  * @return self The singleton instance.
  */
 public static function getInstance(...$args)
 {
     if (static::$instance === null) {
         static::$instance = new static(...$args);
     }
     return static::$instance;
 }
Example #12
0
 public function get()
 {
     if (!isset(static::$instance)) {
         static::$instance = new self();
     }
     return static::$instance;
 }
Example #13
0
 public static function log($func, $args)
 {
     if (static::$instance === null) {
         static::$instance = new static();
     }
     $res = static::$log->{$func}(...$args);
 }
Example #14
0
 /**
  * Test the cache can be bootstrapped when using the redis driver.
  *
  * @covers Molovo\Amnesia\Cache::bootstrap
  * @covers Molovo\Amnesia\Cache\Instance::__construct
  * @covers Molovo\Amnesia\Driver\File::__construct
  * @covers Molovo\Amnesia\Cache::instance
  */
 public function testBootstrap()
 {
     $name = 'file_driver_test';
     $config = [$name => ['driver' => 'file', 'store_path' => dirname(dirname(__DIR__)) . '/_data/cache/store']];
     if (!is_dir($config[$name]['store_path'])) {
         // This is a test cache, so just let anyone write to it
         // to avoid having to deal with permissions issues
         mkdir($config[$name]['store_path'], 0777, true);
     }
     Cache::bootstrap($config);
     $instance = Cache::instance($name);
     verify($instance)->isInstanceOf(Instance::class);
     // Test that the driver has been instantiated correctly
     $property = new \ReflectionProperty(Instance::class, 'driver');
     $property->setAccessible(true);
     $driver = $property->getValue($instance);
     verify($driver)->isInstanceOf(File::class);
     // Call a second time to test retrieval from cache
     $cached_instance = Cache::instance($name);
     // Compare hashes of the two instances to ensure they are
     // the same object
     $hash1 = spl_object_hash($instance);
     $hash2 = spl_object_hash($cached_instance);
     verify($hash1)->equals($hash2);
     // Store the instance so we can use it in other tests
     static::$instance = $instance;
 }
Example #15
0
 /**
  * @return $instance
  */
 public static function instance()
 {
     if (static::$instance === null) {
         static::$instance = new static();
     }
     return static::$instance;
 }
Example #16
0
 /**
  * Creates a new Native Bootstraper instance.
  *
  * @param  \Cartalyst\Sentinel\Native\SentinelBootstrapper  $bootstrapper
  * @return void
  */
 public static function instance(SentinelBootstrapper $bootstrapper = null)
 {
     if (static::$instance === null) {
         static::$instance = new static($bootstrapper);
     }
     return static::$instance;
 }
 /**
  * @return null|static
  *
  */
 public static function instance($id)
 {
     if (is_null(static::$instance)) {
         return static::$instance = new static($id);
     }
     return static::$instance;
 }
Example #18
0
 public static function getInstance($url)
 {
     if (empty(static::$instance)) {
         static::$instance = new static($url);
     }
     return static::$instance;
 }
Example #19
0
 /**
  * Returns the *Singleton* instance of this class.
  *
  * @staticvar Singleton $instance The *Singleton* instances of this class.
  *
  * @return Singleton The *Singleton* instance.
  */
 public static function getInstance(BoxRouteConf $routeConf = null)
 {
     if (null === static::$instance) {
         static::$instance = new static($routeConf);
     }
     return static::$instance;
 }
Example #20
0
 public static function getInstance()
 {
     if (!isset(static::$instance)) {
         static::$instance = new static();
     }
     return static::$instance;
 }
 /**
  * Gets a {@link PhoneNumberToTimeZonesMapper} instance.
  *
  * <p> The {@link PhoneNumberToTimeZonesMapper} is implemented as a singleton. Therefore, calling
  * this method multiple times will only result in one instance being created.
  *
  * @param $mappingDir
  * @return PhoneNumberToTimeZonesMapper instance
  */
 public static function getInstance($mappingDir = self::MAPPING_DATA_DIRECTORY)
 {
     if (static::$instance === null) {
         static::$instance = new static($mappingDir);
     }
     return static::$instance;
 }
 /**
  * Generates an instance of the class.
  * 
  * @since 2.0
  * 
  * @return UPT_Post_Type|UPT_Taxonomy
  */
 public static function instance()
 {
     if (null == static::$instance) {
         static::$instance = new static();
     }
     return static::$instance;
 }
Example #23
0
 public static function factory(LoggerInterface $logger, $debug = false)
 {
     if (!static::$instance) {
         static::$instance = new static($logger, $debug);
     }
     return static::$instance;
 }
Example #24
0
 public static function getInstance()
 {
     if (NULL === static::$instance) {
         static::$instance = new Crypto();
     }
     return static::$instance;
 }
 /**
  * @param array $initialStates optional
  */
 public function __construct($initialStates = [])
 {
     if (static::$instance === null) {
         static::$instance = $this;
     }
     $this->states = $initialStates;
 }
Example #26
0
 /**
  * Creates a singleton instance of the Honeypot_Bee class.
  *
  * @return Honeypot_Bee
  */
 public static function instance()
 {
     if (static::$instance === null) {
         static::$instance = new Honeypot_Bee();
     }
     return static::$instance;
 }
 /**
  * Make this class a singleton
  *
  * Use this instead of __construct()
  *
  * @param Amazon_S3_And_CloudFront $as3cf
  * @param string                   $plugin_file_path
  *
  * @return AS3CF_Notices
  */
 public static function get_instance($as3cf, $plugin_file_path)
 {
     if (!isset(static::$instance)) {
         static::$instance = new static($as3cf, $plugin_file_path);
     }
     return static::$instance;
 }
Example #28
0
 public static function i()
 {
     if (is_null(static::$instance)) {
         static::$instance = new self();
     }
     return static::$instance;
 }
Example #29
0
 public function __construct($route, $app)
 {
     $this->app = $app;
     $this->route = $route;
     static::$instance = $this;
     //init use trait
     foreach (class_uses($this) as $_trait) {
         $_method = str_replace('\\', '_', $_trait);
         if (method_exists($this, $_method)) {
             $this->{$_method}();
         }
     }
     //load from app
     if (is_null($this->response)) {
         $this->response = $this->app->response;
     }
     if (is_null($this->request)) {
         $this->request = $this->app->request;
     }
     //run
     $r = $this->exec($this->route[1], true, true);
     //back to app
     $this->app->response = $this->response;
     return $r;
 }
Example #30
0
 private static function getInstance()
 {
     if (empty(static::$instance)) {
         static::$instance = new Db();
     }
     return static::$instance;
 }