List all synonyms.
@param string $class
@return int
355647
public function actionSynonyms($class = null)
    {
        try {
            foreach (Yii::$app->rhoone->dic->getSynonyms($class) as $synonyms) {
                echo $synonyms->word . "\n";
            }
        } catch (\Exception $ex) {
            throw new Exception($ex->getMessage());
        }
        return 0;
    }
1019112
public function fetchHooks($class) {
		$hooks = [];

		$reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader();
		$reader->addNamespace('Asgard\Hook\Annotation');
		if($this->cache) {
			$reader = new \Doctrine\Common\Annotations\CachedReader(
				$reader,
				$this->cache,
				$this->debug
			);
		}

		$reflection = new \ReflectionClass($class);
		foreach($reflection->getMethods() as $method) {
			$hookAnnot = $reader->getMethodAnnotation($method, 'Asgard\Hook\Annotation\Hook');
			if($hookAnnot !== null) {
				$hook = $hookAnnot->value;
				$hooks[$hook][] = [$class, $method->getName()];
			}
		}

		return $hooks;
	}
1196462
final public function whereInstanceOf(string $class)
    {
        if ($this->class === $class) {
            return $this;
        }

        if (!is_a($class, $this->class->getClassName(), true)) {
            throw InvalidArgumentException::format(
                'Invalid class supplied to %s: must be an a subclass of %s, %s given',
                __METHOD__, $this->class->getClassName(), $class
            );
        }

        $this->append(new InstanceOfCondition($class));
        
        if (!$this->isOrMode) {
            $this->class = $class::definition();
        }

        return $this;
    }
820883
public function getEntityRepositories($class)
    {
        $identifiers = $this->getEntityIdentifiers($class);

        foreach ($identifiers as $i => $identifier) {
            $identifiers[$i] = AnDomain::getRepository($identifier);
        }

        return $identifiers;
    }
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;
    }
1222038
private function filter(string $class): bool
    {
        foreach ($this->patterns as $pattern) {
            if (preg_match($pattern, $class) === 1) {
                return false;
            }
        }

        return true;
    }
400776
public function getManagerForClass($class)
    {
        // Check for namespace alias
        if (strpos($class, ':') !== false) {
            list($namespaceAlias, $simpleClassName) = explode(':', $class, 2);
            $class                                  = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName;
        }

        $proxyClass = new ReflectionClass($class);
        if ($proxyClass->implementsInterface(Proxy::class)) {
            $class = $proxyClass->getParentClass()->getName();
        }

        $managerNames = $this->getManagerNames();

        if (count($managerNames) === 1) {
            return $this->getManager(reset($managerNames));
        }

        foreach ($managerNames as $name) {
            $manager = $this->getManager($name);

            if (!$manager->getMetadataFactory()->isTransient($class)) {
                foreach ($manager->getMetadataFactory()->getAllMetadata() as $metadata) {
                    if ($metadata->getName() === $class) {
                        return $manager;
                    }
                }
            }
        }
    }
1129745
protected function getClassMetadata(string $class): ClassMetadata
    {
        $factory = $this->getDoctrineHelper()->getMetadataFactory();
        if (!$factory->hasMetadataFor($class)) {
            throw new \InvalidArgumentException(sprintf('No metadata found for class "%s"', $class));
        }
        
        return $factory->getMetadataFor($class);
    }
825838
public function loadClass($class)
    {
        $prefix = $class;

        while (($pos = strrpos($prefix, '\\')) !== false) {
            $prefix = substr($class, 0, $pos + 1);
            $relativeClass = substr($class, $pos + 1);

            $mappedFile = $this->_loadMappedFile($prefix, $relativeClass);
            if ($mappedFile) {
                return $mappedFile;
            }

            $prefix = rtrim($prefix, '\\');
        }

        return false;
    }
500456
public function class_uses_deep($class)
    {
        $traits = [];
        do {
            $traits = array_merge($traits, class_uses($class, false));
        } while ($class = get_parent_class($class));
        foreach ($traits as $trait) {
            $traits = array_merge($traits, class_uses($trait, false));
        }
        return array_unique($traits);
    }
1240342
public function actionHeadwords($class = null)
    {
        try {
            foreach (Yii::$app->rhoone->dic->getHeadwords($class) as $headword) {
                echo $headword->word . "\n";
            }
        } catch (\Exception $ex) {
            throw new Exception($ex->getMessage());
        }
        return 0;
    }
495264
public function forClass(string $class): array
    {
        if (!class_exists($class)) {
            throw new InvalidArgumentException("Cannot get meta for non-exist class '$class'");
        }

        $reflection = $this->factory->reflectClass($class);

        $meta = $this->getClassMeta($reflection);
        $meta['@properties'] = $this->getPropertiesMeta($reflection);

        return $meta;
    }
1018364
public static function loadByAlias($class)
    {
        if (!isset(self::$classAliases[$class])) {
            foreach (self::$classAliases as $key => $value) {
                if (strlen($key) == strlen($class) && false !== stripos($key, $class)) {
                    $class = $key;
                    break;
                }
            }
        }

        $existsBefore = class_exists($class, false);
        $success = parent::loadByAlias($class);
        if (!$existsBefore && class_exists($class, false)) {
            self::injectStaticDependencies($class);
        }

        return $success;
    }
1253965
protected function getMetadata($class)
    {
        if (array_key_exists($class, $this->cache)) {
            return $this->cache[$class];
        }

        $this->cache[$class] = null;

        foreach ($this->registry->getManagers() as $name => $em) {
            try {
                return $this->cache[$class] = [$em->getClassMetadata($class), $name];
            } catch (MappingException $e) {
                // not an entity or mapped super class
            } catch (LegacyMappingException $e) {
                // not an entity or mapped super class, using Doctrine ORM 2.2
            }
        }

        return $this->cache[$class];
    }
1117900
public function findClass($class) {
        $this->init();

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

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

        return false;
    }
133022
protected function fetchTraits(string $class): array
    {
        $traits = [];

        while ($class) {
            $traits = array_merge(class_uses($class), $traits);
            $class = get_parent_class($class);
        }

        //Traits from traits
        foreach (array_flip($traits) as $trait) {
            $traits = array_merge(class_uses($trait), $traits);
        }

        return array_unique($traits);
    }
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));
    }