Nelmio\Alice\Throwable\Exception\ObjectNotFoundExceptionFactory::create PHP Method

create() public static method

public static create ( string $id, string $className ) : ObjectNotFoundException
$id string
$className string
return ObjectNotFoundException
    public static function create(string $id, string $className) : ObjectNotFoundException
    {
        return new ObjectNotFoundException(sprintf('Could not find the object "%s" of the class "%s".', $id, $className));
    }

Usage Example

Example #1
0
 /**
  * @param FixtureIdInterface $fixture
  *
  * @throws ObjectNotFoundException
  * 
  * @return ObjectInterface
  */
 public function get(FixtureIdInterface $fixture) : ObjectInterface
 {
     if ($this->has($fixture)) {
         return $this->objects[$fixture->getId()];
     }
     throw ObjectNotFoundExceptionFactory::create($fixture->getId(), $fixture instanceof FixtureInterface ? $fixture->getClassName() : 'no class given');
 }
ObjectNotFoundExceptionFactory