当前位置: 首页>>代码示例>>PHP>>正文


PHP FACTFinder\Loader类代码示例

本文整理汇总了PHP中FACTFinder\Loader的典型用法代码示例。如果您正苦于以下问题:PHP Loader类的具体用法?PHP Loader怎么用?PHP Loader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Loader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testConstructionFromParameters

 public function testConstructionFromParameters()
 {
     $parameters = FF::getInstance('Util\\Parameters');
     $parameters['query'] = 'bmx';
     $parameters['seoPath'] = '/bmx-bike/q';
     $parameters['channel'] = 'de';
     $parameters['advisorStatus'] = '2-_0_0';
     $parameters['productsPerPage'] = 12;
     $parameters['filterBrand'] = 'KHE';
     $parameters['filterColor'] = 'green';
     $parameters['sortPrice'] = 'asc';
     $parameters['catalog'] = 'true';
     $parameters['followSearch'] = '9832';
     $searchParameters = FF::getInstance('Data\\SearchParameters', $parameters);
     $this->assertEquals('bmx', $searchParameters->getQuery());
     $this->assertEquals('/bmx-bike/q', $searchParameters->getSeoPath());
     $this->assertEquals('de', $searchParameters->getChannel());
     $this->assertEquals('2-_0_0', $searchParameters->getAdvisorStatus());
     $this->assertEquals(12, $searchParameters->getProductsPerPage());
     $this->assertEquals(1, $searchParameters->getCurrentPage());
     $this->assertEquals(9832, $searchParameters->getFollowSearch());
     $this->assertEquals(array('Brand' => 'KHE', 'Color' => 'green'), $searchParameters->getFilters());
     $this->assertEquals(array('Price' => 'asc'), $searchParameters->getSortings());
     $this->assertTrue($searchParameters->isNavigationEnabled());
 }
开发者ID:fact-finder,项目名称:fact-finder-php-library,代码行数:25,代码来源:SearchParametersTest.php

示例2: testServerToClientConversion

 public function testServerToClientConversion()
 {
     $serverParameters = FF::getInstance('Util\\Parameters', array('query' => 'test', 'username' => 'admin', 'format' => 'xml', 'xml' => 'true', 'timestamp' => '123456789', 'password' => 'test', 'channel' => 'de', 'productsPerPage' => '12'));
     $expectedClientParameters = array('keywords' => 'test', 'productsPerPage' => '12');
     $actualClientParameters = $this->parametersConverter->convertServerToClientParameters($serverParameters);
     $this->assertEquals($expectedClientParameters, $actualClientParameters->getArray());
 }
开发者ID:s-diez,项目名称:FACT-Finder-PHP-Library,代码行数:7,代码来源:ParametersConverterTest.php

示例3: convert

 /**
  * Converts data from $inCharset to $outCharset.
  * @param mixed $data If a string is given, it's encoding will be converted.
  *        If an associative array is given, keys and values will be
  *        converted recursively. All other data types will be returned
  *        unchanged.
  * @return mixed
  */
 protected function convert($inCharset, $outCharset, $data)
 {
     if ($data instanceof Parameters) {
         if (count($data->getArray()) == 1 && current(array_keys($data->getArray())) == '') {
             $result = $data->getArray();
         } else {
             $result = FF::getInstance('Util\\Parameters', $this->convert($inCharset, $outCharset, $data->getArray()));
         }
     } else {
         if (is_array($data)) {
             $result = array();
             foreach ($data as $k => $v) {
                 $k = $this->convert($inCharset, $outCharset, $k);
                 $result[$k] = $this->convert($inCharset, $outCharset, $v);
             }
         } else {
             if (is_string($data)) {
                 $result = $this->convertString($inCharset, $outCharset, $data);
             } else {
                 $result = $data;
             }
         }
     }
     return $result;
 }
开发者ID:TWT-Interactive,项目名称:FACT-Finder-PHP-Library,代码行数:33,代码来源:AbstractEncodingConverter.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     $this->requestParser = FF::getInstance('Core\\Client\\RequestParser', self::$dic['loggerClass'], self::$dic['configuration'], self::$dic['encodingConverter']);
     $loggerClass = self::$dic['loggerClass'];
     $this->log = $loggerClass::getLogger(__CLASS__);
 }
开发者ID:s-diez,项目名称:FACT-Finder-PHP-Library,代码行数:7,代码来源:RequestParserTest.php

