Get all classes of a class (herself, parents classes and interfaces).

@param string|object $class    Class name
@param bool          $autoload Auto load

@return array
@throws \Berlioz\ServiceContainer\Exception\ClassIndexException
190335
public function getAllClasses($class, bool $autoload = true): array
    {
        if (is_object($class)) {
            $class = get_class($class);
        }

        if (!isset($this->classes[$class])) {
            $classes = array_merge([ltrim($class, '\\')],
                                   $resultClassParents = @class_parents($class, $autoload),
                                   $resultClassImplements = @class_implements($class, $autoload));

            if ($resultClassParents === false || $resultClassImplements === false) {
                throw new ClassIndexException(sprintf('Unable to get all classes of class "%s"', $class));
            }

            $this->classes[$class] = array_unique($classes);
        }

        return $this->classes[$class];
    }
751543
public static function getTraits($class, $deep = true, $autoload = true)
    {
        return array_keys(self::loadTraits($class, $deep, $autoload));
    }
946776
protected function _getClassIndices($class)
    {
        $indices = array ();
        if ($class == self::CLASS_LETTER) {
            $indices = array_merge(
                $this->_getClassIndices(self::CLASS_LOWER),
                $this->_getClassIndices(self::CLASS_UPPER)
            );
            sort($indices);
        } else {
            if (isset ($this->_tokenIndices[$class])) {
                $indices = $this->_tokenIndices[$class];
            }
        }

        return $indices;
    }
1208094
public function load_class( $class ) {
		$class = ltrim( $class, '\\' );
		$dir   = null;

		if ( ! isset( $this->_property_instances['define'] ) ) {
			$namespace = ucfirst( TECHNOTE_PLUGIN );
			if ( preg_match( "#\A{$namespace}#", $class ) ) {
				$class = preg_replace( "#\A{$namespace}#", '', $class );
				$dir   = $this->app->get_library_directory() . DS . 'src';
			}
		} elseif ( preg_match( "#\A{$this->define->plugin_namespace}#", $class ) ) {
			$class = preg_replace( "#\A{$this->define->plugin_namespace}#", '', $class );
			$dir   = $this->define->plugin_src_dir;
		} elseif ( preg_match( "#\A{$this->define->lib_namespace}#", $class ) ) {
			$class = preg_replace( "#\A{$this->define->lib_namespace}#", '', $class );
			$dir   = $this->define->lib_src_dir;
		}

		if ( isset( $dir ) ) {
			$class = ltrim( $class, '\\' );
			$class = strtolower( $class );
			$path  = $dir . DS . str_replace( '\\', DS, $class ) . '.php';
			if ( is_readable( $path ) ) {
				/** @noinspection PhpIncludeInspection */
				require_once $path;

				return true;
			}
		}

		return false;
	}
138599
public function getImplements(string $class){
        if(!class_exists($class)){
            throw new \InvalidArgumentException();
        }

        if(false === ($parent = get_parent_class($class))){
            return array_values(array_unique(class_implements($class)));
        }

        return array_values(
            array_unique(
                array_diff(
                    class_implements($class),
                    class_implements($parent)
                )
            )
        );
    }
1288187
public function loadClass($class)
    {
        if (!$file = $this->findFile($class)) {
            return;
        }

        if (!$this->_patchers || !$this->patchable($class)) {
            includeFile($file);
            return true;
        }
        return $this->loadFile($file);
    }
