isInternalType() public static method

Returns true if the given type is internal or part of an extension.
public static isInternalType ( string $typeName ) : boolean
$typeName string The type name.
return boolean
Esempio n. 1
0
 /**
  * Extracts the package name of a qualified PHP 5.3 class identifier.
  *
  * If the class name doesn't contain a package identifier this method will
  * return the default identifier.
  *
  * <code>
  *   $namespaceName = $this->extractPackageName('foo\bar\foobar');
  *   var_dump($namespaceName);
  *   // Results in:
  *   // string(8) "foo\bar"
  *
  *   $namespaceName = $this->extractPackageName('foobar');
  *   var_dump($namespaceName);
  *   // Results in:
  *   // string(6) "+global"
  * </code>
  *
  * @param string $qualifiedName The qualified PHP 5.3 class identifier.
  *
  * @return string
  */
 protected function extractNamespaceName($qualifiedName)
 {
     if (($pos = strrpos($qualifiedName, '\\')) !== false) {
         return ltrim(substr($qualifiedName, 0, $pos), '\\');
     } elseif (Type::isInternalType($qualifiedName)) {
         return Type::getTypePackage($qualifiedName);
     }
     return self::DEFAULT_NAMESPACE;
 }
 /**
  * testIsInternalTypeDetectsInternalClassPrefixedWithBackslash
  *
  * @return void
  */
 public function testIsInternalTypeDetectsInternalClassPrefixedWithBackslash()
 {
     $this->assertTrue(Type::isInternalType('\\LogicException'));
 }