Returns redirection for source

@param  string  $source Source url
@return array           array('redirection target', 301|302)
183624
public function getRedirect($source)
    {
        foreach ($this->redirections as $redirection)
        {
            if(false !== ($wildcardPos = strpos($redirection['source'], '*')))
            {
                if(substr($source, 0, $wildcardPos) == substr($redirection['source'], 0, $wildcardPos))
                {
                    return array(
                        rtrim($redirection['target'], '*') . substr($source, $wildcardPos),
                        $redirection['type']
                    );
                }
            }
            else
            {
                if($source == $redirection['source'])
                {
                    return array($redirection['target'], $redirection['type']);
                }
            }
        }
        return null;
    }
368062
private function reformatArray($source)
    {
        $result = array();

        foreach ($source as $data) {
            $result[$data[0]] = (isset($data[1])) ? $data[1] : '';
        }

        return $result;
    }
755922
public function get($source)
    {
        list(, $paths, $path) = $this->parse($source);
        return $this->find($paths, $path);
    }
497585
public function Concat( $source )
	{

		$source = is_array($source) ? $source : ( $source instanceof Queryable ? $source->toList() : iterator_to_array($source) );

		return $this
					->getClone()
					->setRepository( array_merge( $this->repository , $source ) );

	}
382968
private function parse($source)
    {
        $parser = $this->getParser();
        $parser->setPragmas($this->getPragmas());

        return $parser->parse($this->tokenize($source));
    }
1000183
public function getRedirects()
    {
        return array_reduce(iterator_to_array($this->getCommands()), function ($redirect, $value) {
            $redirect += $value['curl']['redirectCount'];

            return $redirect;
        });
    }
851260
private function getFileContents($source)
    {
        $this->assertSourceExists($source);
        $this->assertSourceIsNotFolder($source);
        $content = file_get_contents($source, true);

        $this->assertContentIsProperLoaded($source, $content);
        $this->assertContentIsNotEmpty($source, $content);

        return $content;
    }
1208185
public function glob($source)
    {
        list(, $paths, $path) = $this->parse($source);
        return $this->find($paths, $path, true);
    }
902464
protected function getPackageMigrations($source)
	{
		$files = array_filter($this->files->files($source), function($file)
		{
			return ! starts_with($file, '.');
		});

		sort($files);

		return $files;
	}
113282
public function getFilterByIsChangedCallback( $source )
    {

        $changed = !( $source & self::CHANGED );
        $unchanged = !( $source & self::UNCHANGED );

        if( $changed and $unchanged ) {
            return function() {
                return false;
            };
        }

        if( !$changed and !$unchanged ) {
            return function() {
                return true;
            };
        }

        return function ($entity) use ( $changed ) {
            return $entity->isChanged() !== $changed;
        };

    }
292665
public function redirect($url)
    {
        $location = $this->_request->getBasePath();
        $location = str_replace('//', '/', "{$location}/{$url}");
        $this->_response->setStatusCode(302);
        $header = new GenericHeader('Location', $location);
        $this->_response->getHeaders()->addHeader($header);
        return $this->disableRendering();
    }
81382
public static function directoryDiff($source, $target)
    {
        $sourceFiles = self::globr($source, '*');
        $targetFiles = self::globr($target, '*');

        $sourceFiles = array_map(function ($file) use ($source) {
            return str_replace($source, '', $file);
        }, $sourceFiles);

        $targetFiles = array_map(function ($file) use ($target) {
            return str_replace($target, '', $file);
        }, $targetFiles);

        $diff = array_diff($targetFiles, $sourceFiles);

        return array_values($diff);
    }
244009
protected function connection_redirect($args)
    {
        $host = $args->read_shortstr();
        $this->known_hosts = $args->read_shortstr();
        $this->debug->debug_msg(sprintf(
                'Redirected to [%s], known_hosts [%s]',
                $host,
                $this->known_hosts
            ));

        return $host;
    }
1370745
protected function getDropdownLabelsFromSource($source)
    {
        if (is_a($source, DropdownStrategyInterface::class, true)) {
            /** @var DropdownStrategyInterface $source */
            $source = app($source);
            return $source->labels();
        }

        return false;
    }
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;

    }
773652
public function convert($source)
    {
        $output = [];
        $xpath = new \DOMXPath($source);
        $this->metadata = [];

        /** @var $node \DOMNode */
        foreach ($xpath->query(implode(' | ', $this->nodeMap)) as $node) {
            $output = array_merge($output, $this->convertNode($node));
        }

        $result = ['data' => $output, 'metadata' => $this->metadata];

        return $result;
    }
210909
public function locate($source)
    {
        $sources = [];
        $normalizedSources = [];
        
        // if the wildcard is at the end of the string, it means that we look for a directory
        $endingWithWilCard = substr($source, strlen($source) - 2) === '/*';
        
        if ($endingWithWilCard) {
            $source = substr($source, 0, strlen($source) - 2);
        }
        
        if (is_dir($source) || $endingWithWilCard) {
            $finder = new Finder();
            $finder
                ->files()
                ->in($this->removeLastSlash($source))
            ;
            
            foreach ($finder as $file) {
                $sources[] = $file;
            }
        } else if (strstr($source, '*') !== false) {
            // if the source contains a wildcard, we use it with the finder component
            $sources = $this->getSourcesFromFinder($source);
        } else {
            $sources[] = $source;
        }
        
        // each found sources should be normalized
        foreach ($sources as $source) {
            $normalizedSources[] = $this
                ->normalizer
                ->normalize($source);
        }
        
        return $normalizedSources;
    }