| @@ -3,8 +3,6 @@ | ||
| 3 | 3 | namespace Alpixel\Bundle\ElasticaUtilsBundle\Twig\Extension; | 
| 4 | 4 | |
| 5 | 5 | use Alpixel\Bundle\ElasticaUtilsBundle\Services\ElasticaQuerySorter; | 
| 6 | -use Symfony\Component\DependencyInjection\ContainerBuilder; | |
| 7 | -use Symfony\Component\Yaml\Parser; | |
| 8 | 6 | |
| 9 | 7 | class ElasticaSorterExtension extends \Twig_Extension | 
| 10 | 8 |  { | 
| @@ -91,7 +91,7 @@ | ||
| 91 | 91 | } | 
| 92 | 92 | |
| 93 | 93 | |
| 94 | - protected function addSort(Query &$query) | |
| 94 | + protected function addSort(Query & $query) | |
| 95 | 95 |      { | 
| 96 | 96 |          $sortBy    = explode('-', $this->fetchData('sortBy')); | 
| 97 | 97 |          $sortOrder = $this->fetchData('sortOrder'); | 
| @@ -113,6 +113,9 @@ discard block | ||
| 113 | 113 | return $query; | 
| 114 | 114 | } | 
| 115 | 115 | |
| 116 | + /** | |
| 117 | + * @param string $key | |
| 118 | + */ | |
| 116 | 119 | public function fetchData($key) | 
| 117 | 120 |      { | 
| 118 | 121 | $pageKey = (!empty($this->request)) ? $this->request->getPathInfo() : null; | 
| @@ -148,7 +151,7 @@ discard block | ||
| 148 | 151 | /** | 
| 149 | 152 | * Gets the value of session. | 
| 150 | 153 | * | 
| 151 | - * @return mixed | |
| 154 | + * @return Session | |
| 152 | 155 | */ | 
| 153 | 156 | public function getSession() | 
| 154 | 157 |      { | 
| @@ -158,7 +161,7 @@ discard block | ||
| 158 | 161 | /** | 
| 159 | 162 | * Gets the value of request. | 
| 160 | 163 | * | 
| 161 | - * @return mixed | |
| 164 | + * @return Request|null | |
| 162 | 165 | */ | 
| 163 | 166 | public function getRequest() | 
| 164 | 167 |      { | 
| @@ -175,6 +178,9 @@ discard block | ||
| 175 | 178 | return $this->sessionData; | 
| 176 | 179 | } | 
| 177 | 180 | |
| 181 | + /** | |
| 182 | + * @return integer | |
| 183 | + */ | |
| 178 | 184 | public function getItemPerPage() | 
| 179 | 185 |      { | 
| 180 | 186 | return $this->configuration['item_per_page']; | 
| @@ -3,7 +3,6 @@ | ||
| 3 | 3 | namespace Alpixel\Bundle\ElasticaQuerySorterBundle\Services; | 
| 4 | 4 | |
| 5 | 5 | use Elastica\Query; | 
| 6 | -use Elastica\Query\AbstractQuery; | |
| 7 | 6 | use FOS\ElasticaBundle\Repository; | 
| 8 | 7 | use Symfony\Component\HttpFoundation\Request; | 
| 9 | 8 | use Symfony\Component\HttpFoundation\RequestStack; | 
| @@ -22,6 +22,6 @@ | ||
| 22 | 22 | |
| 23 | 23 | public function registerContainerConfiguration(LoaderInterface $loader) | 
| 24 | 24 |      { | 
| 25 | - $loader->load(__DIR__.'/../config/config.yml'); | |
| 25 | + $loader->load(__DIR__ . '/../config/config.yml'); | |
| 26 | 26 | } | 
| 27 | 27 | } | 
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | $_SERVER['env'] = 'test'; | 
| 4 | 4 | use Doctrine\Common\Annotations\AnnotationRegistry; | 
| 5 | 5 | |
| 6 | -if (!is_file($loaderFile = __DIR__.'/../vendor/autoload.php')) { | |
| 6 | +if (!is_file($loaderFile = __DIR__ . '/../vendor/autoload.php')) { | |
| 7 | 7 |      throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?'); | 
| 8 | 8 | } | 
| 9 | 9 | $loader = require $loaderFile; | 
| @@ -22,7 +22,7 @@ | ||
| 22 | 22 | $configuration = new Configuration(); | 
| 23 | 23 | $config = $this->processConfiguration($configuration, $configs); | 
| 24 | 24 | |
| 25 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | |
| 25 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); | |
| 26 | 26 |          $loader->load('services.yml'); | 
| 27 | 27 | } | 
| 28 | 28 | } |