abstract public static function getItemDirectoryClasses($componentClass);
771872
protected static function _getParentItemDirectoryClasses($componentClass, $steps = null)
    {
        $ret = array();
        foreach (Kwc_Abstract::getComponentClasses() as $class) {
            foreach (Kwc_Abstract::getChildComponentClasses($class) as $childClass) {
                if ($childClass == $componentClass) {
                    if ($steps === 0) {
                        $ret[] = $class;
                    } else if (is_null($steps)) {
                        if (is_instance_of($class, 'Kwc_Directories_Item_Directory_Component')) {
                            $ret[] = $class;
                        }
                    } else {
                        $ret = array_merge(
                            $ret,
                            self::_getParentItemDirectoryClasses($class, $steps - 1)
                        );
                    }
                }
            }
        }
        return $ret;
    }
257807
protected static function discoverExtensionComponentDirectory($directory)
    {
        $components        = [];
        $directoryIterator = new \RecursiveDirectoryIterator($directory);
        $recursiveIterator = new \RecursiveIteratorIterator($directoryIterator);
        $regexIterator     = new \RegexIterator(
            $recursiveIterator,
            PATH_SEPARATOR.'^'.preg_quote($directory.DIRECTORY_SEPARATOR).'.+Component\.php$'.PATH_SEPARATOR,
            \RecursiveRegexIterator::GET_MATCH
        );

        // Run through all potential component files
        foreach ($regexIterator as $component) {
            // Run through all classes declared in the file
            foreach (self::discoverClassesInFile(file_get_contents($component[0])) as $className) {
                // Test if this is a component class
                $classReflection = new \ReflectionClass($className);
                if ($classReflection->implementsInterface(ComponentInterface::class)) {
                    $components[] = self::addLocalConfiguration($component[0], self::discoverComponent($className));
                }
            }
        }

        return $components;
    }
1367032
protected function getClassMetadata(string $resourceClass): ClassMetadata
    {
        return $this
            ->getManagerRegistry()
            ->getManagerForClass($resourceClass)
            ->getClassMetadata($resourceClass);
    }
959228
public static function getFolderForClass($class)
    {
        $folderName = 'Uploads';

        if (is_object($class)) {
            if (method_exists($class, 'hasMethod') && $class->hasMethod('BaseFolder')) {
                $folderName = $class->BaseFolder();
            }
            elseif ($class instanceof Page) {
                $folderName = get_class($class);
            }
            elseif ($class instanceof DataObject) {
                $folderName = $class->baseTable();
            }
            elseif ($class instanceof DataExtension) {
                $folderName = $class->getOwner()->baseTable();
            }
            else {
                $folderName = get_class($class);
            }
        }
        elseif (is_string($class)) {
            $folderName = $class;
        }

        if (class_exists('Subsite') && Config::inst()->get(
            __CLASS__,
            'use_subsite_integration'
        )) {
            $subsite = Subsite::currentSubsite();
            if ($subsite) {
                // Subsite extras integration$
                if ($subsite->hasField('BaseFolder')) {
                    $baseFolder = $subsite->BaseFolder;
                }
                else {
                    $filter = new URLSegmentFilter();
                    $baseFolder = $filter->filter($subsite->getTitle());
                    $baseFolder = str_replace(
                        ' ',
                        '',
                        ucwords(str_replace('-', ' ', $baseFolder))
                    );
                }
                if (!empty($baseFolder)) {
                    $folderName = $baseFolder . '/' . $folderName;
                }
            }
        }

        return $folderName;
    }
618657
public static function detectClassComponent($mClass): ?Component
    {
        $oReflect  = new \ReflectionClass($mClass);
        $sPath     = $oReflect->getFileName();
        $bIsVendor = (bool) preg_match('/^' . preg_quote(NAILS_APP_PATH . 'vendor', '/') . '/', $sPath);

        if (!$bIsVendor) {
            return static::getApp();
        }

        foreach (static::available() as $oComponent) {

            if ($oComponent->slug === 'app') {
                continue;
            } elseif (preg_match('/^' . preg_quote($oComponent->path, '/') . '/', $sPath)) {
                return $oComponent;
            }
        }

        return null;
    }
69637
public function getClassPath($class)
    {
        $segments          = explode('_', $class);
        $namespaceTopLevel = $this->getNamespace();
        $namespace         = '';

        if (!empty($namespaceTopLevel)) {
            $namespace = array();
            $topLevelSegments = count(explode('_', $namespaceTopLevel));
            for ($i = 0; $i < $topLevelSegments; $i++) {
                $namespace[] = array_shift($segments);
            }
            $namespace = implode('_', $namespace);
            if ($namespace != $namespaceTopLevel) {
                // wrong prefix? we're done
                return false;
            }
        }

        if (count($segments) < 2) {
            // assumes all resources have a component and class name, minimum
            return false;
        }

        $final     = array_pop($segments);
        $component = $namespace;
        $lastMatch = false;
        do {
            $segment    = array_shift($segments);
            $component .= empty($component) ? $segment : '_' . $segment;
            if (isset($this->_components[$component])) {
                $lastMatch = $component;
            }
        } while (count($segments));

        if (!$lastMatch) {
            return false;
        }

        $final = substr($class, strlen($lastMatch) + 1);
        $path = $this->_components[$lastMatch];
        $classPath = $path . '/' . str_replace('_', '/', $final) . '.php';

        if (Zend_Loader::isReadable($classPath)) {
            return $classPath;
        }

        return false;
    }
