Zephir\ClassDefinition::getConstant PHP Method

getConstant() public method

Returns a constant definition by its name
public getConstant ( string $constantName ) : boolean | zephir\ClassConstant
$constantName string
return boolean | zephir\ClassConstant
    public function getConstant($constantName)
    {
        if (!is_string($constantName)) {
            throw new \InvalidArgumentException('$constantName must be string type');
        }
        if (empty($constantName)) {
            throw new \InvalidArgumentException('$constantName must not be empty: ' . $constantName);
        }
        if (isset($this->constants[$constantName])) {
            return $this->constants[$constantName];
        }
        $extendsClassDefinition = $this->getExtendsClassDefinition();
        if ($extendsClassDefinition) {
            if ($extendsClassDefinition->hasConstant($constantName)) {
                return $extendsClassDefinition->getConstant($constantName);
            }
        }
        /**
         * Gets constant from interfaces
         */
        return $this->getConstantFromInterfaces($constantName);
    }