clean ups

This commit is contained in:
Luis Cordova 2013-11-14 10:04:08 -05:00
parent 40d3df9f92
commit cacb40286c
26 changed files with 15 additions and 43 deletions

View file

@ -4,11 +4,9 @@ namespace FOS\ElasticaBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Helper\DialogHelper; use Symfony\Component\Console\Helper\DialogHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
use FOS\ElasticaBundle\IndexManager; use FOS\ElasticaBundle\IndexManager;
use FOS\ElasticaBundle\Provider\ProviderRegistry; use FOS\ElasticaBundle\Provider\ProviderRegistry;
use FOS\ElasticaBundle\Resetter; use FOS\ElasticaBundle\Resetter;

View file

@ -3,11 +3,9 @@
namespace FOS\ElasticaBundle\Command; namespace FOS\ElasticaBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
use FOS\ElasticaBundle\IndexManager; use FOS\ElasticaBundle\IndexManager;
use FOS\ElasticaBundle\Resetter; use FOS\ElasticaBundle\Resetter;

View file

@ -7,7 +7,6 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
use Elastica\Query; use Elastica\Query;
use Elastica\Result; use Elastica\Result;

View file

@ -11,8 +11,6 @@ namespace FOS\ElasticaBundle\Configuration;
*/ */
class Search class Search
{ {
/** @var string */ /** @var string */
public $repositoryClass; public $repositoryClass;
} }

View file

@ -91,6 +91,7 @@ class FOSElasticaExtension extends Extension
* @param ContainerBuilder $container A ContainerBuilder instance * @param ContainerBuilder $container A ContainerBuilder instance
* @param array $clientIdsByName * @param array $clientIdsByName
* @param $defaultClientName * @param $defaultClientName
* @param $serializerConfig
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array * @return array
*/ */
@ -170,6 +171,7 @@ class FOSElasticaExtension extends Extension
* @param $indexName * @param $indexName
* @param $indexId * @param $indexId
* @param array $typePrototypeConfig * @param array $typePrototypeConfig
* @param $serializerConfig
*/ */
protected function loadTypes(array $types, ContainerBuilder $container, $indexName, $indexId, array $typePrototypeConfig, $serializerConfig) protected function loadTypes(array $types, ContainerBuilder $container, $indexName, $indexId, array $typePrototypeConfig, $serializerConfig)
{ {

View file

@ -40,5 +40,4 @@ class RepositoryManager extends BaseManager
return parent::getRepository($realEntityName); return parent::getRepository($realEntityName);
} }
} }

View file

@ -97,6 +97,7 @@ class TransformedFinder implements PaginatedFinderInterface
public function createPaginatorAdapter($query) public function createPaginatorAdapter($query)
{ {
$query = Query::create($query); $query = Query::create($query);
return new TransformedPaginatorAdapter($this->searchable, $query, $this->transformer); return new TransformedPaginatorAdapter($this->searchable, $query, $this->transformer);
} }
} }

View file

@ -5,6 +5,7 @@ namespace FOS\ElasticaBundle\Manager;
use Doctrine\Common\Annotations\Reader; use Doctrine\Common\Annotations\Reader;
use FOS\ElasticaBundle\Finder\FinderInterface; use FOS\ElasticaBundle\Finder\FinderInterface;
use RuntimeException; use RuntimeException;
/** /**
* @author Richard Miller <info@limethinking.co.uk> * @author Richard Miller <info@limethinking.co.uk>
* *
@ -70,11 +71,10 @@ class RepositoryManager implements RepositoryManagerInterface
private function createRepository($entityName) private function createRepository($entityName)
{ {
$repositoryName = $this->getRepositoryName($entityName); if (!class_exists($repositoryName = $this->getRepositoryName($entityName))) {
if (!class_exists($repositoryName)) {
throw new RuntimeException(sprintf('%s repository for %s does not exist', $repositoryName, $entityName)); throw new RuntimeException(sprintf('%s repository for %s does not exist', $repositoryName, $entityName));
} }
return new $repositoryName($this->entities[$entityName]['finder']); return new $repositoryName($this->entities[$entityName]['finder']);
} }
} }

View file

@ -32,5 +32,4 @@ interface RepositoryManagerInterface
* @param string $entityName * @param string $entityName
*/ */
public function getRepository($entityName); public function getRepository($entityName);
} }