示例5: createSuggestions

 private function createSuggestions()
 {
     $suggestions = array();
     $this->useJsonResponseContentProcessor();
     if (isset($this->parameters['format'])) {
         $oldFormat = $this->parameters['format'];
     }
     $this->parameters['format'] = 'json';
     $suggestData = $this->getResponseContent();
     if (!empty($suggestData)) {
         foreach ($suggestData as $suggestQueryData) {
             $suggestLink = $this->convertServerQueryToClientUrl($suggestQueryData['searchParams']);
             if (isset($suggestQueryData['attributes']) && is_array($suggestQueryData['attributes'])) {
                 $suggestAttributes = $suggestQueryData['attributes'];
             } else {
                 $suggestAttributes = array();
             }
             $suggestions[] = FF::getInstance('Data\\SuggestQuery', $suggestQueryData['name'], $suggestLink, $suggestQueryData['hitCount'], $suggestQueryData['type'], $suggestQueryData['image'], $suggestQueryData['refKey'], $suggestAttributes);
         }
     }
     if (isset($oldFormat)) {
         $this->parameters['format'] = $oldFormat;
     }
     return $suggestions;
 }
开发者ID:TWT-Interactive,项目名称:FACT-Finder-PHP-Library,代码行数:25,代码来源:Suggest.php

示例6: setUp

 public function setUp()
 {
     parent::setUp();
     $this->statusClass = FF::getClassName('Data\\ArticleNumberSearchStatus');
     $loggerClass = self::$dic['loggerClass'];
     $this->log = $loggerClass::getLogger(__CLASS__);
 }
开发者ID:s-diez,项目名称:FACT-Finder-PHP-Library,代码行数:7,代码来源:ArticleNumberSearchStatusTest.php

示例7: setUp

 public function setUp()
 {
     parent::setUp();
     $loggerClass = self::$dic['loggerClass'];
     $this->log = $loggerClass::getLogger(__CLASS__);
     $this->adapter = FF::getInstance('Adapter\\Recommendation', self::$dic['loggerClass'], self::$dic['configuration'], self::$dic['request'], self::$dic['clientUrlBuilder']);
 }
开发者ID:TWT-Interactive,项目名称:FACT-Finder-PHP-Library,代码行数:7,代码来源:RecommendationTest.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     $this->typeClass = FF::getClassName('Data\\FilterType');
     $loggerClass = self::$dic['loggerClass'];
     $this->log = $loggerClass::getLogger(__CLASS__);
 }
开发者ID:fact-finder,项目名称:fact-finder-php-library,代码行数:7,代码来源:FilterTypeTest.php

示例9: __construct

 public function __construct($loggerClass, \FACTFinder\Core\ConfigurationInterface $configuration, \FACTFinder\Core\Client\RequestParser $requestParser, \FACTFinder\Core\AbstractEncodingConverter $encodingConverter = null)
 {
     $this->log = $loggerClass::getLogger(__CLASS__);
     $this->parametersConverter = FF::getInstance('Core\\ParametersConverter', $loggerClass, $configuration);
     $this->requestParser = $requestParser;
     $this->encodingConverter = $encodingConverter;
 }
开发者ID:fact-finder,项目名称:fact-finder-php-library,代码行数:7,代码来源:UrlBuilder.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     $this->directionClass = FF::getClassName('Data\\SortingDirection');
     $loggerClass = self::$dic['loggerClass'];
     $this->log = $loggerClass::getLogger(__CLASS__);
 }
开发者ID:fact-finder,项目名称:fact-finder-php-library,代码行数:7,代码来源:SortingDirectionTest.php

