Ejemplo n.º 1
0
 /**
  * @param string      $class
  * @param null|string $alias
  * @param bool        $checkClassExists Use FALSE when you want to use a namespace instead of a class
  *
  * @return $this
  * @throws Exception\ClassUse  When the given class does not exists
  */
 public function addUse($class, $alias = null, $checkClassExists = true)
 {
     if ($checkClassExists === true && $this->classFile->isClassDefined("\\{$class}") === false && $this->classFile->isInterfaceDefined("\\{$class}") === false && $this->classFile->isTraitDefined("\\{$class}") === false) {
         throw Exception\ClassUse::classUseNotFound($class);
     }
     $use = new ClassUse($class, $alias);
     $this->append($use);
     return $this;
 }
Ejemplo n.º 2
0
 /**
  *  Checks if the interface is defined or not
  *
  * @param  string $interface
  *
  * @return boolean
  */
 protected function isInterfaceDefined($interface)
 {
     return $this->classFile->isInterfaceDefined($interface);
 }