Gets the info from a source (list of urls)

@param string|Request $request The url or a request with the source url
@param null|array     $config  Options passed to the adapter

@return false|Sources\SourceInterface
965488
public static function createSource($request, array $config = null)
    {
        $request = self::getRequest($request, $config);

        if (!$request->isValid()) {
            return false;
        }

        //If is a xml feed (rss/atom)
        if (Sources\Feed::check($request)) {
            $sources = new Sources\Feed($request);

            if ($sources->isValid()) {
                return $sources;
            }
        }

        return false;
    }
1357436
protected function getRouteFromRequest(Request $request)
    {
        $attributes = $request->attributes->get('_route_params');

        if (isset($attributes[RouteObjectInterface::ROUTE_OBJECT])
            && ($attributes[RouteObjectInterface::ROUTE_OBJECT] instanceof RouteInterface)
        ) {
            return $attributes[RouteObjectInterface::ROUTE_OBJECT];
        }

        return null;
    }
243509
protected function getTagcacheConfig(Request $request)
    {
        if(!($tagcacheConfig = $this->loadAnnotationConfig($request))){
            return null;
        }

        if (!$tagcacheConfig->getCache()) {
            return null;
        }

        if($tagcacheConfig->getExpress() !== null){
            $key = $this->parseExpressKey($tagcacheConfig->getExpress(), $request);
            $tagcacheConfig->setKey($key);
        }

        if ($tagcacheConfig->getKey() === null) {
            $tagcacheConfig->setKey($request->attributes->get('_controller'));
        }

        return $tagcacheConfig;
    }
706340
public function getCollection(Request $request)
    {
        /** @var \SymfonyId\AdminBundle\Configuration\ConfiguratorFactory $configuratorFactory */
        $configuratorFactory = $this->getConfiguratorFactory($this->getClassName());
        /** @var CrudConfigurator $crudConfigurator */
        $crudConfigurator = $configuratorFactory->getConfigurator(CrudConfigurator::class);

        $this->isGrantedOr404Error($crudConfigurator, Constants::ACTION_READ);

        $reflectionModel = new \ReflectionClass($crudConfigurator->getCrud()->getModelClass());
        /** @var \SymfonyId\AdminBundle\Annotation\Driver $driver */
        $driver = $this->get('symfonyid.admin.manager.driver_finder')->findDriverForClass($reflectionModel->getName());
        /** @var \SymfonyId\AdminBundle\Crud\CrudOperationHandler $crudOperationHandler */
        $crudOperationHandler = $this->get('symfonyid.admin.crud.crud_operation_handler');

        $requestParam = new RequestParameter($request);

        /*
         * Convert from KnpPaginator to Pagerfanta.
         */
        /** @var \Knp\Component\Pager\Pagination\AbstractPagination $knpPaginator */
        $knpPaginator = $crudOperationHandler->paginateResult($driver, $reflectionModel->getName(), $requestParam->getPage(), $requestParam->getLimit());
        $pagerAdapter = new ArrayAdapter($knpPaginator->getItems());

        $pager = new Pagerfanta($pagerAdapter);
        $pager->setCurrentPage($requestParam->getPage());
        $pager->setMaxPerPage($requestParam->getLimit());

        $embed = strtolower($reflectionModel->getShortName().'s');
        $pagerFactory = new PagerfantaFactory();
        $representation = $pagerFactory->createRepresentation(
            $pager,
            new Route($request->get('_route'), $requestParam->toArray()),
            new CollectionRepresentation($pager->getCurrentPageResults(), $embed, $embed)
        );

        return $this->createResponse($representation);
    }
179189
protected function getData(Request $request)
    {
        $data = null;
        if ($request->query->has('dataId')) {
            $data = $this->get(DataRepository::class)->find($request->query->get('dataId'));
        }

        return $data;
    }
272494
protected function getName($config, $url)
    {
        $parts = explode('.', $url);
        if (count($parts) < 2) {
            return false;
        }

        $path = $config->cachePath($parts[(count($parts) - 1)]);
        if (empty($path)) {
            return false;
        }

        $root = str_replace('\\', '/', WWW_ROOT);
        $path = str_replace('\\', '/', $path);
        $path = str_replace($root, '', $path);
        if (strpos($url, $path) !== 0) {
            return false;
        }

        return str_replace($path, '', $url);
    }
1290887
public function getSearchInputRepository($config = null, $data = null)
    {
        return new Repository\SearchInputRepository($this->getRequest(), $config, $data);
    }
196529
public static function get(string $config)
  {
    $conf = explode('.', $config);
    $path = DEPConfig::$appdir . 'config' . DIRECTORY_SEPARATOR . $conf[0] . '.php';

    $service = require $path;
    unset($conf[0]);

    foreach($conf as $setting) {
      if (isset($service[$setting])) {
        $service = $service[$setting];
      } else {
        return null;
      }
    }

    return $service;
  }
616307
public function load(Config $config)
    {
        $parsed = [];

        if ($this->isFile($this->getPath())) {
            $parsed = $this->parse($this->fetch($this->getPath()));
        }

        if (!is_array($parsed)) {
            $parsed = [];
        }

        $this->apply($parsed, $config);
    }