View file

@ -3,14 +3,13 @@
namespace FOS\ElasticaBundle\Paginator; namespace FOS\ElasticaBundle\Paginator;
use Pagerfanta\Adapter\AdapterInterface; use Pagerfanta\Adapter\AdapterInterface;
use FOS\ElasticaBundle\Paginator\PaginatorAdapterInterface;
class FantaPaginatorAdapter implements AdapterInterface class FantaPaginatorAdapter implements AdapterInterface
{ {
private $adapter; private $adapter;
/** /**
* @param PaginatorAdapterInterface $adapter * @param \FOS\ElasticaBundle\Paginator\PaginatorAdapterInterface $adapter
*/ */
public function __construct(PaginatorAdapterInterface $adapter) public function __construct(PaginatorAdapterInterface $adapter)
{ {
@ -42,7 +41,7 @@ class FantaPaginatorAdapter implements AdapterInterface
} }
/** /**
* Returns an slice of the results. * Returns a slice of the results.
* *
* @param integer $offset The offset. * @param integer $offset The offset.
* @param integer $length The length. * @param integer $length The length.

View file

@ -2,8 +2,6 @@
namespace FOS\ElasticaBundle\Paginator; namespace FOS\ElasticaBundle\Paginator;
use FOS\ElasticaBundle\Paginator\PartialResultsInterface;
interface PaginatorAdapterInterface interface PaginatorAdapterInterface
{ {
/** /**

View file

@ -5,9 +5,6 @@ namespace FOS\ElasticaBundle\Paginator;
use Elastica\SearchableInterface; use Elastica\SearchableInterface;
use Elastica\Query; use Elastica\Query;
use Elastica\ResultSet; use Elastica\ResultSet;
use FOS\ElasticaBundle\Paginator\PaginatorAdapterInterface;
use FOS\ElasticaBundle\Paginator\RawPartialResults;
use FOS\ElasticaBundle\Paginator\PartialResultsInterface;
use InvalidArgumentException; use InvalidArgumentException;
/** /**
@ -52,6 +49,7 @@ class RawPaginatorAdapter implements PaginatorAdapterInterface
* *
* @param $offset * @param $offset
* @param $itemCountPerPage * @param $itemCountPerPage
* @throws \InvalidArgumentException
* @return ResultSet * @return ResultSet
*/ */
protected function getElasticaResults($offset, $itemCountPerPage) protected function getElasticaResults($offset, $itemCountPerPage)

View file

@ -2,7 +2,6 @@
namespace FOS\ElasticaBundle\Paginator; namespace FOS\ElasticaBundle\Paginator;
use FOS\ElasticaBundle\Paginator\PartialResultsInterface;
use Elastica\ResultSet; use Elastica\ResultSet;
use Elastica\Result; use Elastica\Result;

View file

@ -3,7 +3,6 @@
namespace FOS\ElasticaBundle\Paginator; namespace FOS\ElasticaBundle\Paginator;
use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface; use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
use FOS\ElasticaBundle\Paginator\TransformedPartialResults;
use Elastica\SearchableInterface; use Elastica\SearchableInterface;
use Elastica\Query; use Elastica\Query;

View file

@ -3,7 +3,6 @@
namespace FOS\ElasticaBundle\Paginator; namespace FOS\ElasticaBundle\Paginator;
use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface; use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
use FOS\ElasticaBundle\Paginator\RawPartialResults;
use Elastica\ResultSet; use Elastica\ResultSet;
/** /**

View file

@ -3,7 +3,6 @@
namespace FOS\ElasticaBundle\Provider; namespace FOS\ElasticaBundle\Provider;
use FOS\ElasticaBundle\Persister\ObjectPersisterInterface; use FOS\ElasticaBundle\Persister\ObjectPersisterInterface;
use FOS\ElasticaBundle\Provider\ProviderInterface;
abstract class AbstractProvider implements ProviderInterface abstract class AbstractProvider implements ProviderInterface
{ {

View file

@ -2,8 +2,6 @@
namespace FOS\ElasticaBundle\Provider; namespace FOS\ElasticaBundle\Provider;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;

View file

@ -19,13 +19,13 @@
{% endblock %} {% endblock %}
{% block menu %} {% block menu %}
<span class="label"> <span class="label">
<span class="icon"><img src="{{ asset('bundles/foselastica/images/elastica.png') }}" alt="" /></span> <span class="icon"><img src="{{ asset('bundles/foselastica/images/elastica.png') }}" alt="" /></span>
<strong>Elastica</strong> <strong>Elastica</strong>
<span class="count"> <span class="count">
<span>{{ collector.querycount }}</span> <span>{{ collector.querycount }}</span>
</span> </span>
</span> </span>
{% endblock %} {% endblock %}
{% block panel %} {% block panel %}

View file

@ -8,9 +8,7 @@ use JMS\Serializer\SerializerInterface;
class Callback class Callback
{ {
protected $serializer; protected $serializer;
protected $groups; protected $groups;
protected $version; protected $version;
public function setSerializer($serializer) public function setSerializer($serializer)

View file

@ -9,7 +9,6 @@ use FOS\ElasticaBundle\DataCollector\ElasticaDataCollector;
*/ */
class ElasticaDataCollectorTest extends \PHPUnit_Framework_TestCase class ElasticaDataCollectorTest extends \PHPUnit_Framework_TestCase
{ {
public function testCorrectAmountOfQueries() public function testCorrectAmountOfQueries()
{ {
/** @var $requestMock \PHPUnit_Framework_MockObject_MockObject|\Symfony\Component\HttpFoundation\Request */ /** @var $requestMock \PHPUnit_Framework_MockObject_MockObject|\Symfony\Component\HttpFoundation\Request */
@ -93,5 +92,4 @@ class ElasticaDataCollectorTest extends \PHPUnit_Framework_TestCase
$elasticaDataCollector->collect($requestMock, $responseMock); $elasticaDataCollector->collect($requestMock, $responseMock);
$this->assertEquals(30, $elasticaDataCollector->getTime()); $this->assertEquals(30, $elasticaDataCollector->getTime());
} }
} }

View file

@ -156,5 +156,4 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
$repository = $manager->getRepository($shortEntityName); $repository = $manager->getRepository($shortEntityName);
$this->assertInstanceOf('FOS\ElasticaBundle\Repository', $repository); $this->assertInstanceOf('FOS\ElasticaBundle\Repository', $repository);
} }
} }

