示例#1
0
 function getService($serviceName, $parameters = null)
 {
     $service = null;
     if (isset($this->services[$serviceName])) {
         $service = $this->services[$serviceName];
     } else {
         $services = System::$application->getServiceTable();
         $serviceClass = Utilities::getInstance()->getValue($services, $serviceName);
         if (isset($serviceClass)) {
             $service = new $serviceClass($parameters);
             $this->services[$serviceName] = $service;
         } else {
             throw new MissingServiceException("The service {$serviceName} does not exist");
         }
     }
     return $service;
 }
示例#2
0
 private function lookupString($key)
 {
     $val = null;
     $languageSource = $this->util->getValue($this->languages, $this->currentLanguage);
     if (!isset($languageSource)) {
         $languageSourceClasses = System::$application->configuration->languages;
         $languageSourceClass = Utilities::getInstance()->getValue($languageSourceClasses, $this->currentLanguage);
         if (isset($languageSourceClass)) {
             $languageSource = new $languageSourceClass();
             $languageSource = $languageSource->getMap();
             array_push($this->languages, $languageSource);
         }
         $val = $this->util->getValue($languageSource, $key);
     } else {
         $val = $this->util->getValue($languageSource, $key);
     }
     return $val;
 }
示例#3
0
 /**
  * Parameter to extract a value from a specified array and key and provides
  * cleansing ability and the ability to grab missing keys and set those to null.
  *
  * @param array $parameters the array to look up the key in
  * @param string $key the key to lookup in the specified array
  * @return mixed the value stored at the specified key in the specified array.  If the key is not found then null is returned.
  */
 public function getParameterValue($parameters, $key)
 {
     return Utilities::getInstance()->getValue($parameters, $key);
 }
示例#4
0
 function __construct()
 {
     $this->util = Utilities::getInstance();
 }
示例#5
0
 protected function executeApiController($controllerKey)
 {
     $output = null;
     $this->controllerClass = Utilities::getInstance()->getValue($this->routingTable, $controllerKey);
     if (!isset($this->controllerClass)) {
         throw new ClassNotFoundException("API Controller Route not found.");
     } else {
         if (class_exists($this->controllerClass)) {
             $this->controller = new $this->controllerClass($this);
             $m = $this->controllerMethod;
             if (method_exists($this->controller, $m) == true) {
                 $output = $this->controller->{$m}();
             } else {
                 throw new MethodNotFoundException("Class '" . $this->controllerClass . "' does not contain method '{$m}.'");
             }
         } else {
             throw new ClassNotFoundException("Class '" . $this->controllerClass . "' could not be found.");
         }
     }
     return $output;
 }