1059426
public function parseUrl($config)
    {
        $info = [];

        $info['driver'] = $config['driver'];
        $info['hostname'] = $config['host'];
        $info['port'] = isset($config['port']) ? $config['port'] : '';
        $info['username'] = isset($config['username']) ? $config['username'] : null;
        $info['password'] = isset($config['password']) ? $config['password'] : null;
        $info['database'] = isset($config['database']) ? $config['database'] : null;
        $info['charset'] = (isset($config['charset'])) ? $config['charset'] : '';
        $info['collation'] = (isset($config['collation'])) ? $config['collation'] : '';
        $info['prefix'] = (isset($config['prefix'])) ? $config['prefix'] : '';

        if ($info['hostname'] == 'unix(') {
            $socketDb = null;
            $socketDb = $info['hostname'].'/'.$info['database'];
            if (preg_match_all('/^unix\((.+)\)\/(.+)$/', $socketDb, $matches) > 0) {
                $info['hostname'] = $matches[1][0];
                $info['database'] = $matches[2][0];
            }
        }

        self::setConnectionConfig($info['database'], $info);

        return  $info;
    }
4197
protected function getHttpClient( $config )
	{
		$guzzleConfig = Arr::get( $config, 'guzzle', [] );

		return new HttpClient( Arr::add( $guzzleConfig, 'connect_timeout', 60 ) );
	}
72327
public function parse(Request $request)
    {
        foreach($this->rules as $url => $items)
        {
            $result = $this->checkUrl($request, $url, $params);
            if($result['result'] || $result['resultIgnoreCase'])
            {
                foreach($items as $item)
                {
                    if(
                        ($result['result'] || ($this->ignoreCase || $item['annotation']->ignoreCase)) &&
                        $this->checkMethod($request, $item['annotation']->method) &&
                        $this->checkDomain($request, $item['annotation']->domain, $domainParams) &&
                        $this->checkParamsGet($request, $item['annotation']->paramsGet) &&
                        $this->checkParamsPost($request, $item['annotation']->paramsPost) &&
                        $this->checkHeader($request, $item['annotation']->header) &&
                        $this->checkRequestMime($request, $item['annotation']->requestMime)
                    )
                    {
                        $params = array_merge($params, $domainParams);
                        return [
                            'params'        => $params,
                            'callable'      => $this->parseCallable($params, $item['callable']),
                            'middlewares'   => $item['middlewares'] ?? [],
                            'wsConfig'      => $item['wsConfig'],
                        ];
                    }
                }
            }
        }
        return null;
    }
547951
private static function _mainDispatcher($uri, $config) {
        $uriInfo = self::analizeUri();
        $uri = $uriInfo['uri'];
        $uriItems = explode('/', $uri);
        $attributes = [];

        foreach ($config['routes'] as $routePattern => $className) {
            if (preg_match('#' . $routePattern . '#', $uri)) {
                $class = $className;
                $itemCount = count(explode('/', str_replace('\\/', '/', $routePattern)));

                for ($i = 0; $i < $itemCount; $i++) {
                    unset($uriItems[$i]);
                }
                $attributes = array_values($uriItems);
                break;
            }
        }

        if (!$class) {
            $class = self::_getController($uri, 'App\\');
            $classUri = self::_getControllerBaseUri($class);
            
            if(strpos($uri, $classUri) === 0 && strlen($uri) > strlen($classUri)) {
                $attributesUri = substr($uri, strlen($classUri)+1);
                $attributes = explode('/', $attributesUri);
            }
        }
        
        return [
            'class' => self::fixNamespace($class ? $class : self::_getController($uri, 'App\\')),
            'method' => strtolower($_SERVER['REQUEST_METHOD']),
            'attributes' => $attributes
        ];
    }
457775
public static function get($key,$config)
    {
        static::initGet($key,$config);
        if(file_exists(static::$path )){
            /**
             * 获取数据
             */
            static:: $data = unserialize(file_get_contents(static::$path));

            if(static:: $data['period'] >time() || static:: $data['period']==0 ){
                $data = static:: $data['data'];
                /**
                 * 清除 static  信息
                 * 防止数据错误
                 */
                static::staticEmpty();
                return $data;
            }
            /**
             * 删除
             */
            unlink(static::$path);
        }
        /**
         * 清除 static  信息
         * 防止数据错误
         */
        static::staticEmpty();
        return NULL;
    }
401729
protected function getRequestConfig(array $config) : array
    {
        if (!empty($this->defaultRequestOptions)) {
            $config = array_replace_recursive($this->defaultRequestOptions, $config);
        }

        return $config;
    }
788538
private function getSiteId($config)
    {
        $result = $this->siteId;
        if ($this->useSiteId) {
            $result = $config->get(Option::SITE_ID);
        }

        return $result;
    }
291953
public function config($config = null)
    {
        if (is_array($config)) {
            $this->_config = $config;
        } elseif (is_string($config)) {
            if (!empty($this->_config[$config])) {
                return $this->_config[$config];
            }

            return false;
        }

        return $this->_config;
    }