Example #1
0
 /**
  * @param $scope
  * @return IVariableRegistry
  * @throws InvalidScopeException
  */
 private function getVariableRegistry($scope)
 {
     if (!array_key_exists($scope, $this->variableRegistries)) {
         throw new InvalidScopeException(InvalidScopeException::formatMessage($scope));
     }
     return $this->variableRegistries[$scope];
 }
Example #2
0
 public function testInvalidScopeException()
 {
     try {
         $this->binder->restore(new ClassToBind(), 'public');
         $this->fail('A exception of type [Nucleus\\Binder\\InvalidScopeException] should have be thrown');
     } catch (InvalidScopeException $e) {
         $this->assertEquals(InvalidScopeException::formatMessage(IBinder::DEFAULT_SCOPE), $e->getMessage());
     }
 }