725048
protected function autoloadTheme($class)
    {
        $prefix = 'Grav\\Theme\\';
        if (false !== strpos($class, $prefix)) {
            // Remove prefix from class
            $class = substr($class, strlen($prefix));
            $locator = $this->grav['locator'];

            // First try lowercase version of the classname.
            $path = strtolower($class);
            $file = $locator("themes://{$path}/theme.php") ?: $locator("themes://{$path}/{$path}.php");

            if ($file) {
                return include_once $file;
            }

            // Replace namespace tokens to directory separators
            $path = $this->grav['inflector']->hyphenize($class);
            $file = $locator("themes://{$path}/theme.php") ?: $locator("themes://{$path}/{$path}.php");

            // Load class
            if ($file) {
                return include_once $file;
            }

            // Try Old style theme classes
            $path = strtolower(preg_replace('#\\\|_(?!.+\\\)#', '/', $class));
            $file = $locator("themes://{$path}/theme.php") ?: $locator("themes://{$path}/{$path}.php");

            // Load class
            if ($file) {
                return include_once $file;
            }
        }

        return false;
    }
1042485
public function getByModelClass($class)
    {
        $this->checkInitialization();

        if ( ! array_key_exists($class, $this->modelClassIndex)) {
            return false;
        }

        return $this->getByKey($this->modelClassIndex[$class]);
    }
989431
public function getPlugin($class)
		{
		static $index = null;
		if (is_null($index))
			{
			$index = array();
			for ($i = 0, $l = count($this->plugins); $i < $l; $i++)
				{
				$index[get_class($this->plugins[$i])] = $i;
				}
			}
		return isset($index[$class]) ? $this->plugins[$index[$class]] : false;
		}
1124919
public static function getAllChildClasses($class): array
    {
        $type = gettype($class);
        $className = '';

        /* If input an object */
        if ($type == 'object') {
            $className = get_class($class);
        }

        /* If input a string */
        elseif ($type == 'string') {
            $className = $class;
        }

        $classes = [];

        /* Go through all classes */
        foreach (get_declared_classes() as $class) {
            if (is_subclass_of($class, $className)) {
                $classes[] = $class;
            }
        }

        return $classes;
    }
1357975
public static function autoload($class) {
        $name = $class;
        if(false !== strpos($name,'\\')){
          $name = strstr($class, '\\', true);
        }
        
        $filename = TOP_AUTOLOADER_PATH."/top/".$name.".php";
        if(is_file($filename)) {
            include $filename;
            return;
        }

        $filename = TOP_AUTOLOADER_PATH."/top/request/".$name.".php";
        if(is_file($filename)) {
            include $filename;
            return;
        }

        $filename = TOP_AUTOLOADER_PATH."/top/domain/".$name.".php";
        if(is_file($filename)) {
            include $filename;
            return;
        }

        $filename = TOP_AUTOLOADER_PATH."/aliyun/".$name.".php";
        if(is_file($filename)) {
            include $filename;
            return;
        }

        $filename = TOP_AUTOLOADER_PATH."/aliyun/request/".$name.".php";
        if(is_file($filename)) {
            include $filename;
            return;
        }

        $filename = TOP_AUTOLOADER_PATH."/aliyun/domain/".$name.".php";
        if(is_file($filename)) {
            include $filename;
            return;
        }         
    }
905960
private static function _autoload($class)
    {
        $realClass = $class;
        if (preg_match('/^JProxy_/i', $class)) {
            $class = preg_replace('/^JProxy_/i', '', $class);
        }
        foreach (self::$prefixes as $prefix => $lookup) {
            $chr = strlen($prefix) < strlen($class) ? $class[strlen($prefix)] : 0;

            if (strpos($class, $prefix) === 0 && ($chr === strtoupper($chr))) {
                $existsBefore = class_exists($realClass, false);
                if ($realClass === $class) {
                    self::loadByAlias($realClass);
                    self::load($realClass);
                }
                $return = true;
                if (!$existsBefore && !class_exists($class, false)) {
                    $return = self::_load(substr($class, strlen($prefix)), $lookup);
                }
                if ($realClass === $class && !$existsBefore && class_exists($realClass, false)) {
                    self::injectStaticDependencies($class);
                }

                return $return;
            }
        }

        return false;
    }