1113439
private function getClassInfo($defClass) {
		if (is_object($defClass)) {
			if ($defClass instanceof ReflectionClass) {
				$className = $defClass->getName();
				$refClass = $defClass;
			} else {
				$className = get_class($defClass);
				$refClass = new ReflectionClass($className);
			}
		} else {
			$className = $defClass;
			$refClass = new ReflectionClass($className);
		}

		return [ $className, $refClass ];
	}
780664
public function findFile($class)
    {
        return $this->finder->findFile($class, $this->prefixPaths, $this->basePaths, $this->useIncludePath);
    }
664758
public static List getClasspathDirectories()
    {
        List directories = new ArrayList();
        List components = getClasspathComponents();
        for (Iterator i = components.iterator(); i.hasNext();)
        {
            String possibleDir = (String) i.next();
            File file = new File(possibleDir);
            if (file.isDirectory())
            {
                directories.add(possibleDir);
            }
        }
        List tomcatPaths = getTomcatPaths();
        if (tomcatPaths != null)
        {
            directories.addAll(tomcatPaths);
        }
        return directories;
    }
1064163
private function getClasses($directory)
    {
        $classes = [];
        $directoryList = [];
        $includedFiles = [];

        $finder = new Finder();
        try {
            $finder->in($directory)->files()->name('*.php');
        } catch (\InvalidArgumentException $e) {
            return [[], []];
        }

        foreach ($finder as $file) {
            $directoryList[$file->getPath()] = true;
            $sourceFile = $file->getRealpath();
            if (!preg_match('(^phar:)i', $sourceFile)) {
                $sourceFile = realpath($sourceFile);
            }

            require_once $sourceFile;
            $includedFiles[$sourceFile] = true;
        }

        $declared = get_declared_classes();
        foreach ($declared as $className) {
            $reflectionClass = new \ReflectionClass($className);
            $sourceFile = $reflectionClass->getFileName();

            if ($reflectionClass->isAbstract()) {
                continue;
            }

            if (method_exists($reflectionClass, 'isAnonymous') && $reflectionClass->isAnonymous()) {
                continue;
            }

            if (isset($includedFiles[$sourceFile])) {
                $classes[$className] = true;
            }
        }

        return [array_keys($classes), $directoryList];
    }
1001969
public function getLayoutForClass($class)
    {
        foreach (ClassTools::singleton()->getReverseAncestry($class) as $name) {
            
            if ($type = PageType::findByClass($name)) {
                
                if ($type->hasPageLayout()) {
                    return $type->getPageLayout();
                }
                
            }
            
            if ($name == SiteTree::class) {
                break;
            }
            
        }
    }
1116789
private function getResourcePathFromClassName($class)
    {
        $reflection = new \ReflectionClass($class);

        if (is_dir($dir = dirname($reflection->getFileName()).'/Resources/contao')) {
            return $dir;
        }

        return null;
    }
1268558
protected function _getCreatingClasses($createdClass, $createClass = null)
    {
        $ret = array();
        foreach (Kwc_Abstract::getComponentClasses() as $c) {
            if (!$createClass || in_array($createClass, Kwc_Abstract::getParentClasses($c))) {
                if (Kwc_Abstract::getChildComponentClasses($c, array('componentClass'=>$createdClass))) {
                    $ret[] = $c;
                }
            }
        }
        return $ret;
    }
310856
public function find($class)
    {
        $reflectionClass = new \ReflectionClass($class);

        do {
            $classNamespace = $reflectionClass->getNamespaceName();
            foreach ($this->bundles as $bundleName => $bundleClass) {
                $bundleNamespace = \substr($bundleClass, 0, \strrpos($bundleClass, '\\'));
                if (0 === \strpos($classNamespace, $bundleNamespace)) {
                    return $bundleName;
                }
            }
            $reflectionClass = $reflectionClass->getParentClass();
        } while ($reflectionClass);

        return null;
    }
401857
public function getEnabledComponents()
    {
        // Answer Cached Components (if available):
        
        if ($this->cacheEnabledComponents) {
            return $this->cacheEnabledComponents;
        }
        
        // Obtain Component Objects:
        
        $components = ArrayList::create();
        
        foreach ($this->getEnabledChildren() as $child) {
            $components->push($child);
            $components->merge($child->getEnabledComponents());
        }
        
        $this->cacheEnabledComponents = $components;
        
        // Answer Component Objects:
        
        return $this->cacheEnabledComponents;
    }
953744
public function getParentByClass($cls)
    {
        if (!is_array($cls)) $cls = array($cls);
        $d = $this;
        while ($d) {
            foreach ($cls as $i) {
                if (is_instance_of($d->componentClass, $i)) {
                    return $d;
                }
            }
            $d = $d->parent;
        }
        return $d;
    }
80880
private static function methodsOf(\ReflectionClass $class): \Iterator
    {
        return new \CallbackFilterIterator(
                new \ArrayIterator($class->getMethods()),
                function(\ReflectionMethod $method)
                {
                    return !$method->isPrivate()
                            && !$method->isFinal()
                            && !$method->isStatic()
                            && !$method->isConstructor()
                            && !$method->isDestructor();
                }
        );
    }