Fix CS from scrutiniser-ci
This commit is contained in:
parent
c4210a5c6d
commit
1d5fe44ca4
|
@ -77,6 +77,9 @@ class TypeConfig
|
||||||
return $this->getConfig('search_analyzer');
|
return $this->getConfig('search_analyzer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $key
|
||||||
|
*/
|
||||||
private function getConfig($key)
|
private function getConfig($key)
|
||||||
{
|
{
|
||||||
return isset($this->config[$key]) ?
|
return isset($this->config[$key]) ?
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Configuration implements ConfigurationInterface
|
||||||
/**
|
/**
|
||||||
* Generates the configuration tree.
|
* Generates the configuration tree.
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\Config\Definition\NodeInterface
|
* @return TreeBuilder
|
||||||
*/
|
*/
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder()
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,7 +82,7 @@ class FOSElasticaExtension extends Extension
|
||||||
/**
|
/**
|
||||||
* @param array $config
|
* @param array $config
|
||||||
* @param ContainerBuilder $container
|
* @param ContainerBuilder $container
|
||||||
* @return Configuration|null|\Symfony\Component\Config\Definition\ConfigurationInterface
|
* @return Configuration
|
||||||
*/
|
*/
|
||||||
public function getConfiguration(array $config, ContainerBuilder $container)
|
public function getConfiguration(array $config, ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
|
@ -523,7 +523,7 @@ class FOSElasticaExtension extends Extension
|
||||||
*
|
*
|
||||||
* @param array $typeConfig
|
* @param array $typeConfig
|
||||||
* @param ContainerBuilder $container
|
* @param ContainerBuilder $container
|
||||||
* @param $elasticaToModelId
|
* @param string $elasticaToModelId
|
||||||
* @param Reference $typeRef
|
* @param Reference $typeRef
|
||||||
* @param string $indexName
|
* @param string $indexName
|
||||||
* @param string $typeName
|
* @param string $typeName
|
||||||
|
|
|
@ -174,27 +174,30 @@ class Listener implements EventSubscriber
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate through scheduled actions before flushing to emulate 2.x behavior. Note that the ElasticSearch index
|
* Iterate through scheduled actions before flushing to emulate 2.x behavior.
|
||||||
* will fall out of sync with the source data in the event of a crash during flush.
|
* Note that the ElasticSearch index will fall out of sync with the source
|
||||||
|
* data in the event of a crash during flush.
|
||||||
|
*
|
||||||
|
* This method is only called in legacy configurations of the listener.
|
||||||
*/
|
*/
|
||||||
public function preFlush(EventArgs $eventArgs)
|
public function preFlush()
|
||||||
{
|
{
|
||||||
$this->persistScheduled();
|
$this->persistScheduled();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterating through scheduled actions *after* flushing ensures that the ElasticSearch index will be affected
|
* Iterating through scheduled actions *after* flushing ensures that the
|
||||||
* only if the query is successful
|
* ElasticSearch index will be affected only if the query is successful.
|
||||||
*/
|
*/
|
||||||
public function postFlush(EventArgs $eventArgs)
|
public function postFlush()
|
||||||
{
|
{
|
||||||
$this->persistScheduled();
|
$this->persistScheduled();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record the specified identifier to delete. Do not need to entire object.
|
* Record the specified identifier to delete. Do not need to entire object.
|
||||||
* @param mixed $object
|
*
|
||||||
* @return mixed
|
* @param object $object
|
||||||
*/
|
*/
|
||||||
protected function scheduleForDeletion($object)
|
protected function scheduleForDeletion($object)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace FOS\ElasticaBundle\Doctrine\ORM;
|
namespace FOS\ElasticaBundle\Doctrine\ORM;
|
||||||
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Elastica\Exception\Bulk\ResponseException as BulkResponseException;
|
|
||||||
use FOS\ElasticaBundle\Doctrine\AbstractProvider;
|
use FOS\ElasticaBundle\Doctrine\AbstractProvider;
|
||||||
use FOS\ElasticaBundle\Exception\InvalidArgumentTypeException;
|
use FOS\ElasticaBundle\Exception\InvalidArgumentTypeException;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace FOS\ElasticaBundle\Elastica;
|
namespace FOS\ElasticaBundle\Elastica;
|
||||||
|
|
||||||
use Elastica\Index as BaseIndex;
|
use Elastica\Index as BaseIndex;
|
||||||
use Elastica\Type;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden Elastica Index class that provides dynamic index name changes.
|
* Overridden Elastica Index class that provides dynamic index name changes.
|
||||||
|
@ -32,6 +31,9 @@ class Index extends BaseIndex
|
||||||
return $this->originalName ?: $this->_name;
|
return $this->originalName ?: $this->_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $type
|
||||||
|
*/
|
||||||
public function getType($type)
|
public function getType($type)
|
||||||
{
|
{
|
||||||
if (isset($this->typeCache[$type])) {
|
if (isset($this->typeCache[$type])) {
|
||||||
|
|
|
@ -5,9 +5,7 @@ namespace FOS\ElasticaBundle\Index;
|
||||||
use Elastica\Index;
|
use Elastica\Index;
|
||||||
use Elastica\Exception\ResponseException;
|
use Elastica\Exception\ResponseException;
|
||||||
use Elastica\Type\Mapping;
|
use Elastica\Type\Mapping;
|
||||||
use FOS\ElasticaBundle\Configuration\IndexConfig;
|
|
||||||
use FOS\ElasticaBundle\Configuration\ConfigManager;
|
use FOS\ElasticaBundle\Configuration\ConfigManager;
|
||||||
use FOS\ElasticaBundle\Elastica\Client;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes and recreates indexes
|
* Deletes and recreates indexes
|
||||||
|
@ -110,7 +108,7 @@ class Resetter
|
||||||
/**
|
/**
|
||||||
* A command run when a population has finished.
|
* A command run when a population has finished.
|
||||||
*
|
*
|
||||||
* @param $indexName
|
* @param string $indexName
|
||||||
*/
|
*/
|
||||||
public function postPopulate($indexName)
|
public function postPopulate($indexName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,9 @@ class RepositoryManager implements RepositoryManagerInterface
|
||||||
return 'FOS\ElasticaBundle\Repository';
|
return 'FOS\ElasticaBundle\Repository';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $entityName
|
||||||
|
*/
|
||||||
private function createRepository($entityName)
|
private function createRepository($entityName)
|
||||||
{
|
{
|
||||||
if (!class_exists($repositoryName = $this->getRepositoryName($entityName))) {
|
if (!class_exists($repositoryName = $this->getRepositoryName($entityName))) {
|
||||||
|
|
|
@ -54,8 +54,8 @@ class RawPaginatorAdapter implements PaginatorAdapterInterface
|
||||||
/**
|
/**
|
||||||
* Returns the paginated results.
|
* Returns the paginated results.
|
||||||
*
|
*
|
||||||
* @param $offset
|
* @param integer $offset
|
||||||
* @param $itemCountPerPage
|
* @param integer $itemCountPerPage
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return ResultSet
|
* @return ResultSet
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,7 +4,6 @@ namespace FOS\ElasticaBundle\Persister;
|
||||||
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Elastica\Exception\BulkException;
|
use Elastica\Exception\BulkException;
|
||||||
use Elastica\Exception\NotFoundException;
|
|
||||||
use FOS\ElasticaBundle\Transformer\ModelToElasticaTransformerInterface;
|
use FOS\ElasticaBundle\Transformer\ModelToElasticaTransformerInterface;
|
||||||
use Elastica\Type;
|
use Elastica\Type;
|
||||||
use Elastica\Document;
|
use Elastica\Document;
|
||||||
|
|
|
@ -17,6 +17,9 @@ class ObjectSerializerPersister extends ObjectPersister
|
||||||
{
|
{
|
||||||
protected $serializer;
|
protected $serializer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $objectClass
|
||||||
|
*/
|
||||||
public function __construct(Type $type, ModelToElasticaTransformerInterface $transformer, $objectClass, $serializer)
|
public function __construct(Type $type, ModelToElasticaTransformerInterface $transformer, $objectClass, $serializer)
|
||||||
{
|
{
|
||||||
parent::__construct($type, $transformer, $objectClass, array());
|
parent::__construct($type, $transformer, $objectClass, array());
|
||||||
|
|
|
@ -170,6 +170,7 @@ class ElasticaToModelTransformer implements ElasticaToModelTransformerInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Util/Inflector.php
|
* @see https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Util/Inflector.php
|
||||||
|
* @param string $str
|
||||||
*/
|
*/
|
||||||
private function camelize($str)
|
private function camelize($str)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,21 +19,43 @@ class Repository
|
||||||
$this->finder = $finder;
|
$this->finder = $finder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $query
|
||||||
|
* @param integer $limit
|
||||||
|
* @param array $options
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function find($query, $limit = null, $options = array())
|
public function find($query, $limit = null, $options = array())
|
||||||
{
|
{
|
||||||
return $this->finder->find($query, $limit, $options);
|
return $this->finder->find($query, $limit, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $query
|
||||||
|
* @param integer $limit
|
||||||
|
* @param array $options
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function findHybrid($query, $limit = null, $options = array())
|
public function findHybrid($query, $limit = null, $options = array())
|
||||||
{
|
{
|
||||||
return $this->finder->findHybrid($query, $limit, $options);
|
return $this->finder->findHybrid($query, $limit, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $query
|
||||||
|
* @param array $options
|
||||||
|
* @return \Pagerfanta\Pagerfanta
|
||||||
|
*/
|
||||||
public function findPaginated($query, $options = array())
|
public function findPaginated($query, $options = array())
|
||||||
{
|
{
|
||||||
return $this->finder->findPaginated($query, $options);
|
return $this->finder->findPaginated($query, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $query
|
||||||
|
* @param array $options
|
||||||
|
* @return Paginator\PaginatorAdapterInterface
|
||||||
|
*/
|
||||||
public function createPaginatorAdapter($query, $options = array())
|
public function createPaginatorAdapter($query, $options = array())
|
||||||
{
|
{
|
||||||
return $this->finder->createPaginatorAdapter($query, $options);
|
return $this->finder->createPaginatorAdapter($query, $options);
|
||||||
|
|
|
@ -173,8 +173,14 @@ abstract class ListenerTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
abstract protected function getListenerClass();
|
abstract protected function getListenerClass();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
abstract protected function getObjectManagerClass();
|
abstract protected function getObjectManagerClass();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
abstract protected function getClassMetadataClass();
|
abstract protected function getClassMetadataClass();
|
||||||
|
|
||||||
private function createLifecycleEventArgs()
|
private function createLifecycleEventArgs()
|
||||||
|
@ -205,6 +211,11 @@ abstract class ListenerTest extends \PHPUnit_Framework_TestCase
|
||||||
->getMock();
|
->getMock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Listener\Entity $object
|
||||||
|
* @param string $indexName
|
||||||
|
* @param string $typeName
|
||||||
|
*/
|
||||||
private function getMockPersister($object, $indexName, $typeName)
|
private function getMockPersister($object, $indexName, $typeName)
|
||||||
{
|
{
|
||||||
$mock = $this->getMockBuilder('FOS\ElasticaBundle\Persister\ObjectPersister')
|
$mock = $this->getMockBuilder('FOS\ElasticaBundle\Persister\ObjectPersister')
|
||||||
|
@ -235,6 +246,12 @@ abstract class ListenerTest extends \PHPUnit_Framework_TestCase
|
||||||
return $mock;
|
return $mock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $indexName
|
||||||
|
* @param string $typeName
|
||||||
|
* @param Listener\Entity $object
|
||||||
|
* @param boolean $return
|
||||||
|
*/
|
||||||
private function getMockIndexable($indexName, $typeName, $object, $return = null)
|
private function getMockIndexable($indexName, $typeName, $object, $return = null)
|
||||||
{
|
{
|
||||||
$mock = $this->getMock('FOS\ElasticaBundle\Provider\IndexableInterface');
|
$mock = $this->getMock('FOS\ElasticaBundle\Provider\IndexableInterface');
|
||||||
|
@ -256,6 +273,9 @@ class Entity
|
||||||
{
|
{
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param integer $id
|
||||||
|
*/
|
||||||
public function __construct($id)
|
public function __construct($id)
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace FOS\ElasticaBundle\Tests\Resetter;
|
namespace FOS\ElasticaBundle\Tests\Resetter;
|
||||||
|
|
||||||
use FOS\ElasticaBundle\FOSElasticaBundle;
|
use FOS\ElasticaBundle\FOSElasticaBundle;
|
||||||
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
|
||||||
|
|
||||||
class FOSElasticaBundleTest extends \PHPUnit_Framework_TestCase
|
class FOSElasticaBundleTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
namespace FOS\ElasticaBundle\Tests\ObjectSerializerPersister;
|
namespace FOS\ElasticaBundle\Tests\ObjectSerializerPersister;
|
||||||
|
|
||||||
use FOS\ElasticaBundle\Persister\ObjectPersister;
|
|
||||||
use FOS\ElasticaBundle\Persister\ObjectSerializerPersister;
|
use FOS\ElasticaBundle\Persister\ObjectSerializerPersister;
|
||||||
use FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer;
|
|
||||||
use FOS\ElasticaBundle\Transformer\ModelToElasticaIdentifierTransformer;
|
use FOS\ElasticaBundle\Transformer\ModelToElasticaIdentifierTransformer;
|
||||||
use Symfony\Component\PropertyAccess\PropertyAccess;
|
use Symfony\Component\PropertyAccess\PropertyAccess;
|
||||||
|
|
||||||
|
|
|
@ -157,6 +157,9 @@ class POPO
|
||||||
public $id;
|
public $id;
|
||||||
public $data;
|
public $data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param integer $id
|
||||||
|
*/
|
||||||
public function __construct($id, $data)
|
public function __construct($id, $data)
|
||||||
{
|
{
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
|
|
Loading…
Reference in a new issue