View file

@ -86,5 +86,4 @@ class ElasticaLoggerTest extends \PHPUnit_Framework_TestCase
$elasticaLogger->logQuery($path, $method, $data, $time); $elasticaLogger->logQuery($path, $method, $data, $time);
} }
} }

View file

@ -97,5 +97,4 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
$manager->addEntity($entityName, $finderMock, 'FOS\ElasticaBundle\Tests\MissingRepository'); $manager->addEntity($entityName, $finderMock, 'FOS\ElasticaBundle\Tests\MissingRepository');
$manager->getRepository('Missing Entity'); $manager->getRepository('Missing Entity');
} }
} }

View file

@ -9,7 +9,6 @@ use FOS\ElasticaBundle\Repository;
*/ */
class RepositoryTest extends \PHPUnit_Framework_TestCase class RepositoryTest extends \PHPUnit_Framework_TestCase
{ {
public function testThatFindCallsFindOnFinder() public function testThatFindCallsFindOnFinder()
{ {
$testQuery = 'Test Query'; $testQuery = 'Test Query';
@ -75,5 +74,4 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
$repository = new Repository($finderMock); $repository = new Repository($finderMock);
$repository->findHybrid($testQuery, $testLimit); $repository->findHybrid($testQuery, $testLimit);
} }
} }

View file

@ -119,5 +119,4 @@ class POPO
class POPO2 extends POPO class POPO2 extends POPO
{ {
} }

View file

@ -149,5 +149,4 @@ class ModelToElasticaAutoTransformer implements ModelToElasticaTransformerInterf
return $value; return $value;
} }
} }