Get the class part of a fully namespaced class name
@param $namespaceClass
@return string
11261
public static function getClassName($namespaceClass)
    {
        $lastSlashPosition = mb_strrpos($namespaceClass, '\\');
    
        if ($lastSlashPosition !== false) {
            return mb_substr($namespaceClass, $lastSlashPosition + 1);
        }
    
        return $namespaceClass;
    }
1348609
protected static function parseClass($class)
    {
        static $cache = array();

        if (array_key_exists($class, $cache) === false) {
            // Make reference for original input
            $string = $class;

            if ($string[0] === '\\') {
                $string = substr($string, 1);
            }

            if (preg_match('/^(?<namespace>.*)\\\\(?<className>.+?)$/', $string, $matches)) {
                $cache[$class] = array($matches['namespace'], $matches['className']);
            } else {
                $cache[$class] = array(null, $class);
            }
        }

        return $cache[$class];
    }
1166149
public function findQualifiedName($class, $type, $namespace = null)
    {
        // Check if we already resolved that name
        if (array_key_exists($class, $this->lookedUp)) {
            return $this->lookedUp[$type][$class];
        }

        $paths = $this->getLookups($type);
        $paths[] = '%s';

        // Create classes array
        $class = ucfirst($class);
        $classes = $namespace ? [ucfirst($namespace).'\\'.$class, $class] : [$class];

        // Search for first existing class
        $qualified = false;
        foreach ($classes as $class) {
            foreach ($paths as $path) {
                $path = sprintf($path, $class);
                if (class_exists($path)) {
                    $qualified = $path;
                    break 2;
                }
            }
        }

        return $this->lookedUp[$type][$class] = $qualified;
    }
79191
public function getClassName($with_namespace = true)
    {
        $namespace = $this->getNameSpace();
        $class_name = $this->getBasename(".{$this->getExtension()}");
        return $with_namespace ? "${namespace}\\{$class_name}" : $class_name;
    }
1175475
public function convertToClassName ($table, $namespace = 'Sonic\\Model\\')
	{
		
		$arr		= explode ('_', $table);
		
		foreach ($arr as &$val)
		{
			$val = ucfirst (strtolower ($val));
		}
		
		return $namespace . implode ('\\', $arr);
		
	}
1117900
public function findClass($class) {
        $this->init();

        $fullQualifiedNamespace = $this->trimNamespace($class);

        foreach ($this->localCache as $phpClass) {
            if ($fullQualifiedNamespace === $phpClass->getFullQualifiedNamespace()) {
                return $phpClass;
            }
        }

        return false;
    }
1301995
protected function _getClassName($class)
    {
        $class = Str::low($class);
        list ($plugin, $className) = pluginSplit($class);
        $return = self::HELPER_SUFFIX . '\\' . Inflector::camelize($className) . self::HELPER_SUFFIX;
        if ($plugin !== null) {
            return Inflector::camelize($plugin) . '\\' . $return;
        }

        return Configure::read('App.namespace') . '\\' . $return;
    }
1326943
static public function findClass($name, $type=null, $namespaces=null)
	{
	    $name = StringHelper::toClassName($name);
	    if (!$namespaces && strpos($name, '\\') !== false && class_exists($name)) {
	        return $name;
	    }
	    
	    $class_names = [];
	    if (!empty($type)) {
	        $type = StringHelper::toCamelCase($type);
	        if ($pos = strpos($name, '\\')) {
	            $class_names[] = $type . '\\' . $name . $type;
	            $class_names[] = $type . '\\' . $name;
	            
	            $name = substr($name, 0, $pos) . '\\' . $type . '\\' . substr($name, $pos+1);
	        } else {
	            $name = $type . '\\' . $name;
	        }
	        $class_names[] = $name;
	        $class_names[] = $name . $type;
		} else {
		    $class_names[] = $name;
		}
		
		if ($namespaces) {
            $namespaces = (array)static::formatNamespace($namespaces);
		} else {
            //$namespaces = array_unique(array_merge((array)$namespaces, static::getNamespaces()));
		    $namespaces = static::getNamespaces();
		}
		
		foreach ($namespaces as $nss) {
		    foreach ($class_names as $class) { 
		        if (class_exists($nss . $class)) {
		            return $nss . $class;
		        }
		    }
		}
		
		return null;
	}
57935
private function generateClassName($fullClassName)
    {
        $namespace = $this->getClassNamespace($fullClassName);

        $className = $fullClassName;

        if ($namespace) {
            $className = substr($fullClassName, strrpos($fullClassName, '\\') + 1, strlen($fullClassName));
        }

        return $className;
    }