示例11: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $logClass = FF::getClassName('Util\\Log4PhpLogger');
     $logClass::configure(RESOURCES_DIR . DS . 'log4php.xml');
     // Set up dependency injection container (Pimple)
     self::$dic = FF::getInstance('Util\\Pimple');
     self::$dic['loggerClass'] = $logClass;
     if (strpos(static::class, 'ArrayConfiguration')) {
         self::$dic['configuration'] = function ($c) {
             $config = (include RESOURCES_DIR . DS . 'config.php');
             return FF::getInstance('Core\\ArrayConfiguration', $config, 'test');
         };
     } else {
         self::$dic['configuration'] = function ($c) {
             return FF::getInstance('Core\\XmlConfiguration', RESOURCES_DIR . DS . 'config.xml', 'test');
         };
     }
     // $this cannot be passed into closures before PHP 5.4
     //$that = $this;
     self::$dic['encodingConverter'] = function ($c) {
         if (extension_loaded('iconv')) {
             $type = 'Core\\IConvEncodingConverter';
         } else {
             if (function_exists('utf8_encode') && function_exists('utf8_decode')) {
                 $type = 'Core\\Utf8EncodingConverter';
             } else {
                 return;
             }
         }
         //TODO: Skip test if no conversion method is available.
         //    $that->markTestSkipped('No encoding conversion available.');
         return FF::getInstance($type, $c['loggerClass'], $c['configuration']);
     };
     self::$dic['serverUrlBuilder'] = function ($c) {
         return FF::getInstance('Core\\Server\\UrlBuilder', $c['loggerClass'], $c['configuration']);
     };
     self::$dic['clientUrlBuilder'] = function ($c) {
         return FF::getInstance('Core\\Client\\UrlBuilder', $c['loggerClass'], $c['configuration'], $c['requestParser'], $c['encodingConverter']);
     };
     self::$dic['curlStub'] = function ($c) {
         return FF::getInstance('Util\\CurlStub');
     };
     self::$dic['dataProvider'] = function ($c) {
         $dataProvider = FF::getInstance('Core\\Server\\FileSystemDataProvider', $c['loggerClass'], $c['configuration']);
         $dataProvider->setFileLocation(RESOURCES_DIR . DS . 'responses');
         return $dataProvider;
     };
     self::$dic['requestFactory'] = function ($c) {
         $requestFactory = FF::getInstance('Core\\Server\\FileSystemRequestFactory', $c['loggerClass'], $c['configuration'], $c['requestParser']->getRequestParameters());
         $requestFactory->setFileLocation(RESOURCES_DIR . DS . 'responses');
         return $requestFactory;
     };
     self::$dic['request'] = self::$dic->factory(function ($c) {
         return $c['requestFactory']->getRequest();
     });
     self::$dic['requestParser'] = function ($c) {
         return FF::getInstance('Core\\Client\\RequestParser', $c['loggerClass'], $c['configuration'], $c['encodingConverter']);
     };
 }
开发者ID:fact-finder,项目名称:fact-finder-php-library,代码行数:59,代码来源:BaseTestCase.php

示例12: hasFileNameChanged

 private function hasFileNameChanged($id, $newFileName)
 {
     $connectionData = $this->connectionData[$id];
     if (FF::isInstanceOf($connectionData->getResponse(), 'Core\\Server\\NullResponse')) {
         return true;
     }
     return $newFileName != $connectionData->getPreviousUrl();
 }
开发者ID:s-diez,项目名称:FACT-Finder-PHP-Library,代码行数:8,代码来源:FileSystemDataProvider.php

示例13: testResponse

 public function testResponse()
 {
     $response = FF::getInstance('Core\\Server\\NullResponse');
     $this->assertEquals('', $response->getContent());
     $this->assertEquals(0, $response->getHttpCode());
     $this->assertEquals(0, $response->getConnectionErrorCode());
     $this->assertEquals('', $response->getConnectionError());
 }
开发者ID:s-diez,项目名称:FACT-Finder-PHP-Library,代码行数:8,代码来源:NullResponseTest.php

示例14: testResponse

 public function testResponse()
 {
     $response = FF::getInstance('Core\\Server\\Response', 'response content', 200, CURLE_OK, 'CURLE_OK');
     $this->assertEquals('response content', $response->getContent());
     $this->assertEquals(200, $response->getHttpCode());
     $this->assertEquals(CURLE_OK, $response->getConnectionErrorCode());
     $this->assertEquals('CURLE_OK', $response->getConnectionError());
 }
开发者ID:s-diez,项目名称:FACT-Finder-PHP-Library,代码行数:8,代码来源:ResponseTest.php

示例15: setUp

 public function setUp()
 {
     parent::setUp();
     $this->factory = FF::getInstance('Core\\Server\\FileSystemRequestFactory', self::$dic['loggerClass'], self::$dic['configuration'], FF::getInstance('Util\\Parameters'));
     $loggerClass = self::$dic['loggerClass'];
     $this->log = $loggerClass::getLogger(__CLASS__);
     $this->configuration = self::$dic['configuration'];
 }
开发者ID:s-diez,项目名称:FACT-Finder-PHP-Library,代码行数:8,代码来源:FileSystemRequestFactoryTest.php


注:本文中的FACTFinder\Loader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。