1326693
public function getAncestors($class)
    {
        $ancestors = [];
        while (true) {
            $parent = $this->getParent($class);
            if ($parent) {
                $ancestors[] = $parent;
                $class = $parent;
            } else {
                break;
            }
        }
        return $ancestors;
    }
32053
public static function autoloader($class)
	{
		$path = dirname(__FILE__) . DIRECTORY_SEPARATOR;

		// Amazon SDK classes
		if (strstr($class, 'Amazon'))
		{
			$path .= 'services' . DIRECTORY_SEPARATOR . str_ireplace('Amazon', '', strtolower($class)) . '.class.php';
		}

		// Utility classes
		elseif (strstr($class, 'CF'))
		{
			$path .= 'utilities' . DIRECTORY_SEPARATOR . str_ireplace('CF', '', strtolower($class)) . '.class.php';
		}

		// Load CacheCore
		elseif (strstr($class, 'Cache'))
		{
			if (file_exists($ipath = 'lib' . DIRECTORY_SEPARATOR . 'cachecore' . DIRECTORY_SEPARATOR . 'icachecore.interface.php'))
			{
				require_once($ipath);
			}

			$path .= 'lib' . DIRECTORY_SEPARATOR . 'cachecore' . DIRECTORY_SEPARATOR . strtolower($class) . '.class.php';
		}

		// Load RequestCore
		elseif (strstr($class, 'RequestCore') || strstr($class, 'ResponseCore'))
		{
			$path .= 'lib' . DIRECTORY_SEPARATOR . 'requestcore' . DIRECTORY_SEPARATOR . 'requestcore.class.php';
		}

		// Load Symfony YAML classes
		elseif (strstr($class, 'sfYaml'))
		{
			$path .= 'lib' . DIRECTORY_SEPARATOR . 'yaml' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'sfYaml.php';
		}

		// Fall back to the 'extensions' directory.
		elseif (defined('AWS_ENABLE_EXTENSIONS') && AWS_ENABLE_EXTENSIONS)
		{
			$path .= 'extensions' . DIRECTORY_SEPARATOR . strtolower($class) . '.class.php';
		}

		if (file_exists($path) && !is_dir($path))
		{
			require_once($path);
		}
	}
192863
public static function load($class)
    {
        $existsBefore = class_exists($class, false);
        $success = parent::load($class);
        if (!$existsBefore && class_exists($class, false)) {
            self::injectStaticDependencies($class);
        }

        return $success;
    }
106011
public static function autoloader($class) {
		$class = ltrim($class, '\\');
		if (class_exists($class, false) || interface_exists($class, false)) {
			return;
		}
		$whitelisted = ['Memcached', 'PHPUnit', 'Symfony'];
		foreach ($whitelisted as $v) {
			if (strpos($class, $v) === 0) return;
		}
		// we need to check if we have customization for classes, we only allow 
		// customizaton for models and controllers
		$file = str_replace(['_', '\\'], DIRECTORY_SEPARATOR, $class) . '.php';
		// we need to store class path so we can load js, css and scss files
		self::$settings['application']['loaded_classes'][$class] = [
			'class' => $class,
			'file' => $file,
			'media' => []
		];
		// debuging
		if (class_exists('Debug', false) && \Debug::$debug) {
			\Debug::$data['classes'][] = ['class' => $class, 'file' => $file];
		}
		require_once($file);
	}
767326
public static function getClassParameters(string $class, bool $toArray = false): array
    {
        if (!\class_exists($class)) {
            throw new \InvalidArgumentException("Class not exists: {$class} (autoloading failed)");
        }

        $reflection = new \ReflectionClass($class);

        if (!$reflection->isInstantiable()) {
            throw new \InvalidArgumentException("Unable to create instance of abstract class: {$class}");
        }

        $params = $reflection->getConstructor()->getParameters();

        if ($params === []) {
            return [];
        }

        if (!$toArray) {
            return $params;
        }

        return static::reflectionParameterToArray($params);
    }