Convert class names into file paths for inclusion
@param string $class_name
507707
private static function splAutoloader($class_name) {
        if('Treffynnon\\Navigator' === substr(ltrim($class_name, '\\'), 0, 20)) {
            $class_path = realpath(__DIR__ . '/..') . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $class_name);
            require_once $class_path . '.php';
        }
    }
1017205
public function addMapping($package_class_name, $class_name)
    {
        $this->mappings[$package_class_name] = $class_name;
        self::add($package_class_name, $class_name);
    }
1247255
public function toggleClass($class_name='')
    {
        $toggle_names = \is_array($class_name) ? $class_name : explode(' ', $class_name);

        foreach ($this as $node) {
            foreach ($toggle_names as $toggle_class) {
                if (!$node->hasClass($toggle_class)) {
                    $node->addClass($toggle_class);
                } else {
                    $node->removeClass($toggle_class);
                }
            }
        }

        return $this;
    }
385597
static function includeFile($paths, $file_name) {
        $path_arr = explode(';', $paths);
        foreach ($path_arr as $p) {
            $file = $p . '/' . $file_name;
            if (file_exists($file)){
                return include $file;
            }
        }
        throw new FileNotExistException("unable to include the file $file_name");
    }
82662
private function loadConfig($file_name)
    {
        $file_path = $this->getAppPath('config').DIRECTORY_SEPARATOR.$file_name.'.php';

        if (is_readable($file_path)) {
            $configs = require $file_path;
            foreach ($configs as $key => $value) {
                $this->app['config.'.$file_name.'.'.$key] = $value;
            }
        } else {
            throw new Exception("Can't read from config file.");
        }
    }
52510
public static function isClassMethodCall($class_name, $method_name) {
    return function ($node) use ($class_name, $method_name) {
      if ($node instanceof ClassMethodCallNode) {
        $call_class_name_node = $node->getClassName();
        $call_class_name = $call_class_name_node instanceof NameNode ? $call_class_name_node->getAbsolutePath() : $call_class_name_node->getText();
        $class_matches = $call_class_name === $class_name;
        $method_matches = $node->getMethodName()->getText() === $method_name;
        return $class_matches && $method_matches;
      }
      return FALSE;
    };
  }
507561
public function setClassName($class_name)
    {
        if ($class_name === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$class_name")
            );
        }

        $implements_list = class_implements($class_name, true);

        if (is_array($implements_list) &&
            array_search('nabu\http\interfaces\INabuHTTPResponseRender', $implements_list)
        ) {
            $this->setValue("nb_http_render_descriptor_class_name", $class_name);
        } else {
            throw new ENabuCoreException(ENabuCoreException::ERROR_INVALID_RENDER_DESCRIPTOR_CLASS);
        }

        return $this;
    }
686163
public static function create($class_name, $method_name) {
    if (is_string($class_name)) {
      $class_name = NameNode::create($class_name);
    }
    /** @var ClassMethodCallNode $node */
    $node = new static();
    $node->addChild($class_name, 'className');
    $node->addChild(Token::doubleColon());
    $node->addChild(Token::identifier($method_name), 'methodName');
    $node->addChild(Token::openParen(), 'openParen');
    $node->addChild(new CommaListNode(), 'arguments');
    $node->addChild(Token::closeParen(), 'closeParen');
    return $node;
  }
968679
public function findFile($class)
    {
        if (false !== $pos = strrpos($class, '\\')) {
            // namespaced class name
            $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)).DIRECTORY_SEPARATOR;
            $className = substr($class, $pos + 1);
        } else {
            // PEAR-like class name
            $classPath = null;
            $className = $class;
        }

        $classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';

        foreach ($this->prefixes as $prefix => $dirs) {
            if (0 === strpos($class, $prefix)) {
                foreach ($dirs as $dir) {
                    if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
                        return $dir.DIRECTORY_SEPARATOR.$classPath;
                    }
                }
            }
        }

        foreach ($this->fallbackDirs as $dir) {
            if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
                return $dir.DIRECTORY_SEPARATOR.$classPath;
            }
        }

        if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) {
            return $file;
        }
    }
728779
protected function get_class_setting( $class_name, $add_namespace = '' ) {
		if ( isset( $this->_cache[ $add_namespace . $class_name ] ) ) {
			return $this->_cache[ $add_namespace . $class_name ];
		}
		$namespaces = $this->get_namespaces();
		if ( ! empty( $namespaces ) ) {
			foreach ( $namespaces as $namespace ) {
				$class = rtrim( $namespace, '\\' ) . '\\' . $add_namespace . $class_name;
				if ( class_exists( $class ) ) {
					$this->_cache[ $add_namespace . $class_name ] = [ $class, $add_namespace ];

					return $this->_cache[ $add_namespace . $class_name ];
				}
			}
		}

		return false;
	}
