protected function isNamespaceValid($namespace)
    {
        if ($namespace === '\\') {
            return true;
        }

        if (strpos($namespace, '\\') === 0) {
            $namespace = substr($namespace, 1);
        }

        $parts = explode('\\', $namespace);
        foreach ($parts as $part) {
            $match = preg_match(self::PATTERN_VALIDATE_NAMESPACE_NAME, $part);
            if ($match === false || $match <= 0 || ReservedKeywords::isReservedKeyword($part) !== false) {
                return false;
            }
        }

        return true;
    }
protected function isNamespaceValid($namespace)
    {
        if ($namespace === '\\') {
            return true;
        }

        if (strpos($namespace, '\\') === 0) {
            $namespace = substr($namespace, 1);
        }

        $parts = explode('\\', $namespace);
        foreach ($parts as $part) {
            $match = preg_match(self::PATTERN_VALIDATE_NAMESPACE_NAME, $part);
            if ($match === false || $match <= 0 || ReservedKeywords::isReservedKeyword($part) !== false) {
                return false;
            }
        }

        return true;
    }
protected function isNamespaceValid ( $ namespace ) { if ( $ namespace === '\\' ) { return true ; } if ( strpos ( $ namespace , '\\' ) === 0 ) { $ namespace = substr ( $ namespace , 1 ) ; } $ parts = explode ( '\\' , $ namespace ) ; foreach ( $ parts as $ part ) { $ match = preg_match ( self :: PATTERN_VALIDATE_NAMESPACE_NAME , $ part ) ; if ( $ match === false || $ match <= 0 || ReservedKeywords :: isReservedKeyword ( $ part ) !== false ) { return false ; } } return true ; }
Check if a namespace is valid.

@param string $namespace The namespace to validate.
@return boolean
Check if a namespace is valid .