Finds sources of stored routines.

@param string $sources The value of the sources parameter.

@return string[]
776309
public function findSources(string $sources): array
  {
    $patterns = $this->sourcesToPatterns($sources);

    $sources = [];
    foreach ($patterns as $pattern)
    {
      $tmp     = $this->findSourcesInPattern($pattern);
      $sources = array_merge($sources, $tmp);
    }

    $sources = array_unique($sources);
    sort($sources);

    return $sources;
  }
57663
protected function _getPortableFunctionsList($functions)
    {
        $list = [];
        foreach ($functions as $value) {
            $value = $this->_getPortableFunctionDefinition($value);

            if (! $value) {
                continue;
            }

            $list[] = $value;
        }

        return $list;
    }
537717
public function findAll(array $locations = [])
    {
        if (empty($locations)) {
            $locations = $this->lookupPaths;
        }

        $finder = new Finder;
        $finder->directories()->depth(0)->sortByName()->in($locations);

        return iterator_to_array($finder, true);
    }
236081
protected function findByFilterComponentsSourceSetup( $source )
    {

        // Set source defaults
        if( !( $source & ( self::PERSISTED | self::UNPERSISTED ) ) ) {
            $source += self::PERSISTED + self::UNPERSISTED;
        }

        if( !( $source & ( self::CHANGED | self::UNCHANGED ) ) ) {
            $source += self::CHANGED + self::UNCHANGED;
        }

        if( !( $source & ( self::WITH_CHILDREN | self::NO_CHILDREN ) ) ) {
            $source += self::WITH_CHILDREN;
        }

        if( !( $source & ( Base::DATA | Base::INITIAL ) ) ) {
            $source += Base::DATA;
        }

        return $source;

    }
814257
public function getDataSource(string  $source) : Source
	{
		switch ($source) {
			case 'form':
			case 'forms':
				return $this
					->getDataSources()
					->getFormsDataSource();
				break;
			case 'entry':
			case 'entries':
				return $this
					->getDataSources()
					->getEntryDataSource();
				break;
			case 'entryValue':
			case 'entryValues':
				return $this
					->getDataSources()
					->getEntryValuesDataSource();
		}
	}
1220837
public function getPaths($source)
    {
        $source = $this->cleanSource($source);
        list(, $paths) = $this->parse($source);

        return $paths;
    }
879506
protected function findSources(\SecurityLib\Strength $strength)
    {
        $sources = array();
        foreach ($this->getSources() as $source) {
            if ($strength->compare($source::getStrength()) <= 0 && $source::isSupported()) {
                $sources[] = new $source();
            }
        }

        if (0 === count($sources)) {
            throw new \RuntimeException('Could not find sources');
        }

        return $sources;
    }
53445
private function getMethods($methods)
    {
        $methods = $methods ?? $this->methods;

        if (is_string($methods))
            $methods = (array) $methods;

        return is_array($methods) ? array_map('strtoupper', $methods) : [];
    }
609265
private function processAddSources($sources, $project)
    {
        $groupSources = [];
        foreach ($sources as $source) {
            $dirName = str_replace(\DIRECTORY_SEPARATOR, '/', \dirname($source));
            if (!isset($groupSources[$dirName])) {
                $groupSources[$dirName] = [];
            }
            $groupSources[$dirName][] = basename($source);
        }
        $groups = [];
        foreach ($groupSources as $dirname => $files) {
            $groups[] = 'ADD_SOURCES(configure_module_dirname + "/'.$dirname.'", "'.
                        implode(' ', $files).'", "'.$project.'");';
        }

        return $groups;
    }
106197
public function locateSources(): array
    {
        if (!$this->container->has(ClassesInterface::class)) {
            return [];
        }

        /**
         * @var ClassesInterface $classes
         */
        $classes = $this->container->get(ClassesInterface::class);

        $result = [];
        foreach ($classes->getClasses(RecordSource::class) as $class) {
            $source = $class['name'];
            if ($class['abstract'] || empty($source::RECORD)) {
                continue;
            }

            $result[$source::RECORD] = $source;
        }

        return $result;
    }
298557
public static final function clear(array $Source, $keys): array {
		return count($keys = self::simplify(array_slice(func_get_args(), 1))) > 0 ? (count($keys) > 1
			? array_merge($Source, [$keys[0] => self::clear(self::cast(self::get($Source, $keys[0], [])),
				array_slice($keys, 1))]) : self::except($Source, $keys[0])): $Source;
	}
1056940
private function getAllows(array $methods)
    {
        $allows = [];
        foreach ($methods as $method) {
            if (in_array($method->name, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
                $allows[] = strtoupper(substr($method->name, 2));
            }
        }

        return $allows;
    }
843304
private function findMethodInjections(array $injections)
    {
        $ret = [];
        if (is_array($injections)) {
            foreach ($injections as $injection) {
                if (!isset($injection['method'])){
                    continue;
                }
                if ($injection['method'] !== '__construct__') {
                    $ret[] = $injection;
                }
            }
        }
        return $ret;
    }
1144892
public function getAllPhpFilesFromSources(array $sources) : PhpFileSet
    {
        return array_reduce(
            $sources,
            function (PhpFileSet $set, string $source) {
                return $set->addAll($this->find(new \SplFileInfo($source)));
            },
            new PhpFileSet()
        );
    }
585051
private function findSourcesInPattern(string $pattern): array
  {
    $sources = [];

    $directory = new RecursiveDirectoryIterator(self::getLeadingDir($pattern));
    $directory->setFlags(RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
    $files = new RecursiveIteratorIterator($directory);
    foreach ($files as $fullPath => $file)
    {
      // If the file is a source file with stored routine add it to my sources.
      if ($file->isFile() && SelectorHelper::matchPath($pattern, $fullPath))
      {
        $sources[] = $fullPath;
      }
    }

    return $sources;
  }
1055815
public function getMetadata(array $mappingSources): array
    {
        $mappingSources = $this->normalizeMappingSources($mappingSources);

        $cacheKey = $this->getCacheKey($mappingSources);

        if ($this->cache !== null && $this->cache->has($cacheKey)) {
            return $this->cache->get($cacheKey);
        }

        $metadata = \array_map(
            function (array $mappingSource) {
                return $this->driverFactory->getDriver($mappingSource)->getMetadata();
            },
            $mappingSources
        );
        $metadata = \count($metadata) > 0 ? \array_merge(...$metadata) : [];

        if ($this->cache !== null) {
            $this->cache->set($cacheKey, $metadata);
        }

        return $metadata;
    }
132211
public function loadStoredRoutine(): array
  {
    $this->routineName           = pathinfo($this->sourceFilename, PATHINFO_FILENAME);
    $this->phpStratumOldMetadata = $this->phpStratumMetadata;
    $this->filemtime             = filemtime($this->sourceFilename);

    $load = $this->mustLoadStoredRoutine();
    if ($load)
    {
      $this->io->text(sprintf('Loading routine <dbo>%s</dbo>', OutputFormatter::escape($this->routineName)));

      $this->readSourceCode();
      $this->extractPlaceholders();
      $this->extractDesignationType();
      $this->extractReturnType();
      $this->extractRoutineTypeAndName();
      $this->validateReturnType();
      $this->loadRoutineFile();
      $this->extractBulkInsertTableColumnsInfo();
      $this->extractExtendedParametersInfo();
      $this->extractRoutineParametersInfo();
      $this->extractDocBlockPartsWrapper();
      $this->validateParameterLists();
      $this->updateMetadata();
    }

    return $this->phpStratumMetadata;
  }