Get classes by class argument or by app namespace.

@return void
183906
protected function getClasses()
    {
        $class = $this->argument('class');

        // set classes
        if ($class) {
            if (class_exists($class)) {
                $classes = [$class];
            } elseif (class_exists($this->config['models_namespace'] . '\\' . $class)) {
                $classes = [$this->config['models_namespace'] . '\\' . $class];
            } else {
                throw new UnexpectedValueException('Classname is not valid.');
            }
        } else {
            $classes = $this->finder->getClassesFromNamespace($this->config['models_namespace']);
        }

        return $classes;
    }
1127529
public function getClassesAndAnnotations()
    {
        static $classesAndAnnotations;
        if ($classesAndAnnotations === null) {
            $classesAndAnnotations = [];
            foreach (array_keys($this->indexAnnotations) as $className) {
                $classesAndAnnotations[$className] = $this->indexAnnotations[$className]['annotation'];
            }
        }

        return $classesAndAnnotations;
    }
210466
public static function getNamespaces()
    {
        $called = get_called_class();

        if (!isset(static::$namespaces[$called])) {
            static::$namespaces[$called] = new PriorityQueue();
        }

        return static::$namespaces[$called];
    }
91972
public function getAllClassNames()
    {
        if ($this->classNames === null) {
            $metadata = $this->getAllMetadata();

            /** @var ClassMetadataInfo $meta */
            foreach ($metadata as $meta) {
                if ($this->annotationReader->isRevised($meta->getName())) {
                    $this->classNames[] = $meta->getName();
                }
            }
        }

        return $this->classNames;
    }
658850
public function getClasses()
    {
        $classes = explode(' ', $this->cssClass);
        if ($this->style) {
            $classes[] = $this->style;
        }

        $this->extend('updateClasses', $classes);
        return Convert::raw2att(implode(' ', $classes));
    }
25848
protected function _findClasses($class_names)
    {
        if (!is_array($class_names)) {
            $class_names = array($class_names);
        }
        foreach ($class_names as $_cls) {
            if (true===class_exists($_cls)) {
                return $_cls;
            }
        }
        return false;
    }
664107
protected function getUsedClasses()
    {
        $uses = array();
        if ($orm = $this->getOrmUse()) {
            $uses[] = $orm;
        }
        if (count($this->getTableM2MRelations()) || count($this->getAllLocalForeignKeys())) {
            $uses[] = $this->getCollectionClass();
        }

        return $uses;
    }
983067
protected function getMappingClasses(): array
    {
        AnnotationRegistry::registerLoader('class_exists');

        $mappingClasses = [];

        foreach ($this->locator->getMappingFiles() as $annotationFile) {
            $mappingClasses[] = $this->loadClassFromFile($annotationFile);
        }

        return \array_map(
            function (string $sourceClass) {
                return new \ReflectionClass($sourceClass);
            },
            \array_filter(\array_unique($mappingClasses))
        );
    }
498484
protected function findClassDefinition()
    {
        foreach ($this->classes as $class) {
            if ($class->name == $this->classShortName) {
                $this->classAbstractTree = $class;

                return $this;
            }
        }

        throw new Exception('Class '.$this->classShortName.' not found');
    }
176348
protected function getClass()
    {
        // Retrieve path to Resources and shortname's class
        $class = new \ReflectionClass(get_class($this));

        // Return a simple array
        return [
            'name'      => $class->getShortName(),
            'path'      => $class->getFileName(),
            'resources' => dirname(dirname($class->getFileName())).S.'Resources',
        ];
    }
883401
protected function bootstrap(array $classes): array
    {
        foreach ($classes as $index => $class) {
            $classes[$index] = $this->app->make($class)->bootstrap();
        }

        return $classes;
    }
235290
function &ordinaryClasses()
    {
        $classes = NULL;
        foreach ($this->_classes as $name => $class) {
            if ($class->isOrdinaryClass()) {
                $classes[$name] =& $this->_classes[$name];
            }
        }

        return $classes;
    }
271859
function &interfaces()
    {
        $interfaces = NULL;
        foreach ($this->_classes as $name => $interface) {
            if ($interface->isInterface()) {
                $interfaces[$name] =& $this->_classes[$name];
            }
        }

        return $interfaces;
    }
1119501
protected function getClasses(string $phpCode): array
  {
    $tokens = token_get_all($phpCode);

    $mode      = '';
    $namespace = '';
    $classes   = [];
    foreach ($tokens as $i => $token)
    {
      // If this token is the namespace declaring, then flag that the next tokens will be the namespace name
      if (is_array($token) && $token[0]==T_NAMESPACE)
      {
        $mode      = 'namespace';
        $namespace = '';
        continue;
      }

      // If this token is the class declaring, then flag that the next tokens will be the class name
      if (is_array($token) && in_array($token[0], [T_CLASS, T_INTERFACE, T_TRAIT]))
      {
        $mode = 'class';
        continue;
      }

      // While we're grabbing the namespace name...
      if ($mode=='namespace')
      {
        // If the token is a string or the namespace separator...
        if (is_array($token) && in_array($token[0], [T_STRING, T_NS_SEPARATOR]))
        {
          //Append the token's value to the name of the namespace
          $namespace .= $token[1];
        }
        elseif (is_array($token) && $token[0]==T_WHITESPACE)
        {
          // Ignore whitespace.
        }
        elseif ($token===';')
        {
          // If the token is the semicolon, then we're done with the namespace declaration
          $mode = '';
        }
        elseif ($token==='{')
        {
          throw new LogicException('Bracketed syntax for namespace not supported.');
        }
        else
        {
          throw new LogicException("Unexpected token %s", print_r($token, true));
        }
      }

      // While we're grabbing the class name...
      if ($mode=='class')
      {
        // If the token is a string, it's the name of the class
        if (is_array($token) && $token[0]==T_STRING)
        {
          // Store the token's value as the class name
          $classes[$token[2]] = ['namespace' => $namespace,
                                 'class'     => $token[1],
                                 'line'      => $token[2]];

          $mode = '';
        }
      }
    }

    return $classes;
  }
1250377
protected function getClassFiles()
    {
        $app = $this->laravel;

        $core = $app['config']->get('optimizer.core');

        $files = array_merge($core, $app['config']->get('compile.files', []));

        foreach ($app['config']->get('compile.providers', []) as $provider) {
            $files = array_merge($files, forward_static_call([$provider, 'compiles']));
        }

        return array_filter(array_map('realpath', $files));
    }
1149743
protected function requireClasses()
    {
        foreach ($this->classes as $classPath => $className) {

            $className = '\\' . ltrim($className, '\\');
//            if (preg_match('/dbQuery/', $className)) {
//                trace('sdf');
//            }
            if (file_exists($classPath)
                && !preg_match('/\/api\/generated\//', $className)
                && !preg_match('/activerecord\/dbQuery/', $className)
                && !preg_match('/samson\/activerecord\//', $className)
                && !preg_match('/Field.php$/', $classPath)
                && !preg_match('/Navigation.php$/', $classPath)
                && !preg_match('/TableVirtualCollection.php$/', $classPath)
                && !preg_match('/TableVirtualEntity.php$/', $classPath)
                && !preg_match('/TableVirtualQuery.php$/', $classPath)
                && !class_exists($className)
            ) {
                require_once($classPath);
            }
        }
    }
337288
private function generateClasses()
    {
        foreach($this->ref->getClasses() as $class)
        {
            if($class->isInterface())
            {
                $this->generateInterface($class);
            }
            else if($class->isTrait())
            {
                $this->generateTrait($class);
            }
            else
            {
                $this->generateClass($class);
            }
        }
    }