create() public static method

public static create ( string $key ) : ParameterNotFoundException
$key string
return ParameterNotFoundException
 public function testTestCreateNewExceptionWithFactory()
 {
     $exception = ParameterNotFoundExceptionFactory::create('foo');
     $this->assertEquals('Could not find the parameter "foo".', $exception->getMessage());
     $this->assertEquals(0, $exception->getCode());
     $this->assertNull($exception->getPrevious());
 }
Esempio n. 2
0
 /**
  * @param string $key
  *
  * @throws ParameterNotFoundException
  *
  * @return mixed
  */
 public function get(string $key)
 {
     if ($this->has($key)) {
         return deep_clone($this->parameters[$key]);
     }
     throw ParameterNotFoundExceptionFactory::create($key);
 }