Zephir\ClassDefinition::isFinal PHP Method

isFinal() public method

Checks whether the class is abstract or not
public isFinal ( ) : boolean
return boolean
    public function isFinal()
    {
        return $this->final;
    }

Usage Example

Ejemplo n.º 1
0
    protected function buildClass(ClassDefinition $class)
    {
        $source = <<<EOF
<?php

namespace {$class->getNamespace()};


EOF;
        if ($class->isFinal()) {
            $source .= 'final ';
        } elseif ($class->isAbstract()) {
            $source .= 'abstract ';
        }
        $source .= $class->getType() . ' ' . $class->getName();
        if ($extendsClassDefinition = $class->getExtendsClassDefinition()) {
            $source .= ' extends \\' . $extendsClassDefinition->getCompleteName();
        }
        if ($implementedInterfaces = $class->getImplementedInterfaces()) {
            $interfaces = array_map(function ($val) {
                return '\\' . $val;
            }, $implementedInterfaces);
            $source .= ' implements ' . join(', ', $interfaces);
        }
        $source .= PHP_EOL . '{' . PHP_EOL;
        foreach ($class->getConstants() as $constant) {
            $source .= $this->buildConstant($constant) . PHP_EOL;
        }
        foreach ($class->getProperties() as $property) {
            $source .= $this->buildProperty($property) . PHP_EOL;
        }
        $source .= PHP_EOL;
        foreach ($class->getMethods() as $method) {
            $source .= $this->buildMethod($method, $class->getType() === 'interface') . "\n\n";
        }
        return $source . '}' . PHP_EOL;
    }
All Usage Examples Of Zephir\ClassDefinition::isFinal