Ejemplo n.º 1
0
 private function midWare($midwares)
 {
     foreach ($midwares as $name) {
         if ($midware = Dependency::MidWare($name)) {
             return $midware->run();
         } else {
             Log::Error("Calling undefined midware: " . $name);
             return;
         }
     }
 }
Ejemplo n.º 2
0
 public static function enforceMake($name, $cache = false)
 {
     $name = strtolower($name);
     if (!($service = Dependency::getService($name))) {
         Log::Error("The service \"{$name}\" dose not exist!");
         throw new \Exception("The service \"{$name}\" dose not exist!", 1);
     }
     if (!class_exists($service)) {
         Log::Error("Class \" {$service}\" dose not exist!");
         throw new \Exception("Class \" {$service}\" dose not exist!", 1);
     }
     $reflectClass = new \ReflectionClass($name);
     $instance = $reflectClass->newInstanceWithoutConstructor();
     if ($cache) {
         self::$wareHouse[$name] = $instance;
     }
     return $instance;
 }