PHPParser_Node_Stmt_Class::__construct PHP Method

__construct() public method

Constructs a class node.
public __construct ( string $name, array $subNodes = [], integer $line, null | string $docComment = null )
$name string Name
$subNodes array Array of the following optional subnodes: 'type' => 0 : Type 'extends' => null : Name of extended class 'implements' => array(): Names of implemented interfaces 'stmts' => array(): Statements
$line integer Line
$docComment null | string Nearest doc comment
    public function __construct($name, array $subNodes = array(), $line = -1, $docComment = null)
    {
        parent::__construct($subNodes + array('type' => 0, 'extends' => null, 'implements' => array(), 'stmts' => array(), 'props' => array(), 'constructor' => array()), $line, $docComment);
        $this->name = $name;
        if (isset(self::$specialNames[(string) $this->name])) {
            throw new PHPParser_Error(sprintf('Cannot use "%s" as class name as it is reserved', $this->name));
        }
        if (isset(self::$specialNames[(string) $this->extends])) {
            throw new PHPParser_Error(sprintf('Cannot use "%s" as class name as it is reserved', $this->extends));
        }
        foreach ($this->implements as $interface) {
            if (isset(self::$specialNames[(string) $interface])) {
                throw new PHPParser_Error(sprintf('Cannot use "%s" as interface name as it is reserved', $interface));
            }
        }
        list($this->stmts, $this->extends, $this->implements) = $this->class_settings($this->stmts);
    }