677051
public static function classAutoLoader(string $class)
    {
        self::ensureDefines();
        
        $coreBaseNamespace = str_replace('\\', '/', __NAMESPACE__) . '/';
        
        $classWithNamespaceToLoad = str_replace('\\', '/', $class);
        $classWithRelativeNamespaceToLoad = str_replace($coreBaseNamespace, '', $classWithNamespaceToLoad);
        
        $namespaceToLoad = dirname($classWithNamespaceToLoad);
        $classToLoad = basename($classWithNamespaceToLoad);
        
        $classFileName = $classToLoad . EXT_PHP;
        
        $paths = array();
        
        $possibleParentConstants = array(
            Xentriq::CONST_DIR_CORE, // core directory
            Xentriq::CONST_DIR_LIBS, // libraries directory
            Xentriq::CONST_DIR_ADDONS, // addon directory
            Xentriq::CONST_DIR_ASSUMED_ROOT // assumed root directory
        );
        
        foreach ($possibleParentConstants as $possibleParentConstant) {
            // search core directory
            if (defined($possibleParentConstant)) {
                $parentPath = constant($possibleParentConstant);
                
                $paths[] = ($parentPath . '/' . $classFileName);
                $paths[] = ($parentPath . $classWithNamespaceToLoad . EXT_PHP);
                $paths[] = ($parentPath . strtolower(dirname($classWithRelativeNamespaceToLoad)) . '/' . $classFileName);
                
                // search paths with hyphen
                $segments = explode('/', $namespaceToLoad);
                
                for ($sidx = 1; $sidx <= (sizeof($segments)); $sidx++) {
                    $baseHyphenPath = implode('-', array_slice($segments, 0, $sidx));
                    $completeHyphenPath = $baseHyphenPath . CHAR_SLASH . implode('/', array_slice($segments, $sidx));
                    
                    $paths[] = ($parentPath . $baseHyphenPath . '/' . $classFileName);
                    $paths[] = ($parentPath . $completeHyphenPath . '/' . $classFileName);
                    $paths[] = ($parentPath . strtolower($baseHyphenPath) . '/' . $classFileName);
                    $paths[] = ($parentPath . strtolower($completeHyphenPath) . '/' . $classFileName);
                }
            }
        }
        
        foreach ($paths as $path) {
            if (is_file($path) && !class_exists($path)) {
                require_once $path;
                
                // exit loader
                return;
            }
        }
        
        // search in addons
        $classFile = Addons::searchAddonClassFile($class);
        if (is_file($classFile)) {
            require_once $classFile;
        }
    }
449827
public static function getClassName($with_namespaces = true)
    {
        $class_name = get_called_class();
        if($with_namespaces) return $class_name;
        $class = explode('\\',  $class_name);

        return $class[count($class) - 1];
    }
724625
public static function parseClass($fullClassName)
    {
        $classFileName  = self::locateClassFile($fullClassName);
        $namespaceParts = explode('\\', $fullClassName);
        $className      = array_pop($namespaceParts);
        $namespaceName  = join('\\', $namespaceParts);

        // we have a namespace node somewhere
        $namespace      = self::parseFileNamespace($classFileName, $namespaceName);
        $namespaceNodes = $namespace->stmts;

        foreach ($namespaceNodes as $namespaceLevelNode) {
            if ($namespaceLevelNode instanceof ClassLike && $namespaceLevelNode->name == $className) {
                $namespaceLevelNode->setAttribute('fileName', $classFileName);

                return $namespaceLevelNode;
            }
        }

        throw new \InvalidArgumentException("Class $fullClassName was not found in the $classFileName");
    }
1337211
public static function get($name)
    {
        $namespaces = config('crude.namespace');

        if (! is_array($namespaces)) {
            $fullName = $namespaces . $name;

            return class_exists($fullName)
                ? new $fullName()
                : null;
        }

        foreach ($namespaces as $namespace) {
            $fullName = $namespace . $name;
            if (class_exists($fullName))
                return new $fullName();
        }

        return null;
    }
1195049
public function pluralClassName($class)
    {
        // get the class name if an object is given
        if (is_object($class)) {
            $class = get_class($class);
        }

        // split the class name up by namespaces
        $namespace = explode('\\', $class);
        $className = end($namespace);

        // convert the class name into the pluralized underscore version
        $inflector = Inflector::get();

        return $inflector->pluralize($inflector->underscore($className));
    }
569298
public static function getRealNamespace($class)
    {
        if (($lastNsPos = strrpos($realClass = self::getRealClass($class), '\\')) !== false) {
            return substr($realClass, 0, $lastNsPos);
        }
    }
566508
public function getParentOfClass($class)
    {
        // Check for namespace alias
        if (strpos($class, ':') !== false) {
            list($namespaceAlias, $simpleClassName) = explode(':', $class);
            $class = $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName;
        }
        if ($this->getParent() === null) {
            return null;
        }
        if ($this->parent->getPage() instanceof $class) {
            return $this->parent;
        }

        return $this->parent->getParentOfClass($class);
    }
840230
private function getFullPathFromNamespace(string $namespace): string
  {
    $file_name = $namespace.$this->extension;
    $full_path = $this->resourceDirFullPath.'/'.$file_name;

    return $full_path;
  }