Nette\PhpGenerator\Method::setVisibility PHP Method

setVisibility() public method

public setVisibility ( $val ) : self
return self
    public function setVisibility($val)
    {
        if (!in_array($val, ['public', 'protected', 'private', NULL], TRUE)) {
            throw new Nette\InvalidArgumentException('Argument must be public|protected|private|NULL.');
        }
        $this->visibility = $val ? (string) $val : NULL;
        return $this;
    }

Usage Example

Example #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);
 }
All Usage Examples Of Nette\PhpGenerator\Method::setVisibility