Get "namespaced" types

@return array
165972
public static function getTypes()
    {
        return [
            self::TYPE_VCS,
            self::TYPE_GIT,
            self::TYPE_GIT_BITBACKET,
            self::TYPE_GITHUB,
            self::TYPE_GITLAB,
        ];
    }
558907
public function getTypemap()
    {
        $typemap = array();

        foreach ($this->converters as $converter) {
            $typemap[] = array(
                'type_name' => $converter->getTypeName(),
                'type_ns'   => $converter->getTypeNamespace(),
                'from_xml'  => function($input) use ($converter) {
                    return $converter->convertXmlToPhp($input);
                },
                'to_xml'    => function($input) use ($converter) {
                    return $converter->convertPhpToXml($input);
                },
            );
        }

        return $typemap;
    }
18673
protected function findDeclaredFusionNamespaces()
    {
        $namespaces = [];

        $targetDirectory = $this->targetPackageData['path'] . '/Resources/Private';
        if(!is_dir($targetDirectory)) {
            return $namespaces;
        }

        foreach (Files::getRecursiveDirectoryGenerator($targetDirectory, null, true) as $pathAndFilename) {
            $pathInfo = pathinfo($pathAndFilename);
            if (!isset($pathInfo['filename'])) {
                continue;
            }
            if (strpos($pathAndFilename, 'Migrations/Code') !== false) {
                continue;
            }

            if (array_key_exists('extension', $pathInfo) && ($pathInfo['extension'] == 'ts2' || $pathInfo['extension'] == 'fusion')) {
                $namespaceDeclarationMatches = [];
                $count = preg_match_all(
                    '/^namespace:[\\s]*(?P<alias>[\\w\\.]+)[\\s]*\\=[\\s]*(?P<packageKey>[\\w\\.]+)[\\s]*$/um',
                    file_get_contents($pathAndFilename),
                    $namespaceDeclarationMatches,
                    PREG_SET_ORDER
                );
                if ($count > 0) {
                    foreach ($namespaceDeclarationMatches as $match) {
                        if (!array_key_exists($match['alias'], $namespaces)) {
                            $namespaces[$match['alias']] = $match['packageKey'];
                        } else {
                            if ($namespaces[$match['alias']] !== $match['packageKey']) {
                                $this->showWarning(
                                    sprintf(
                                        'Namespace-alias "%s" was declared multiple times for different aliases %s is used',
                                        $match['alias'],
                                        $namespaces[$match['alias']]
                                    )
                                );
                            }
                        }
                    }
                }
            }
        }
        return $namespaces;
    }
1225536
public function getTypes()
    {
        $types = $this->config()->get('types');

        if ($this->allowed_types) {
            // Prioritise local field over global settings
            $allowed_types = $this->allowed_types;
        }
        if ($allowed_types = $this->config()->get('allowed_types')) {
           foreach ($allowed_types as $type) {
                if (!array_key_exists($type, $types)) {
                    user_error("{$type} is not a valid link type");
                }
            }

            foreach (array_diff_key($types, array_flip($allowed_types)) as $key => $value) {
                unset($types[$key]);
            }
        }
        $this->extend('updateTypes', $types);
        return $types;
    }
574624
public function getNamespace()
    {
        if (! is_null($this->namespace)) {
            return $this->namespace;
        }

        $composer = json_decode(file_get_contents(base_path('composer.json')), true);

        foreach ((array) data_get($composer, 'autoload.psr-4') as $namespace => $path) {
            foreach ((array) $path as $pathChoice) {
                if (realpath(app()->path()) == realpath(base_path().'/'.$pathChoice)) {
                    return $this->namespace = $namespace;
                }
            }
        }

        throw new RuntimeException('Unable to detect application namespace.');
    }
918272
public function getNamespaceDefinition() {
        $namespaceDefinition = $this instanceof NamespaceDefinition
            ? $this
            : $this->getFirstAncestor(NamespaceDefinition::class, SourceFileNode::class);

        if ($namespaceDefinition instanceof NamespaceDefinition && !($namespaceDefinition->parent instanceof SourceFileNode)) {
            $namespaceDefinition = $namespaceDefinition->getFirstAncestor(SourceFileNode::class);
        }

        if ($namespaceDefinition === null) {
            // TODO provide a way to throw errors without crashing consumer
            throw new \Exception("Invalid tree - SourceFileNode must always exist at root of tree.");
        }

        $fullStart = $this->getFullStart();
        $lastNamespaceDefinition = null;
        if ($namespaceDefinition instanceof SourceFileNode) {
            foreach ($namespaceDefinition->getChildNodes() as $childNode) {
                if ($childNode instanceof NamespaceDefinition && $childNode->getFullStart() < $fullStart) {
                    $lastNamespaceDefinition = $childNode;
                }
            }
        }

        if ($lastNamespaceDefinition !== null && $lastNamespaceDefinition->compoundStatementOrSemicolon instanceof Token) {
            $namespaceDefinition = $lastNamespaceDefinition;
        } elseif ($namespaceDefinition instanceof SourceFileNode) {
            $namespaceDefinition = null;
        }

        return $namespaceDefinition;
    }
