Exemple #1
0
 public function motor()
 {
     $has = Instance::has('fastDbMotor', sha1($this->collection));
     if (true === $has) {
         return Instance::get('fastDbMotor', sha1($this->collection));
     } else {
         $instance = new Client(['host' => 'localhost', 'port' => 6379, 'database' => 2]);
         return Instance::make('fastDbMotor', sha1($this->collection), $instance);
     }
 }
Exemple #2
0
 public static function instance($resource)
 {
     $key = sha1(serialize(func_get_args()));
     $has = Instance::has('Api', $key);
     if (true === $has) {
         return Instance::get('Api', $key);
     } else {
         return Instance::make('Api', $key, with(new self($resource)));
     }
 }
Exemple #3
0
 public static function instance($db = null)
 {
     $key = sha1('Cron' . date('dmY'));
     $has = Instance::has('Cron', $key);
     if (true === $has) {
         return Instance::get('Cron', $key);
     } else {
         return Instance::make('Cron', $key, with(new self($db)));
     }
 }
Exemple #4
0
 public static function instance($entity, $ns = 'core')
 {
     $key = sha1(serialize(func_get_args()));
     $has = Instance::has('Fastdata', $key);
     if (true === $has) {
         return Instance::get('Fastdata', $key);
     } else {
         return Instance::make('Fastdata', $key, with(new self($entity, $ns)));
     }
 }
Exemple #5
0
 public static function instance($tolerance = 0.2, $sort = true)
 {
     $key = sha1(serialize(func_get_args()));
     $has = Instance::has('Phonetic', $key);
     if (true === $has) {
         return Instance::get('Phonetic', $key);
     } else {
         return Instance::make('Phonetic', $key, new self($tolerance, $sort));
     }
 }
Exemple #6
0
 public static function instance($model)
 {
     $key = sha1($model->collection);
     $has = Instance::has('BoxObserver', $key);
     if (true === $has) {
         return Instance::get('BoxObserver', $key);
     } else {
         return Instance::make('BoxObserver', $key, new self($model));
     }
 }
Exemple #7
0
 public static function instance($tpl)
 {
     $key = sha1($tpl);
     $has = Instance::has('libView', $key);
     if (true === $has) {
         return Instance::get('libView', $key);
     } else {
         return Instance::make('libView', $key, new self($tpl));
     }
 }
Exemple #8
0
 public static function instance($route)
 {
     $key = sha1($route->controller . $route->action);
     $has = Instance::has('libMVC', $key);
     if (true === $has) {
         return Instance::get('libMVC', $key);
     } else {
         return Instance::make('libMVC', $key, new self($route));
     }
 }
Exemple #9
0
 public static function instance(Eventable $container = null)
 {
     $key = sha1('Dispatcher');
     $has = Instance::has('Dispatcher', $key);
     if (true === $has) {
         return Instance::get('Dispatcher', $key);
     } else {
         return Instance::make('Dispatcher', $key, with(new self($container)));
     }
 }
Exemple #10
0
 public static function instance($locale = 'fr')
 {
     $key = sha1(serialize(func_get_args()));
     $has = Instance::has('Lang', $key);
     if (true === $has) {
         return Instance::get('Lang', $key);
     } else {
         return Instance::make('Lang', $key, with(new self($app)));
     }
 }
Exemple #11
0
 public static function instance($name, $duration = 3600)
 {
     $args = func_get_args();
     $key = sha1(serialize($args));
     $has = Instance::has('Session', $key);
     if (true === $has) {
         return Instance::get('Session', $key);
     } else {
         return Instance::make('Session', $key, new self($name, $duration));
     }
 }
Exemple #12
0
 public static function instance($context = null)
 {
     $context = is_null($context) ? 'core' : $context;
     $has = Instance::has('ioc', $context);
     if (true === $has) {
         return Instance::get('ioc', $context);
     } else {
         $instance = lib('container');
         return Instance::make('ioc', $context, $instance);
     }
 }
Exemple #13
0
 public static function instance($db, $table)
 {
     $args = func_get_args();
     $key = sha1(serialize($args));
     $has = Instance::has('ArDb', $key);
     if (true === $has) {
         return Instance::get('ArDb', $key);
     } else {
         return Instance::make('ArDb', $key, new self($db, $table));
     }
 }
Exemple #14
0
 public static function instance($db, $table)
 {
     $db = is_null($db) ? 'global' : $db;
     $table = is_null($table) ? 'store' : $table;
     $key = sha1($db . $table);
     $has = Instance::has('GlobalStore', $key);
     if (true === $has) {
         return Instance::get('GlobalStore', $key);
     } else {
         return Instance::make('GlobalStore', $key, new self($db, $table));
     }
 }
Exemple #15
0
 public static function instance($ns, $entity)
 {
     $key = sha1(serialize(func_get_args()));
     $has = Instance::has('Fastdb', $key);
     if (true === $has) {
         return Instance::get('Fastdb', $key);
     } else {
         return Instance::make('Fastdb', $key, new self($ns, $entity));
     }
 }