Nette\PhpGenerator\Method::setNamespace PHP Method

setNamespace() public method

public setNamespace ( PhpNamespace $val = NULL ) : self
$val PhpNamespace
return self
    public function setNamespace(PhpNamespace $val = NULL)
    {
        $this->namespace = $val;
        return $this;
    }

Usage Example

Beispiel #1
0
 /**
  * @param  string
  * @return Method
  */
 public function addMethod($name)
 {
     $method = new Method($name);
     if ($this->type === 'interface') {
         $method->setVisibility(NULL)->setBody(FALSE);
     } else {
         $method->setVisibility('public');
     }
     return $this->methods[$name] = $method->setNamespace($this->namespace);
 }