114387
final public function getNamespace(): string
    {
        if (null === $this->namespace) {
            $pos             = strrpos(static::class, '\\');
            $this->namespace = false === $pos ? '' : substr(static::class, 0, $pos);
        }

        return $this->namespace;
    }
1024210
public function getClassesInNamespace(string $namespace)
    {
        $arrOptions = [];

        foreach (get_declared_classes() as $strName) {
            if ($this->container->get('huh.utils.string')->startsWith($strName, $namespace)) {
                $arrOptions[$strName] = $strName;
            }
        }

        asort($arrOptions);

        return $arrOptions;
    }
723974
public function getNamespace()
    {
        if (array_key_exists('namespace', $this->prefs)) {
            return $this->prefs['namespace'];
        }

        if (!$this->getCapability('NAMESPACE')) {
            return self::ERROR_BAD;
        }

        list($code, $response) = $this->execute('NAMESPACE');

        if ($code == self::ERROR_OK && preg_match('/^\* NAMESPACE /', $response)) {
            $response = substr($response, 11);
            $data     = $this->tokenizeResponse($response);
        }

        if (!is_array($data)) {
            return $code;
        }

        $this->prefs['namespace'] = array(
            'personal' => $data[0],
            'other'    => $data[1],
            'shared'   => $data[2],
        );

        return $this->prefs['namespace'];
    }
845237
public function getElementTypes()
    {
        $types = array();

        foreach ($this->elements as $key => $element) {
            $types[$key] = get_class($element);
        }

        return $types;
    }
1138704
public function getSpacesAndContentTypesAsChoices(): array
    {
        $spaces = [];

        foreach ($this->clientsConfig as $clientConfig) {
            /** @var \Contentful\Delivery\Client $client */
            $client = $clientConfig['service'];

            $contentTypes = [];
            foreach ($client->getContentTypes()->getItems() as $contentType) {
                /* @var \Contentful\Delivery\Resource\ContentType $contentType */
                $contentTypes[$contentType->getName()] = $contentType->getId();
            }
            $spaces[$client->getSpace()->getName()] = $contentTypes;
        }

        return $spaces;
    }
754991
public function getControllerNamespaces()
	{
	    $names = [];
	    foreach ($this->controllers as $controller) {
	        $names = array_merge($names, StringHelper::explodeAllPrefixs($controller->getName()));
	        
	        foreach ($controller->getAliases() as $alias) {
	            $names = array_merge($names, StringHelper::explodeAllPrefixs($alias));
	        }
	    }
	    
	    return array_values(array_unique(array_filter($names)));
	}
42042
public function getTypes() {
    // If type hint is set then that is the type of the parameter.
    if ($this->typeHint) {
      if ($this->typeHint instanceof TokenNode) {
        if ($this->typeHint->getType() === T_ARRAY) {
          $docTypes = $this->getDocTypes();
          foreach ($docTypes as $docType) {
            if ($docType !== 'array' && substr($docType, -2) !== '[]') {
              return [$this->typeHint->getText()];
            }
          }
          return $docTypes;
        }
        else {
          return [$this->typeHint->getText()];
        }
      }
      else {
        return [$this->typeHint->getAbsolutePath()];
      }
    }
    return $this->getDocTypes();
  }
1290864
public function getTypes() {
    $typesExport = array();
    foreach ($this->types->toArray() as $key => $type) {
      $typesExport[str_replace(':','.',$key)] = $type;
    }
    return $typesExport;
  }
802599
public static function getTypes()
    {
        $typesList = [];
        foreach (Yii::$app->db->getTableSchema(static::tableName())->columns['type']->enumValues as $type) {
            $typesList[$type] = MeasureHelper::t($type);
        }
        return $typesList;
    }
504655
public function getTypes()
    {
        $classes = parent::getTypes();

        foreach ($classes as $k => &$definition) {

            if (empty($definition[$k]['properties'])) {
                unset($classes[$k]);
                continue;
            }

            $properties = array_filter(array_map(function ($property) {

                if (!empty($property['validation'])) {


                    foreach ($property['validation'] as &$rule){
                        foreach ($rule as $type => &$item) {

                            if ($type === 'Valid') {
                                continue;
                            } else {
                                if (!is_array($item)){
                                    $item = [];
                                }
                                $item['groups'] = ['xsd_rules'];
                            }

                        }
                        unset($item);
                    }
                    unset($rule);

                    return $property['validation'];
                }


                return null;
            }, $definition[$k]['properties']));

            if (empty($properties)) {
                unset($classes[$k]);
                continue;
            }

            $definition[$k] = [
                'properties' => $properties
            ];
        }

        return $classes;
    }
360842
public function getResourceTypes()
    {
        $types = [];
        foreach ($this as $entity) {
            $types[] = $entity->getType();
        }
        return array_unique($types);
    }