original_string: public function has(string $key) : bool
      {
          if (isset($this->items[$key])) {
              return true;
          }
  
          try {
              $class = new \ReflectionClass($key);
          } catch (\ReflectionException $e) {
              return false;
          }
  
          $classes = $this->reflectionTools->getClassHierarchy($class);
  
          foreach ($classes as $class) {
              if ($this->injectionPolicy->isClassInjected($class)) {
                  $this->bind($key); // @todo allow to configure scope (singleton) with annotations
  
                  return true;
              }
          }
  
          return false;
      }
code: public function has(string $key) : bool
      {
          if (isset($this->items[$key])) {
              return true;
          }
  
          try {
              $class = new \ReflectionClass($key);
          } catch (\ReflectionException $e) {
              return false;
          }
  
          $classes = $this->reflectionTools->getClassHierarchy($class);
  
          foreach ($classes as $class) {
              if ($this->injectionPolicy->isClassInjected($class)) {
                  $this->bind($key); // @todo allow to configure scope (singleton) with annotations
  
                  return true;
              }
          }
  
          return false;
      }
code_tokens: public function has ( string $ key ) : bool { if ( isset ( $ this -> items [ $ key ] ) ) { return true ; } try { $ class = new \ ReflectionClass ( $ key ) ; } catch ( \ ReflectionException $ e ) { return false ; } $ classes = $ this -> reflectionTools -> getClassHierarchy ( $ class ) ; foreach ( $ classes as $ class ) { if ( $ this -> injectionPolicy -> isClassInjected ( $ class ) ) { $ this -> bind ( $ key ) ; // @todo allow to configure scope (singleton) with annotations return true ; } } return false ; }
docstring: Returns whether the container has the given key.
  
  @param string $key The key, class or interface name.
  
  @return bool
docstring_tokens: Returns whether the container has the given key .