884882
public static function extendsClass($class_name, $mother_name)
    {
        if (is_object($class_name)) {
            $class_name = get_class($class_name);
        }
        if (class_exists($class_name)) {
            return (bool) is_subclass_of($class_name, $mother_name);
        }
        return false;
    }
574078
public static function ClassPathToRealFilePath ($class_path, $class_file_ext = self::CLASS_FILE_EXT) {
		return static::$_VendorRootDir . str_replace(static::NAMESPACE_SEPARATOR, '/', $class_path) . $class_file_ext;
	}
1144492
private function psr4_get_file_name_from_class( $class ) {
		$class = strtolower( $class );
		if ( stristr( $class, '\\' ) ) {

			// If the first item is == the collection name, trim it off.
			$class = str_ireplace( static::$autoload_class_prefix, '', $class );

			// Maybe fix formatting underscores to dashes and double to single slashes.
			$class     = str_replace( [ '_', '\\' ], [ '-', '/' ], $class );
			$class     = explode( '/', $class );
			$file_name = &$class[ count( $class ) - 1 ];
			$file_name = static::$filename_prefix . $file_name . '.php';
			$file_path = join( DIRECTORY_SEPARATOR, $class );

			return $file_path;
		} else {
			return static::$filename_prefix . str_replace( '_', '-', $class ) . '.php';
		}
	}
1116759
public function findReferencesToClassLike($fq_class_name)
    {
        $fq_class_name_lc = strtolower($fq_class_name);
        $locations = $this->file_reference_provider->getClassLocations($fq_class_name_lc);

        if (isset($this->use_referencing_locations[$fq_class_name_lc])) {
            $locations = array_merge($locations, $this->use_referencing_locations[$fq_class_name_lc]);
        }

        return $locations;
    }
348470
protected function transformClassNameToFilename($class, $directory)
    {
        // $class may contain a namespace portion, in  which case we need
        // to preserve any underscores in that portion.
        $matches = array();
        preg_match('/(?P<namespace>.+\\\)?(?P<class>[^\\\]+$)/', $class, $matches);

        $class     = (isset($matches['class'])) ? $matches['class'] : '';
        $namespace = (isset($matches['namespace'])) ? $matches['namespace'] : '';

        return $directory
             . str_replace(self::NS_SEPARATOR, '/', $namespace)
             . str_replace(self::PREFIX_SEPARATOR, '/', $class)
             . '.php';
    }
50563
public function runApplication($class_name)
    {
        $this->traceLog('Request timestamp', $this->microtime_start);

        try {
            switch (self::$operation_mode) {
                case self::ENGINE_MODE_STANDALONE:
                    $this->locateHTTPServer();
                    $this->createBuiltInServer();
                    $this->createBuiltInSite();
                    break;
                case self::ENGINE_MODE_HOSTED:
                    $this->registerMainDatabase();
                    $this->locateHTTPServer();
                    $this->createBuiltInServer();
                    $this->locateRunningConfiguration();
                    break;
                case self::ENGINE_MODE_CLUSTERED:
                    $this->registerMainDatabase();
                    $this->locateHTTPServer();
                    $this->locateRunningConfiguration();
                    break;
                default:
            }

            $retval = forward_static_call(array($class_name, 'launch'));
        } catch (Exception $e) {
            $this->nb_error_handler->dumpStack(
                $e->getMessage(), E_CORE_ERROR, $e->getFile(), $e->getLine(), null, $e->getTrace()
            );
            if ($this->isOperationModeStandalone() ||
                $this->isOperationModeStored() ||
                $this->isOperationModeClustered()
            ) {
                nb_displayErrorPage(500, $e);
            }
            $retval = false;
        }

        if (self::isInstantiated()) {
            self::getEngine()->finish();
            /** @todo Implement CNabuEngine Dump Popup Trace action */
            /** @source $nb_engine->dumpPopupTrace(); */
        }

        return $retval;
    }
582052
private static function load($class_name)
    {
        $class_name = trim($class_name, '\\');

        foreach (self::$_namespace_list as $namespace => $path_list) {
            $pattern = '/^' . str_replace('\\', '\\\\', $namespace) . '/';

            if (!preg_match($pattern, $class_name)) {
                continue;
            }

            $class_name = str_replace($namespace, '', trim($class_name, '\\'));
            $class_name = str_replace('\\', '/', trim($class_name, '\\'));

            foreach ($path_list as $path) {
                if (!file_exists("{$path}/{$class_name}.php")) {
                    continue;
                }

                require "{$path}/{$class_name}.php";

                return true;
            }
        }

        throw new Exception("Class: {$class_name} is not found.");
    }