Strip namespace from class

@param string|object $nameOrObject Name of class, or instance
@return string Name of class without namespace
168091
public static function shortName($nameOrObject)
    {
        $name = static::class_name($nameOrObject);
        $parts = explode('\\', $name);
        return end($parts);
    }
1171414
def remove_namespace(self, ns_uri):
        """"""
        if not self.contains_namespace(ns_uri):
            return

        ni = self.__ns_uri_map.pop(ns_uri)
        for prefix in ni.prefixes:
            del self.__prefix_map[prefix]
493119
public function classNamespace(string $element, string $name = ''): string
    {
        $localNamespace = trim($this->getOption($element, 'namespace', ''), '\\');
        list($namespace, $name) = $this->parseName($name);

        if (!empty($namespace)) {
            $localNamespace .= '\\' . Inflector::classify($namespace);
        }

        if (empty($this->baseNamespace())) {
            return $localNamespace;
        }

        return trim($this->baseNamespace() . '\\' . $localNamespace, '\\');
    }
497406
public function getNamespaceByName( $name ) {
		$result = $this->getNamespaceResult()['query'];
		foreach ( $result['namespaces'] as $nsInfo ) {
			if ( ( !empty( $nsInfo['canonical'] ) && $nsInfo['canonical'] === $name ) ||
				$nsInfo['*'] === $name ) {
				return $this->createNamespaceFromQuery( $nsInfo, $result['namespacealiases'] );
			}
		}
		foreach ( $result['namespacealiases'] as $alias ) {
			if ( $alias['*'] === $name && !empty( $result['namespaces'][$alias['id']] ) ) {
				return $this->createNamespaceFromQuery(
					$result['namespaces'][$alias['id']],
					$result['namespacealiases']
				);
			}
		}
		return null;
	}
950406
public function get_namespace($name = null)
    {
        $ns = $this->namespace;

        if ($name) {
            // an alias for BC
            if ($name == 'prefix') {
                $name = 'prefix_in';
            }

            return isset($ns[$name]) ? $ns[$name] : null;
        }

        unset($ns['prefix_in'], $ns['prefix_out']);

        return $ns;
    }
566834
protected function removeRootNamespace($classname)
    {
        $namespaces = $this->splitNamespaces($classname);
        if (count($namespaces) > 1) {
            $classname = implode('\\', array_slice($namespaces, 1));
        }

        return $classname;
    }
1305603
def remove_namespaces(self, rpc_reply):
        """"""
        self.__xslt=self.__transform_reply
        self.__parser = etree.XMLParser(remove_blank_text=True)
        self.__xslt_doc = etree.parse(io.BytesIO(self.__xslt), self.__parser)
        self.__transform = etree.XSLT(self.__xslt_doc)
        self.__root = etree.fromstring(str(self.__transform(etree.parse(StringIO(str(rpc_reply))))))
        return self.__root
347169
public function removeNamespace($post, $namespaces)
    {
        foreach($post as $key => $value)
        {
            $splitKey = explode('_', $key);

            if(in_array($splitKey[0], $namespaces))
            {
                unset($post->$key);

                $newKey = implode(array_slice($splitKey, 1), '_');

                $post->$newKey = $value;
            }
        }

        return $this;
    }
714237
protected function getNamespace() {
		$np = explode('\\', $this->getClass());
		unset($np[count($np) - 1]);
		return join('\\', $np);
	}
1022267
protected function _classesInNamespaces($names, array $namespaces, array &$logs = array())
    {
        if (!is_array($names)) {
            $names = array($names);
        }
        foreach ($names as $_name) {
            foreach ($namespaces as $_namespace) {
                if (CodeHelper::namespaceExists($_namespace)) {
                    $tmp_namespace = rtrim(TextHelper::toCamelCase($_namespace), '\\').'\\';
                    if (substr_count(TextHelper::toCamelCase($_name), $tmp_namespace)>0) {
                        return $_name;
                    }
                } else {
                    $logs[] = $this->_getErrorMessage('Namespace "%s" not found!', $_namespace);
                }
            }
        }
        return false;
    }
834600
public function getClassSchema($classNameOrObject)
    {
        $className = is_object($classNameOrObject) ? get_class($classNameOrObject) : $classNameOrObject;
        if (isset($this->classSchemata[$className])) {
            return $this->classSchemata[$className];
        }
        return $this->buildClassSchema($className);
    }
1106048
private function namespace_to_dir( $namespace ) {
		$namespace = ltrim( $namespace, '\\' );
		$dir       = null;
		if ( preg_match( "#\A{$this->app->define->plugin_namespace}#", $namespace ) ) {
			$namespace = preg_replace( "#\A{$this->app->define->plugin_namespace}#", '', $namespace );
			$dir       = $this->app->define->plugin_src_dir;
		} elseif ( preg_match( "#\A{$this->app->define->lib_namespace}#", $namespace ) ) {
			$namespace = preg_replace( "#\A{$this->app->define->lib_namespace}#", '', $namespace );
			$dir       = $this->app->define->lib_src_dir;
		}

		if ( isset( $dir ) ) {
			$namespace = ltrim( $namespace, '\\' );
			$namespace = strtolower( $namespace );
			$path      = $dir . DS . str_replace( '\\', DS, $namespace );
			$path      = rtrim( $path, DS );
			if ( is_dir( $path ) ) {
				return $path;
			}
		}

		return false;
	}
1305022
public function getDescriptor(string $classNamespace): ?Descriptor
    {
        if (!$this->isEmpty()) {
            /** @var Descriptor $descriptor */
            foreach ($this as $rootNamespace => $descriptor) {
                $rootNamespace = $descriptor->getRootNamespace();

                $doubleSlashed = str_replace('\\', '\\\\', $rootNamespace);
                $pattern = sprintf('|^%s\\.*|', $doubleSlashed);

                if (preg_match($pattern, $classNamespace)) {
                    return $descriptor;
                }
            }
        }

        return null;
    }
562626
public function toPhpString(
        $namespace,
        array $aliased_classes,
        $this_class,
        $php_major_version,
        $php_minor_version
    ) {
        if ($this instanceof TNamedObject) {
            return parent::toNamespacedString($namespace, $aliased_classes, $this_class, true);
        }

        return $this->value;
    }
252826
public function getNamespace()
    {
        if (!isset($this->namespace)) {
            $reflectionClass = new \ReflectionClass($this->name);
            $this->namespace = $reflectionClass->getNamespaceName();
        }
        return $this->namespace;
    }
155611
private function getClassNameCandidates(array $namespaces, $name)
    {
        $className = str_replace(' ', '', ucwords($name));

        return array_map(function ($namespace) use ($className) { return $namespace.$className; }, $namespaces);
    }
569298
public static function getRealNamespace($class)
    {
        if (($lastNsPos = strrpos($realClass = self::getRealClass($class), '\\')) !== false) {
            return substr($realClass, 0, $lastNsPos);
        }
    }