/** * @param ServiceDescriptor $sd * @throws NonExistentClassException */ public function check(ServiceDescriptor $sd) { if ($sd->isAlias()) { return; } $class = $sd->getDefinition()->getClass(); if ($this->isParameter($class)) { $class = $sd->getContainer()->getParameter(trim($class, '%')); } $factoryClass = $sd->getDefinition()->getFactoryClass(); if ($this->isParameter($factoryClass)) { $factoryClass = $sd->getContainer()->getParameter(trim($factoryClass, '%')); } if (is_null($class) && is_null($factoryClass)) { return; } if (interface_exists($class) && is_null($factoryClass)) { return; } if (interface_exists($class) && class_exists($factoryClass)) { return; } if (!class_exists($class)) { throw new NonExistentClassException(sprintf('the class %s for the service %s does not exists', $class, $sd->getServiceName())); } }
public function setServiceDescriptor(ServiceDescriptor $sd) { $this->serviceName = $sd->getServiceName(); $this->class = $sd->getDefinition()->getClass(); $this->factoryService = $sd->getDefinition()->getFactoryService(); $this->factoryClass = $sd->getDefinition()->getFactoryClass(); $this->factoryMethod = $sd->getDefinition()->getFactoryMethod(); $this->message = sprintf("--------\nProblem found in <info>%s</info>", $this->serviceName); }
/** * @param ServiceDescriptor $sd * @throws NonExistentServiceException */ public function check(ServiceDescriptor $sd) { if (!$sd->exists()) { /*var_dump($serviceDescriptor->getServiceName()); var_dump($serviceDescriptor->getContainerBuilder()->get($serviceDescriptor->getServiceName())); die;*/ throw new NonExistentServiceException(sprintf('the service %s do not exists', $sd->getServiceName())); } }