获取命名空间中第一个命名空间名
@param string $class_name 类名(实例Exception::class)
@return string 第一个命名空间
165045
public function getFirstNameSpace($class_name)
    {
        $class          = new \ReflectionClass($class_name);
        //获取命名空间
        $namespace      = $class->getNamespaceName();
        //分割获取命名空间
        $arr_namespace  = $namespace ? explode('\\', $namespace) : array("");
        //获取第一命名空间
        $first_namespace= array_shift($arr_namespace);
        return $first_namespace;
    }
735621
public static function getRequestName(): string
    {
        if (substr(static::class, -strlen(static::REQUEST_SUFFIX)) !== static::REQUEST_SUFFIX) {
            throw new \Exception("Request class name must end with '".static::REQUEST_SUFFIX."'");
        }

        return substr(static::getMainNamespaceAndRequestParts()[3], 0, -strlen(static::REQUEST_SUFFIX));
    }
957905
public function loadObjectList($class_name = "stdClass")
    {
        if ($this->stmt === null) {
            return null;
        }

        $objectList = array();
        while ($object = $this->stmt->fetchObject($class_name)) {
            $objectList[] = $object;
        }
        return $objectList;
    }
582832
public function getName() {

		$name = '';

		foreach ( $this->caches as $cache ) {
			$name = $name . '::' . $cache->getName();
		}

		return __CLASS__ . $name;
	}
842613
public function removeClass($class_name='')
    {
        $remove_names = \is_array($class_name) ? $class_name : explode(' ', $class_name);

        foreach ($this->nodes as $node) {
            if ($node instanceof \DOMElement && $node->hasAttribute('class')) {
                $node_classes = preg_split('#\s+#s', $node->getAttribute('class'));
                $class_removed = false;

                if ($class_name === '') { // remove all
                    $node_classes = array();
                    $class_removed = true;
                } else {
                    foreach ($remove_names as $remove_name) {
                        $key = array_search($remove_name, $node_classes, true);
                        if ($key !== false) {
                            unset($node_classes[$key]);
                            $class_removed = true;
                        }
                    }
                }
                if ($class_removed) {
                    $node->setAttribute('class', implode(' ', $node_classes));
                }
            }
        }

        return $this;
    }
744490
public static function getAnonymousClassName(PhpParser\Node\Stmt\Class_ $class, $file_path)
    {
        return preg_replace('/[^A-Za-z0-9]/', '_', $file_path)
            . '_' . $class->getLine() . '_' . (int)$class->getAttribute('startFilePos');
    }
956004
public function extractClassName()
    {
        $tokens = token_get_all($this->phpCode);
        $numberOfTokens = count($tokens);
        for ($i = 0; $i < $numberOfTokens; $i++) {
            $token = $tokens[$i];
            if (is_string($token) || $token[0] !== T_CLASS) {
                continue;
            }
            for (++$i; $i < $numberOfTokens; $i++) {
                $token = $tokens[$i];
                if (is_string($token)) {
                    break;
                }
                list($type, $value) = $token;
                if ($type === T_STRING) {
                    return $value;
                }
                if ($type !== T_WHITESPACE) {
                    break;
                }
            }
        }
        return null;
    }
1055149
public static function classNameShort($class) {
        $className = self::className($class);

        $position = strrpos($className, '\\');
        $name = substr($className, $position + 1);

        return $name;
    }
558530
public function getFirstDescendant($class_name)
    {
        if (!class_exists($class_name) && !interface_exists($class_name)) {
            return null;
        }

        $out = null;

        foreach ($this->columns as $column) {
            if ($column instanceof $class_name) {
                $out = $column;
                break;
            }

            if ($column instanceof SwatUIParent) {
                $out = $column->getFirstDescendant($class_name);
                if ($out !== null) {
                    break;
                }
            }
        }

        if ($out === null) {
            foreach ($this->spanning_columns as $column) {
                if ($column instanceof $class_name) {
                    $out = $column;
                    break;
                }

                if ($column instanceof SwatUIParent) {
                    $out = $column->getFirstDescendant($class_name);
                    if ($out !== null) {
                        break;
                    }
                }
            }
        }

        if ($out === null) {
            foreach ($this->groups as $group) {
                if ($group instanceof $class_name) {
                    $out = $group;
                    break;
                }

                if ($group instanceof SwatUIParent) {
                    $out = $group->getFirstDescendant($class_name);
                    if ($out !== null) {
                        break;
                    }
                }
            }
        }

        if ($out === null) {
            foreach ($this->extra_rows as $row) {
                if ($row instanceof $class_name) {
                    $out = $row;
                    break;
                }

                if ($row instanceof SwatUIParent) {
                    $out = $row->getFirstDescendant($class_name);
                    if ($out !== null) {
                        break;
                    }
                }
            }
        }

        return $out;
    }
25848
protected function _findClasses($class_names)
    {
        if (!is_array($class_names)) {
            $class_names = array($class_names);
        }
        foreach ($class_names as $_cls) {
            if (true===class_exists($_cls)) {
                return $_cls;
            }
        }
        return false;
    }
857990
public static function denamespace($class_name)
	{
		$class_name = trim($class_name, '\\');
		if ($last_separator = strrpos($class_name, '\\'))
		{
			$class_name = substr($class_name, $last_separator + 1);
		}
		return $class_name;
	}
460624
def class_space(classlevel=3):
    ""
    frame = sys._getframe(classlevel)
    classname = frame.f_code.co_name
    classdict = frame.f_locals
    return classname, classdict
983340
def class_name(name, separator = '::', want_array = false)
    Manager.connection.class_name(name, separator, want_array)
  end
1202063
public function getRowsByClass($class_name)
    {
        $rows = array();
        foreach ($this->extra_rows as $row) {
            if ($row instanceof $class_name) {
                $rows[] = $row;
            }
        }

        return $rows;
    }
100086
public function getFirstDescendant($class_name)
    {
        if (!class_exists($class_name) && !interface_exists($class_name)) {
            return null;
        }

        $out = null;

        foreach ($this->action_items as $action_item) {
            if ($action_item instanceof $class_name) {
                $out = $action_item;
                break;
            }

            if ($action_item instanceof SwatUIParent) {
                $out = $action_item->getFirstDescendant($class_name);
                if ($out !== null) {
                    break;
                }
            }
        }

        return $out;
    }
366973
public function getClassName()
    {
        $name = str_replace('.', ' ', $this->name);
        $name = str_replace(':', ' pseudo-class-', $name);
        return trim($name);
    }
1353438
public function get_namespace_parts( $classname, $first_only = false ) {
		// Trim any left-slashes from our string
		$classname = ltrim( $classname, '\\' );

		if ( $first_only === true ) {
			return substr( $classname, 0, strpos( $classname, '\\' ) );
		}

		return explode( '\\', $classname );
	}