Exemplo n.º 1
0
 private function _serviceDependencyErrorCheck($className)
 {
     if ($error = $this->_serviceDependencyGraph->runDependencyCheck($className)) {
         switch ($error->code) {
             case 1:
                 $errorMsg = sprintf(self::ERROR_DEPENDENCY_NOT_FOUND, $className, $error->resourceId);
                 throw new ulfberhtException($errorMsg);
                 break;
             case 2:
                 $errorMsg = sprintf(self::ERROR_CIRCULAR_DEPENDENCY, $className, $error->resourceId);
                 throw new ulfberhtException($errorMsg);
                 break;
         }
     } else {
         $resolveOrder = $this->_serviceDependencyGraph->getDependencies($className);
         $this->_serviceDependencyGraph->resetDepenencyCheck();
         return $resolveOrder;
     }
 }
Exemplo n.º 2
0
 private function _serviceDependencyErrorCheck($className)
 {
     if (!$this->exists($className)) {
         $errorMsg = 'The service "' . $className . '" could not be found.';
         throw new Exception($errorMsg);
     } else {
         if ($error = $this->_serviceDependencyGraph->runDependencyCheck($className)) {
             switch ($error->code) {
                 case 1:
                     $errorMsg = 'While trying to resolve service "' . $className . '", ' . 'Ulfberht found that the service dependency "' . $error->resourceId . '" ' . 'could not be found.';
                     throw new Exception($errorMsg);
                     break;
                 case 2:
                     $errorMsg = 'While trying to resolve service "' . $className . '", ' . 'Ulfberht found that there was a cirular dependency caused by the service ' . '"' . $error->resourceId . '".';
                     throw new Exception($errorMsg);
                     break;
             }
         } else {
             $resolveOrder = $this->_serviceDependencyGraph->getDependencies($className);
             $this->_serviceDependencyGraph->resetDepenencyCheck();
             return $resolveOrder;
         }
     }
 }