diff --git a/Command/PopulateCommand.php b/Command/PopulateCommand.php
index f17ca4c7c..611165843 100644
--- a/Command/PopulateCommand.php
+++ b/Command/PopulateCommand.php
@@ -13,7 +13,7 @@
use FOS\ElasticaBundle\Provider\ProviderInterface;
/**
- * Populate the search index
+ * Populate the search index.
*/
class PopulateCommand extends ContainerAwareCommand
{
@@ -118,7 +118,7 @@ private function populateIndex(OutputInterface $output, $index, $reset, $options
$providers = $this->providerRegistry->getIndexProviders($index);
foreach ($providers as $type => $provider) {
- $loggerClosure = function($message) use ($output, $index, $type) {
+ $loggerClosure = function ($message) use ($output, $index, $type) {
$output->writeln(sprintf('Populating %s/%s, %s', $index, $type, $message));
};
@@ -146,7 +146,7 @@ private function populateIndexType(OutputInterface $output, $index, $type, $rese
$this->resetter->resetIndexType($index, $type);
}
- $loggerClosure = function($message) use ($output, $index, $type) {
+ $loggerClosure = function ($message) use ($output, $index, $type) {
$output->writeln(sprintf('Populating %s/%s, %s', $index, $type, $message));
};
diff --git a/Command/ResetCommand.php b/Command/ResetCommand.php
index ce05e96f3..85c548378 100755
--- a/Command/ResetCommand.php
+++ b/Command/ResetCommand.php
@@ -10,7 +10,7 @@
use FOS\ElasticaBundle\Resetter;
/**
- * Reset search indexes
+ * Reset search indexes.
*/
class ResetCommand extends ContainerAwareCommand
{
diff --git a/Command/SearchCommand.php b/Command/SearchCommand.php
index ec7cfb73e..11183deb7 100644
--- a/Command/SearchCommand.php
+++ b/Command/SearchCommand.php
@@ -11,7 +11,7 @@
use Elastica\Result;
/**
- * Searches a type
+ * Searches a type.
*/
class SearchCommand extends ContainerAwareCommand
{
diff --git a/Configuration/IndexConfig.php b/Configuration/IndexConfig.php
index 7416424b8..749b10d76 100644
--- a/Configuration/IndexConfig.php
+++ b/Configuration/IndexConfig.php
@@ -53,9 +53,9 @@ class IndexConfig
/**
* Constructor expects an array as generated by the Container Configuration builder.
*
- * @param string $name
+ * @param string $name
* @param TypeConfig[] $types
- * @param array $config
+ * @param array $config
*/
public function __construct($name, array $types, array $config)
{
@@ -92,7 +92,9 @@ public function getSettings()
/**
* @param string $typeName
+ *
* @return TypeConfig
+ *
* @throws \InvalidArgumentException
*/
public function getType($typeName)
diff --git a/Configuration/ManagerInterface.php b/Configuration/ManagerInterface.php
index 96d510f3a..742df1beb 100644
--- a/Configuration/ManagerInterface.php
+++ b/Configuration/ManagerInterface.php
@@ -20,6 +20,7 @@ interface ManagerInterface
* Returns configuration for an index.
*
* @param $index
+ *
* @return IndexConfig
*/
public function getIndexConfiguration($index);
@@ -36,6 +37,7 @@ public function getIndexNames();
*
* @param string $index
* @param string $type
+ *
* @return TypeConfig
*/
public function getTypeConfiguration($index, $type);
diff --git a/Configuration/Search.php b/Configuration/Search.php
index 1306f92ce..1d046c003 100644
--- a/Configuration/Search.php
+++ b/Configuration/Search.php
@@ -17,9 +17,10 @@
* Annotation class for setting search repository.
*
* @Annotation
+ *
* @deprecated Use FOS\ElasticaBundle\Annotation\Search instead
* @Target("CLASS")
*/
class Search extends BaseSearch
{
-}
+}
diff --git a/Configuration/Source/ContainerSource.php b/Configuration/Source/ContainerSource.php
index abcdf1b39..25e6f8688 100644
--- a/Configuration/Source/ContainerSource.php
+++ b/Configuration/Source/ContainerSource.php
@@ -57,6 +57,7 @@ public function getConfiguration()
* Builds TypeConfig objects for each type.
*
* @param array $config
+ *
* @return array
*/
protected function getTypes($config)
diff --git a/Configuration/Source/SourceInterface.php b/Configuration/Source/SourceInterface.php
index 34e9901fb..05a64d010 100644
--- a/Configuration/Source/SourceInterface.php
+++ b/Configuration/Source/SourceInterface.php
@@ -23,4 +23,4 @@ interface SourceInterface
* @return \FOS\ElasticaBundle\Configuration\IndexConfig[]
*/
public function getConfiguration();
-}
+}
diff --git a/DependencyInjection/Compiler/ConfigSourcePass.php b/DependencyInjection/Compiler/ConfigSourcePass.php
index b35a66509..92a248902 100644
--- a/DependencyInjection/Compiler/ConfigSourcePass.php
+++ b/DependencyInjection/Compiler/ConfigSourcePass.php
@@ -33,4 +33,4 @@ public function process(ContainerBuilder $container)
$container->getDefinition('fos_elastica.config_manager')->replaceArgument(0, $sources);
}
-}
+}
diff --git a/DependencyInjection/Compiler/RegisterProvidersPass.php b/DependencyInjection/Compiler/RegisterProvidersPass.php
index c6c9e6e47..4fd25b021 100644
--- a/DependencyInjection/Compiler/RegisterProvidersPass.php
+++ b/DependencyInjection/Compiler/RegisterProvidersPass.php
@@ -55,6 +55,7 @@ public function process(ContainerBuilder $container)
* Returns whether the class implements ProviderInterface.
*
* @param string $class
+ *
* @return boolean
*/
private function isProviderImplementation($class)
diff --git a/DependencyInjection/Compiler/TransformerPass.php b/DependencyInjection/Compiler/TransformerPass.php
index 4281d0ba0..596c73274 100644
--- a/DependencyInjection/Compiler/TransformerPass.php
+++ b/DependencyInjection/Compiler/TransformerPass.php
@@ -31,7 +31,7 @@ public function process(ContainerBuilder $container)
throw new InvalidArgumentException('The Transformer must have both a type and an index defined.');
}
- $transformers[$tag['index']][$tag['type']]= new Reference($id);
+ $transformers[$tag['index']][$tag['type']] = new Reference($id);
}
}
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 0b0127762..78886f144 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -63,7 +63,7 @@ public function getConfigTreeBuilder()
}
/**
- * Adds the configuration for the "clients" key
+ * Adds the configuration for the "clients" key.
*/
private function addClientsSection(ArrayNodeDefinition $rootNode)
{
@@ -76,8 +76,8 @@ private function addClientsSection(ArrayNodeDefinition $rootNode)
->performNoDeepMerging()
// BC - Renaming 'servers' node to 'connections'
->beforeNormalization()
- ->ifTrue(function($v) { return isset($v['servers']); })
- ->then(function($v) {
+ ->ifTrue(function ($v) { return isset($v['servers']); })
+ ->then(function ($v) {
$v['connections'] = $v['servers'];
unset($v['servers']);
@@ -99,7 +99,7 @@ private function addClientsSection(ArrayNodeDefinition $rootNode)
->ifTrue(function ($v) { return is_array($v) && !array_key_exists('connections', $v); })
->then(function ($v) {
return array(
- 'connections' => array($v)
+ 'connections' => array($v),
);
})
->end()
@@ -111,8 +111,8 @@ private function addClientsSection(ArrayNodeDefinition $rootNode)
->children()
->scalarNode('url')
->validate()
- ->ifTrue(function($url) { return $url && substr($url, -1) !== '/'; })
- ->then(function($url) { return $url.'/'; })
+ ->ifTrue(function ($url) { return $url && substr($url, -1) !== '/'; })
+ ->then(function ($url) { return $url.'/'; })
->end()
->end()
->scalarNode('host')->end()
@@ -143,7 +143,7 @@ private function addClientsSection(ArrayNodeDefinition $rootNode)
}
/**
- * Adds the configuration for the "indexes" key
+ * Adds the configuration for the "indexes" key.
*/
private function addIndexesSection(ArrayNodeDefinition $rootNode)
{
@@ -198,8 +198,8 @@ protected function getTypesNode()
->end()
// BC - Renaming 'mappings' node to 'properties'
->beforeNormalization()
- ->ifTrue(function($v) { return array_key_exists('mappings', $v); })
- ->then(function($v) {
+ ->ifTrue(function ($v) { return array_key_exists('mappings', $v); })
+ ->then(function ($v) {
$v['properties'] = $v['mappings'];
unset($v['mappings']);
@@ -419,7 +419,7 @@ protected function getParentNode()
}
/**
- * Returns the array node used for "_all"
+ * Returns the array node used for "_all".
*/
protected function getAllNode()
{
@@ -438,7 +438,7 @@ protected function getAllNode()
}
/**
- * Returns the array node used for "_timestamp"
+ * Returns the array node used for "_timestamp".
*/
protected function getTimestampNode()
{
@@ -459,7 +459,7 @@ protected function getTimestampNode()
}
/**
- * Returns the array node used for "_ttl"
+ * Returns the array node used for "_ttl".
*/
protected function getTtlNode()
{
@@ -488,9 +488,9 @@ protected function getPersistenceNode()
$node
->validate()
- ->ifTrue(function($v) { return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['listener']); })
+ ->ifTrue(function ($v) { return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['listener']); })
->thenInvalid('Propel doesn\'t support listeners')
- ->ifTrue(function($v) { return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['repository']); })
+ ->ifTrue(function ($v) { return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['repository']); })
->thenInvalid('Propel doesn\'t support the "repository" parameter')
->end()
->children()
diff --git a/DependencyInjection/FOSElasticaExtension.php b/DependencyInjection/FOSElasticaExtension.php
index 5d30739d0..9f502e705 100644
--- a/DependencyInjection/FOSElasticaExtension.php
+++ b/DependencyInjection/FOSElasticaExtension.php
@@ -80,8 +80,9 @@ public function load(array $configs, ContainerBuilder $container)
}
/**
- * @param array $config
+ * @param array $config
* @param ContainerBuilder $container
+ *
* @return Configuration
*/
public function getConfiguration(array $config, ContainerBuilder $container)
@@ -92,8 +93,9 @@ public function getConfiguration(array $config, ContainerBuilder $container)
/**
* Loads the configured clients.
*
- * @param array $clients An array of clients configurations
+ * @param array $clients An array of clients configurations
* @param ContainerBuilder $container A ContainerBuilder instance
+ *
* @return array
*/
private function loadClients(array $clients, ContainerBuilder $container)
@@ -114,7 +116,7 @@ private function loadClients(array $clients, ContainerBuilder $container)
$this->clients[$name] = array(
'id' => $clientId,
- 'reference' => new Reference($clientId)
+ 'reference' => new Reference($clientId),
);
}
}
@@ -122,9 +124,11 @@ private function loadClients(array $clients, ContainerBuilder $container)
/**
* Loads the configured indexes.
*
- * @param array $indexes An array of indexes configurations
+ * @param array $indexes An array of indexes configurations
* @param ContainerBuilder $container A ContainerBuilder instance
+ *
* @throws \InvalidArgumentException
+ *
* @return array
*/
private function loadIndexes(array $indexes, ContainerBuilder $container)
@@ -133,7 +137,7 @@ private function loadIndexes(array $indexes, ContainerBuilder $container)
foreach ($indexes as $name => $index) {
$indexId = sprintf('fos_elastica.index.%s', $name);
- $indexName = isset($index['index_name']) ? $index['index_name']: $name;
+ $indexName = isset($index['index_name']) ? $index['index_name'] : $name;
$indexDef = new DefinitionDecorator('fos_elastica.index_prototype');
$indexDef->replaceArgument(0, $indexName);
@@ -173,8 +177,9 @@ private function loadIndexes(array $indexes, ContainerBuilder $container)
* Loads the configured index finders.
*
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
- * @param string $name The index name
- * @param Reference $index Reference to the related index
+ * @param string $name The index name
+ * @param Reference $index Reference to the related index
+ *
* @return string
*/
private function loadIndexFinder(ContainerBuilder $container, $name, Reference $index)
@@ -197,10 +202,10 @@ private function loadIndexFinder(ContainerBuilder $container, $name, Reference $
/**
* Loads the configured types.
*
- * @param array $types
+ * @param array $types
* @param ContainerBuilder $container
- * @param array $indexConfig
- * @param array $indexableCallbacks
+ * @param array $indexConfig
+ * @param array $indexableCallbacks
*/
private function loadTypes(array $types, ContainerBuilder $container, array $indexConfig, array &$indexableCallbacks)
{
@@ -277,13 +282,13 @@ private function loadTypes(array $types, ContainerBuilder $container, array $ind
}
/**
- * Loads the optional provider and finder for a type
+ * Loads the optional provider and finder for a type.
*
- * @param array $typeConfig
+ * @param array $typeConfig
* @param ContainerBuilder $container
- * @param Reference $typeRef
- * @param string $indexName
- * @param string $typeName
+ * @param Reference $typeRef
+ * @param string $indexName
+ * @param string $typeName
*/
private function loadTypePersistenceIntegration(array $typeConfig, ContainerBuilder $container, Reference $typeRef, $indexName, $typeName)
{
@@ -307,10 +312,11 @@ private function loadTypePersistenceIntegration(array $typeConfig, ContainerBuil
/**
* Creates and loads an ElasticaToModelTransformer.
*
- * @param array $typeConfig
+ * @param array $typeConfig
* @param ContainerBuilder $container
- * @param string $indexName
- * @param string $typeName
+ * @param string $indexName
+ * @param string $typeName
+ *
* @return string
*/
private function loadElasticaToModelTransformer(array $typeConfig, ContainerBuilder $container, $indexName, $typeName)
@@ -342,10 +348,11 @@ private function loadElasticaToModelTransformer(array $typeConfig, ContainerBuil
/**
* Creates and loads a ModelToElasticaTransformer for an index/type.
*
- * @param array $typeConfig
+ * @param array $typeConfig
* @param ContainerBuilder $container
- * @param string $indexName
- * @param string $typeName
+ * @param string $indexName
+ * @param string $typeName
+ *
* @return string
*/
private function loadModelToElasticaTransformer(array $typeConfig, ContainerBuilder $container, $indexName, $typeName)
@@ -361,7 +368,7 @@ private function loadModelToElasticaTransformer(array $typeConfig, ContainerBuil
$serviceId = sprintf('fos_elastica.model_to_elastica_transformer.%s.%s', $indexName, $typeName);
$serviceDef = new DefinitionDecorator($abstractId);
$serviceDef->replaceArgument(0, array(
- 'identifier' => $typeConfig['identifier']
+ 'identifier' => $typeConfig['identifier'],
));
$container->setDefinition($serviceId, $serviceDef);
@@ -371,12 +378,13 @@ private function loadModelToElasticaTransformer(array $typeConfig, ContainerBuil
/**
* Creates and loads an object persister for a type.
*
- * @param array $typeConfig
- * @param Reference $typeRef
+ * @param array $typeConfig
+ * @param Reference $typeRef
* @param ContainerBuilder $container
- * @param string $indexName
- * @param string $typeName
- * @param string $transformerId
+ * @param string $indexName
+ * @param string $typeName
+ * @param string $transformerId
+ *
* @return string
*/
private function loadObjectPersister(array $typeConfig, Reference $typeRef, ContainerBuilder $container, $indexName, $typeName, $transformerId)
@@ -395,7 +403,7 @@ private function loadObjectPersister(array $typeConfig, Reference $typeRef, Cont
$abstractId = 'fos_elastica.object_persister';
$mapping = $this->indexConfigs[$indexName]['types'][$typeName]['mapping'];
$argument = $mapping['properties'];
- if(isset($mapping['_parent'])){
+ if (isset($mapping['_parent'])) {
$argument['_parent'] = $mapping['_parent'];
}
$arguments[] = $argument;
@@ -415,11 +423,12 @@ private function loadObjectPersister(array $typeConfig, Reference $typeRef, Cont
/**
* Loads a provider for a type.
*
- * @param array $typeConfig
+ * @param array $typeConfig
* @param ContainerBuilder $container
- * @param string $objectPersisterId
- * @param string $indexName
- * @param string $typeName
+ * @param string $objectPersisterId
+ * @param string $indexName
+ * @param string $typeName
+ *
* @return string
*/
private function loadTypeProvider(array $typeConfig, ContainerBuilder $container, $objectPersisterId, $indexName, $typeName)
@@ -432,7 +441,7 @@ private function loadTypeProvider(array $typeConfig, ContainerBuilder $container
* index and type names were "prototype" and a driver, respectively.
*/
$providerId = sprintf('fos_elastica.provider.%s.%s', $indexName, $typeName);
- $providerDef = new DefinitionDecorator('fos_elastica.provider.prototype.' . $typeConfig['driver']);
+ $providerDef = new DefinitionDecorator('fos_elastica.provider.prototype.'.$typeConfig['driver']);
$providerDef->addTag('fos_elastica.provider', array('index' => $indexName, 'type' => $typeName));
$providerDef->replaceArgument(0, new Reference($objectPersisterId));
$providerDef->replaceArgument(2, $typeConfig['model']);
@@ -449,11 +458,12 @@ private function loadTypeProvider(array $typeConfig, ContainerBuilder $container
/**
* Loads doctrine listeners to handle indexing of new or updated objects.
*
- * @param array $typeConfig
+ * @param array $typeConfig
* @param ContainerBuilder $container
- * @param string $objectPersisterId
- * @param string $indexName
- * @param string $typeName
+ * @param string $objectPersisterId
+ * @param string $indexName
+ * @param string $typeName
+ *
* @return string
*/
private function loadTypeListener(array $typeConfig, ContainerBuilder $container, $objectPersisterId, $indexName, $typeName)
@@ -490,7 +500,7 @@ private function loadTypeListener(array $typeConfig, ContainerBuilder $container
}
/**
- * Map Elastica to Doctrine events for the current driver
+ * Map Elastica to Doctrine events for the current driver.
*/
private function getDoctrineEvents(array $typeConfig)
{
@@ -511,7 +521,7 @@ private function getDoctrineEvents(array $typeConfig)
'insert' => array(constant($eventsClass.'::postPersist')),
'update' => array(constant($eventsClass.'::postUpdate')),
'delete' => array(constant($eventsClass.'::preRemove')),
- 'flush' => array($typeConfig['listener']['immediate'] ? constant($eventsClass.'::preFlush') : constant($eventsClass.'::postFlush'))
+ 'flush' => array($typeConfig['listener']['immediate'] ? constant($eventsClass.'::preFlush') : constant($eventsClass.'::postFlush')),
);
foreach ($eventMapping as $event => $doctrineEvents) {
@@ -526,12 +536,13 @@ private function getDoctrineEvents(array $typeConfig)
/**
* Loads a Type specific Finder.
*
- * @param array $typeConfig
+ * @param array $typeConfig
* @param ContainerBuilder $container
- * @param string $elasticaToModelId
- * @param Reference $typeRef
- * @param string $indexName
- * @param string $typeName
+ * @param string $elasticaToModelId
+ * @param Reference $typeRef
+ * @param string $indexName
+ * @param string $typeName
+ *
* @return string
*/
private function loadTypeFinder(array $typeConfig, ContainerBuilder $container, $elasticaToModelId, Reference $typeRef, $indexName, $typeName)
@@ -558,7 +569,7 @@ private function loadTypeFinder(array $typeConfig, ContainerBuilder $container,
}
/**
- * Loads the index manager
+ * Loads the index manager.
*
* @param ContainerBuilder $container
**/
@@ -576,7 +587,7 @@ private function loadIndexManager(ContainerBuilder $container)
* Makes sure a specific driver has been loaded.
*
* @param ContainerBuilder $container
- * @param string $driver
+ * @param string $driver
*/
private function loadDriver(ContainerBuilder $container, $driver)
{
@@ -592,7 +603,7 @@ private function loadDriver(ContainerBuilder $container, $driver)
/**
* Loads and configures the serializer prototype.
*
- * @param array $config
+ * @param array $config
* @param ContainerBuilder $container
*/
private function loadSerializer($config, ContainerBuilder $container)
@@ -611,7 +622,7 @@ private function loadSerializer($config, ContainerBuilder $container)
/**
* Creates a default manager alias for defined default manager or the first loaded driver.
*
- * @param string $defaultManager
+ * @param string $defaultManager
* @param ContainerBuilder $container
*/
private function createDefaultManagerAlias($defaultManager, ContainerBuilder $container)
@@ -635,7 +646,9 @@ private function createDefaultManagerAlias($defaultManager, ContainerBuilder $co
* Returns a reference to a client given its configured name.
*
* @param string $clientName
+ *
* @return Reference
+ *
* @throws \InvalidArgumentException
*/
private function getClient($clientName)
diff --git a/Doctrine/AbstractElasticaToModelTransformer.php b/Doctrine/AbstractElasticaToModelTransformer.php
index 96f73bd8f..a9afb22ff 100755
--- a/Doctrine/AbstractElasticaToModelTransformer.php
+++ b/Doctrine/AbstractElasticaToModelTransformer.php
@@ -10,24 +10,24 @@
/**
* Maps Elastica documents with Doctrine objects
* This mapper assumes an exact match between
- * elastica documents ids and doctrine object ids
+ * elastica documents ids and doctrine object ids.
*/
abstract class AbstractElasticaToModelTransformer implements ElasticaToModelTransformerInterface
{
/**
- * Manager registry
+ * Manager registry.
*/
protected $registry = null;
/**
- * Class of the model to map to the elastica documents
+ * Class of the model to map to the elastica documents.
*
* @var string
*/
protected $objectClass = null;
/**
- * Optional parameters
+ * Optional parameters.
*
* @var array
*/
@@ -39,18 +39,18 @@ abstract class AbstractElasticaToModelTransformer implements ElasticaToModelTran
);
/**
- * PropertyAccessor instance
+ * PropertyAccessor instance.
*
* @var PropertyAccessorInterface
*/
protected $propertyAccessor;
/**
- * Instantiates a new Mapper
+ * Instantiates a new Mapper.
*
* @param object $registry
* @param string $objectClass
- * @param array $options
+ * @param array $options
*/
public function __construct($registry, $objectClass, array $options = array())
{
@@ -70,7 +70,7 @@ public function getObjectClass()
}
/**
- * Set the PropertyAccessor
+ * Set the PropertyAccessor.
*
* @param PropertyAccessorInterface $propertyAccessor
*/
@@ -81,10 +81,12 @@ public function setPropertyAccessor(PropertyAccessorInterface $propertyAccessor)
/**
* Transforms an array of elastica objects into an array of
- * model objects fetched from the doctrine repository
+ * model objects fetched from the doctrine repository.
*
* @param array $elasticaObjects of elastica objects
+ *
* @throws \RuntimeException
+ *
* @return array
**/
public function transform(array $elasticaObjects)
@@ -110,8 +112,7 @@ public function transform(array $elasticaObjects)
$idPos = array_flip($ids);
$identifier = $this->options['identifier'];
$propertyAccessor = $this->propertyAccessor;
- usort($objects, function($a, $b) use ($idPos, $identifier, $propertyAccessor)
- {
+ usort($objects, function ($a, $b) use ($idPos, $identifier, $propertyAccessor) {
return $idPos[$propertyAccessor->getValue($a, $identifier)] > $idPos[$propertyAccessor->getValue($b, $identifier)];
});
@@ -145,11 +146,12 @@ public function getIdentifierField()
}
/**
- * Fetches objects by theses identifier values
+ * Fetches objects by theses identifier values.
+ *
+ * @param array $identifierValues ids values
+ * @param Boolean $hydrate whether or not to hydrate the objects, false returns arrays
*
- * @param array $identifierValues ids values
- * @param Boolean $hydrate whether or not to hydrate the objects, false returns arrays
* @return array of objects or arrays
*/
- protected abstract function findByIdentifiers(array $identifierValues, $hydrate);
+ abstract protected function findByIdentifiers(array $identifierValues, $hydrate);
}
diff --git a/Doctrine/AbstractProvider.php b/Doctrine/AbstractProvider.php
index 92be6cee2..26fce5567 100644
--- a/Doctrine/AbstractProvider.php
+++ b/Doctrine/AbstractProvider.php
@@ -16,10 +16,10 @@ abstract class AbstractProvider extends BaseAbstractProvider
* Constructor.
*
* @param ObjectPersisterInterface $objectPersister
- * @param IndexableInterface $indexable
- * @param string $objectClass
- * @param array $options
- * @param ManagerRegistry $managerRegistry
+ * @param IndexableInterface $indexable
+ * @param string $objectClass
+ * @param array $options
+ * @param ManagerRegistry $managerRegistry
*/
public function __construct(
ObjectPersisterInterface $objectPersister,
@@ -81,9 +81,9 @@ public function populate(\Closure $loggerClosure = null, array $options = array(
} else {
try {
$this->objectPersister->insertMany($objects);
- } catch(BulkResponseException $e) {
+ } catch (BulkResponseException $e) {
if ($loggerClosure) {
- $loggerClosure(sprintf('%s',$e->getMessage()));
+ $loggerClosure(sprintf('%s', $e->getMessage()));
}
}
}
@@ -112,24 +112,26 @@ public function populate(\Closure $loggerClosure = null, array $options = array(
* Counts objects that would be indexed using the query builder.
*
* @param object $queryBuilder
+ *
* @return integer
*/
- protected abstract function countObjects($queryBuilder);
+ abstract protected function countObjects($queryBuilder);
/**
* Disables logging and returns the logger that was previously set.
*
* @return mixed
*/
- protected abstract function disableLogging();
+ abstract protected function disableLogging();
/**
- * Reenables the logger with the previously returned logger from disableLogging();
+ * Reenables the logger with the previously returned logger from disableLogging();.
*
* @param mixed $logger
+ *
* @return mixed
*/
- protected abstract function enableLogging($logger);
+ abstract protected function enableLogging($logger);
/**
* Fetches a slice of objects using the query builder.
@@ -137,14 +139,15 @@ protected abstract function enableLogging($logger);
* @param object $queryBuilder
* @param integer $limit
* @param integer $offset
+ *
* @return array
*/
- protected abstract function fetchSlice($queryBuilder, $limit, $offset);
+ abstract protected function fetchSlice($queryBuilder, $limit, $offset);
/**
* Creates the query builder, which will be used to fetch objects to index.
*
* @return object
*/
- protected abstract function createQueryBuilder();
+ abstract protected function createQueryBuilder();
}
diff --git a/Doctrine/Listener.php b/Doctrine/Listener.php
index bd8b2c003..6276c1278 100644
--- a/Doctrine/Listener.php
+++ b/Doctrine/Listener.php
@@ -17,39 +17,39 @@
class Listener implements EventSubscriber
{
/**
- * Object persister
+ * Object persister.
*
* @var ObjectPersister
*/
protected $objectPersister;
/**
- * List of subscribed events
+ * List of subscribed events.
*
* @var array
*/
protected $events;
/**
- * Configuration for the listener
+ * Configuration for the listener.
*
* @var string
*/
private $config;
/**
- * Objects scheduled for insertion and replacement
+ * Objects scheduled for insertion and replacement.
*/
public $scheduledForInsertion = array();
public $scheduledForUpdate = array();
/**
- * IDs of objects scheduled for removal
+ * IDs of objects scheduled for removal.
*/
public $scheduledForDeletion = array();
/**
- * PropertyAccessor instance
+ * PropertyAccessor instance.
*
* @var PropertyAccessorInterface
*/
@@ -64,10 +64,10 @@ class Listener implements EventSubscriber
* Constructor.
*
* @param ObjectPersisterInterface $objectPersister
- * @param array $events
- * @param IndexableInterface $indexable
- * @param array $config
- * @param null $logger
+ * @param array $events
+ * @param IndexableInterface $indexable
+ * @param array $config
+ * @param null $logger
*/
public function __construct(
ObjectPersisterInterface $objectPersister,
@@ -98,11 +98,13 @@ public function getSubscribedEvents()
}
/**
- * Provides unified method for retrieving a doctrine object from an EventArgs instance
+ * Provides unified method for retrieving a doctrine object from an EventArgs instance.
*
- * @param EventArgs $eventArgs
- * @return object Entity | Document
- * @throws \RuntimeException if no valid getter is found.
+ * @param EventArgs $eventArgs
+ *
+ * @return object Entity | Document
+ *
+ * @throws \RuntimeException if no valid getter is found.
*/
private function getDoctrineObject(EventArgs $eventArgs)
{
@@ -142,7 +144,7 @@ public function postUpdate(EventArgs $eventArgs)
/**
* Delete objects preRemove instead of postRemove so that we have access to the id. Because this is called
- * preRemove, first check that the entity is managed by Doctrine
+ * preRemove, first check that the entity is managed by Doctrine.
*/
public function preRemove(EventArgs $eventArgs)
{
@@ -155,7 +157,7 @@ public function preRemove(EventArgs $eventArgs)
/**
* Persist scheduled objects to ElasticSearch
- * After persisting, clear the scheduled queue to prevent multiple data updates when using multiple flush calls
+ * After persisting, clear the scheduled queue to prevent multiple data updates when using multiple flush calls.
*/
private function persistScheduled()
{
@@ -210,6 +212,7 @@ protected function scheduleForDeletion($object)
* Checks if the object is indexable or not.
*
* @param object $object
+ *
* @return bool
*/
private function isObjectIndexable($object)
diff --git a/Doctrine/MongoDB/ElasticaToModelTransformer.php b/Doctrine/MongoDB/ElasticaToModelTransformer.php
index cea737ff8..23a8292cb 100644
--- a/Doctrine/MongoDB/ElasticaToModelTransformer.php
+++ b/Doctrine/MongoDB/ElasticaToModelTransformer.php
@@ -7,15 +7,16 @@
/**
* Maps Elastica documents with Doctrine objects
* This mapper assumes an exact match between
- * elastica documents ids and doctrine object ids
+ * elastica documents ids and doctrine object ids.
*/
class ElasticaToModelTransformer extends AbstractElasticaToModelTransformer
{
/**
- * Fetch objects for theses identifier values
+ * Fetch objects for theses identifier values.
+ *
+ * @param array $identifierValues ids values
+ * @param Boolean $hydrate whether or not to hydrate the objects, false returns arrays
*
- * @param array $identifierValues ids values
- * @param Boolean $hydrate whether or not to hydrate the objects, false returns arrays
* @return array of objects or arrays
*/
protected function findByIdentifiers(array $identifierValues, $hydrate)
diff --git a/Doctrine/MongoDB/Provider.php b/Doctrine/MongoDB/Provider.php
index 9e1c5dd28..2ed145422 100644
--- a/Doctrine/MongoDB/Provider.php
+++ b/Doctrine/MongoDB/Provider.php
@@ -27,9 +27,10 @@ protected function disableLogging()
}
/**
- * Reenables the logger with the previously returned logger from disableLogging();
+ * Reenables the logger with the previously returned logger from disableLogging();.
*
* @param mixed $logger
+ *
* @return mixed
*/
protected function enableLogging($logger)
diff --git a/Doctrine/ORM/ElasticaToModelTransformer.php b/Doctrine/ORM/ElasticaToModelTransformer.php
index a57a84c84..21d864095 100644
--- a/Doctrine/ORM/ElasticaToModelTransformer.php
+++ b/Doctrine/ORM/ElasticaToModelTransformer.php
@@ -8,17 +8,18 @@
/**
* Maps Elastica documents with Doctrine objects
* This mapper assumes an exact match between
- * elastica documents ids and doctrine object ids
+ * elastica documents ids and doctrine object ids.
*/
class ElasticaToModelTransformer extends AbstractElasticaToModelTransformer
{
const ENTITY_ALIAS = 'o';
/**
- * Fetch objects for theses identifier values
+ * Fetch objects for theses identifier values.
+ *
+ * @param array $identifierValues ids values
+ * @param Boolean $hydrate whether or not to hydrate the objects, false returns arrays
*
- * @param array $identifierValues ids values
- * @param Boolean $hydrate whether or not to hydrate the objects, false returns arrays
* @return array of objects or arrays
*/
protected function findByIdentifiers(array $identifierValues, $hydrate)
@@ -36,7 +37,7 @@ protected function findByIdentifiers(array $identifierValues, $hydrate)
}
/**
- * Retrieves a query builder to be used for querying by identifiers
+ * Retrieves a query builder to be used for querying by identifiers.
*
* @return \Doctrine\ORM\QueryBuilder
*/
diff --git a/Doctrine/ORM/Provider.php b/Doctrine/ORM/Provider.php
index 7e2ac12b1..fc5966760 100644
--- a/Doctrine/ORM/Provider.php
+++ b/Doctrine/ORM/Provider.php
@@ -29,9 +29,10 @@ protected function disableLogging()
}
/**
- * Reenables the logger with the previously returned logger from disableLogging();
+ * Reenables the logger with the previously returned logger from disableLogging();.
*
* @param mixed $logger
+ *
* @return mixed
*/
protected function enableLogging($logger)
@@ -76,7 +77,7 @@ protected function fetchSlice($queryBuilder, $limit, $offset)
throw new InvalidArgumentTypeException($queryBuilder, 'Doctrine\ORM\QueryBuilder');
}
- /**
+ /*
* An orderBy DQL part is required to avoid feching the same row twice.
* @see http://stackoverflow.com/questions/6314879/does-limit-offset-length-require-order-by-for-pagination
* @see http://www.postgresql.org/docs/current/static/queries-limit.html
diff --git a/Doctrine/RepositoryManager.php b/Doctrine/RepositoryManager.php
index f8867ebef..0d20f64b5 100644
--- a/Doctrine/RepositoryManager.php
+++ b/Doctrine/RepositoryManager.php
@@ -25,7 +25,7 @@ public function __construct(ManagerRegistry $managerRegistry, Reader $reader)
}
/**
- * Return repository for entity
+ * Return repository for entity.
*
* Returns custom repository if one specified otherwise
* returns a basic repository.
@@ -35,7 +35,7 @@ public function getRepository($entityName)
$realEntityName = $entityName;
if (strpos($entityName, ':') !== false) {
list($namespaceAlias, $simpleClassName) = explode(':', $entityName);
- $realEntityName = $this->managerRegistry->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName;
+ $realEntityName = $this->managerRegistry->getAliasNamespace($namespaceAlias).'\\'.$simpleClassName;
}
return parent::getRepository($realEntityName);
diff --git a/Elastica/Client.php b/Elastica/Client.php
index 372b39552..c244eb4f1 100644
--- a/Elastica/Client.php
+++ b/Elastica/Client.php
@@ -23,7 +23,7 @@ class Client extends BaseClient
private $indexCache = array();
/**
- * Symfony's debugging Stopwatch
+ * Symfony's debugging Stopwatch.
*
* @var Stopwatch|null
*/
@@ -32,8 +32,9 @@ class Client extends BaseClient
/**
* @param string $path
* @param string $method
- * @param array $data
- * @param array $query
+ * @param array $data
+ * @param array $query
+ *
* @return \Elastica\Response
*/
public function request($path, $method = Request::GET, $data = array(), array $query = array())
@@ -78,9 +79,9 @@ public function setStopwatch(Stopwatch $stopwatch = null)
*
* @param string $path
* @param string $method
- * @param array $data
- * @param array $query
- * @param int $start
+ * @param array $data
+ * @param array $query
+ * @param int $start
*/
private function logQuery($path, $method, $data, array $query, $start)
{
diff --git a/Elastica/Index.php b/Elastica/Index.php
index 49c656e58..ad3bd4d3e 100644
--- a/Elastica/Index.php
+++ b/Elastica/Index.php
@@ -44,14 +44,12 @@ public function getType($type)
}
/**
- * Reassign index name
+ * Reassign index name.
*
* While it's technically a regular setter for name property, it's specifically named overrideName, but not setName
* since it's used for a very specific case and normally should not be used
*
* @param string $name Index name
- *
- * @return void
*/
public function overrideName($name)
{
diff --git a/Exception/AliasIsIndexException.php b/Exception/AliasIsIndexException.php
index 87f546b09..1df7a62f6 100644
--- a/Exception/AliasIsIndexException.php
+++ b/Exception/AliasIsIndexException.php
@@ -9,4 +9,3 @@ public function __construct($indexName)
parent::__construct(sprintf('Expected alias %s instead of index', $indexName));
}
}
-
diff --git a/FOSElasticaBundle.php b/FOSElasticaBundle.php
index 3dec2a076..0e6de666b 100644
--- a/FOSElasticaBundle.php
+++ b/FOSElasticaBundle.php
@@ -12,7 +12,6 @@
/**
* Bundle.
- *
*/
class FOSElasticaBundle extends Bundle
{
diff --git a/Finder/FinderInterface.php b/Finder/FinderInterface.php
index 7c257de33..86dbf86e3 100644
--- a/Finder/FinderInterface.php
+++ b/Finder/FinderInterface.php
@@ -5,12 +5,13 @@
interface FinderInterface
{
/**
- * Searches for query results within a given limit
+ * Searches for query results within a given limit.
*
- * @param mixed $query Can be a string, an array or an \Elastica\Query object
- * @param int $limit How many results to get
+ * @param mixed $query Can be a string, an array or an \Elastica\Query object
+ * @param int $limit How many results to get
* @param array $options
+ *
* @return array results
*/
- function find($query, $limit = null, $options = array());
+ public function find($query, $limit = null, $options = array());
}
diff --git a/Finder/PaginatedFinderInterface.php b/Finder/PaginatedFinderInterface.php
index fa10b7034..1fc7a482e 100644
--- a/Finder/PaginatedFinderInterface.php
+++ b/Finder/PaginatedFinderInterface.php
@@ -9,20 +9,22 @@
interface PaginatedFinderInterface extends FinderInterface
{
/**
- * Searches for query results and returns them wrapped in a paginator
+ * Searches for query results and returns them wrapped in a paginator.
*
- * @param mixed $query Can be a string, an array or an \Elastica\Query object
+ * @param mixed $query Can be a string, an array or an \Elastica\Query object
* @param array $options
+ *
* @return Pagerfanta paginated results
*/
- function findPaginated($query, $options = array());
+ public function findPaginated($query, $options = array());
/**
- * Creates a paginator adapter for this query
+ * Creates a paginator adapter for this query.
*
* @param mixed $query
* @param array $options
+ *
* @return PaginatorAdapterInterface
*/
- function createPaginatorAdapter($query, $options = array());
+ public function createPaginatorAdapter($query, $options = array());
}
diff --git a/Finder/TransformedFinder.php b/Finder/TransformedFinder.php
index 908070107..44f6d2f5c 100644
--- a/Finder/TransformedFinder.php
+++ b/Finder/TransformedFinder.php
@@ -11,7 +11,7 @@
use Elastica\Query;
/**
- * Finds elastica documents and map them to persisted objects
+ * Finds elastica documents and map them to persisted objects.
*/
class TransformedFinder implements PaginatedFinderInterface
{
@@ -25,11 +25,12 @@ public function __construct(SearchableInterface $searchable, ElasticaToModelTran
}
/**
- * Search for a query string
+ * Search for a query string.
*
- * @param string $query
+ * @param string $query
* @param integer $limit
- * @param array $options
+ * @param array $options
+ *
* @return array of model objects
**/
public function find($query, $limit = null, $options = array())
@@ -50,8 +51,9 @@ public function findHybrid($query, $limit = null, $options = array())
* Find documents similar to one with passed id.
*
* @param integer $id
- * @param array $params
- * @param array $query
+ * @param array $params
+ * @param array $query
+ *
* @return array of model objects
**/
public function moreLikeThis($id, $params = array(), $query = array())
@@ -65,7 +67,8 @@ public function moreLikeThis($id, $params = array(), $query = array())
/**
* @param $query
* @param null|int $limit
- * @param array $options
+ * @param array $options
+ *
* @return array
*/
protected function search($query, $limit = null, $options = array())
@@ -80,10 +83,11 @@ protected function search($query, $limit = null, $options = array())
}
/**
- * Gets a paginator wrapping the result of a search
+ * Gets a paginator wrapping the result of a search.
*
* @param string $query
- * @param array $options
+ * @param array $options
+ *
* @return Pagerfanta
*/
public function findPaginated($query, $options = array())
diff --git a/HybridResult.php b/HybridResult.php
index ebd0e99f2..81499ba12 100644
--- a/HybridResult.php
+++ b/HybridResult.php
@@ -24,4 +24,4 @@ public function getResult()
{
return $this->result;
}
-}
\ No newline at end of file
+}
diff --git a/Index/AliasProcessor.php b/Index/AliasProcessor.php
index 29cfdc585..61c111e2a 100644
--- a/Index/AliasProcessor.php
+++ b/Index/AliasProcessor.php
@@ -24,7 +24,7 @@ class AliasProcessor
* Sets the randomised root name for an index.
*
* @param IndexConfig $indexConfig
- * @param Index $index
+ * @param Index $index
*/
public function setRootName(IndexConfig $indexConfig, Index $index)
{
@@ -38,8 +38,9 @@ public function setRootName(IndexConfig $indexConfig, Index $index)
* $force will delete an index encountered where an alias is expected.
*
* @param IndexConfig $indexConfig
- * @param Index $index
- * @param bool $force
+ * @param Index $index
+ * @param bool $force
+ *
* @throws AliasIsIndexException
* @throws \RuntimeException
*/
@@ -53,7 +54,7 @@ public function switchIndexAlias(IndexConfig $indexConfig, Index $index, $force
try {
$aliasedIndexes = $this->getAliasedIndexes($client, $aliasName);
- } catch(AliasIsIndexException $e) {
+ } catch (AliasIsIndexException $e) {
if (!$force) {
throw $e;
}
@@ -68,7 +69,7 @@ public function switchIndexAlias(IndexConfig $indexConfig, Index $index, $force
'Alias %s is used for multiple indexes: [%s].
Make sure it\'s either not used or is assigned to one index only',
$aliasName,
- join(', ', $aliasedIndexes)
+ implode(', ', $aliasedIndexes)
)
);
}
@@ -78,13 +79,13 @@ public function switchIndexAlias(IndexConfig $indexConfig, Index $index, $force
// if the alias is set - add an action to remove it
$oldIndexName = $aliasedIndexes[0];
$aliasUpdateRequest['actions'][] = array(
- 'remove' => array('index' => $oldIndexName, 'alias' => $aliasName)
+ 'remove' => array('index' => $oldIndexName, 'alias' => $aliasName),
);
}
// add an action to point the alias to the new index
$aliasUpdateRequest['actions'][] = array(
- 'add' => array('index' => $newIndexName, 'alias' => $aliasName)
+ 'add' => array('index' => $newIndexName, 'alias' => $aliasName),
);
try {
@@ -129,11 +130,13 @@ public function switchIndexAlias(IndexConfig $indexConfig, Index $index, $force
}
/**
- * Returns array of indexes which are mapped to given alias
+ * Returns array of indexes which are mapped to given alias.
*
* @param Client $client
* @param string $aliasName Alias name
+ *
* @return array
+ *
* @throws AliasIsIndexException
*/
private function getAliasedIndexes(Client $client, $aliasName)
@@ -159,7 +162,7 @@ private function getAliasedIndexes(Client $client, $aliasName)
}
/**
- * Delete an index
+ * Delete an index.
*
* @param Client $client
* @param string $indexName Index name to delete
diff --git a/Index/IndexManager.php b/Index/IndexManager.php
index 38249a7ce..13aecad07 100644
--- a/Index/IndexManager.php
+++ b/Index/IndexManager.php
@@ -22,7 +22,7 @@ public function __construct(array $indexes, Index $defaultIndex)
}
/**
- * Gets all registered indexes
+ * Gets all registered indexes.
*
* @return array
*/
@@ -32,10 +32,12 @@ public function getAllIndexes()
}
/**
- * Gets an index by its name
+ * Gets an index by its name.
*
* @param string $name Index to return, or the default index if null
+ *
* @return Index
+ *
* @throws \InvalidArgumentException if no index exists for the given name
*/
public function getIndex($name = null)
@@ -52,7 +54,7 @@ public function getIndex($name = null)
}
/**
- * Gets the default index
+ * Gets the default index.
*
* @return Index
*/
diff --git a/Index/MappingBuilder.php b/Index/MappingBuilder.php
index 9782e84bb..0af3773f7 100644
--- a/Index/MappingBuilder.php
+++ b/Index/MappingBuilder.php
@@ -27,6 +27,7 @@ class MappingBuilder
* Builds mappings for an entire index.
*
* @param IndexConfig $indexConfig
+ *
* @return array
*/
public function buildIndexMapping(IndexConfig $indexConfig)
@@ -54,6 +55,7 @@ public function buildIndexMapping(IndexConfig $indexConfig)
* Builds mappings for a single type.
*
* @param TypeConfig $typeConfig
+ *
* @return array
*/
public function buildTypeMapping(TypeConfig $typeConfig)
@@ -89,7 +91,7 @@ public function buildTypeMapping(TypeConfig $typeConfig)
if (!$mapping) {
// Empty mapping, we want it encoded as a {} instead of a []
- $mapping = new \stdClass;
+ $mapping = new \stdClass();
}
return $mapping;
diff --git a/Index/Resetter.php b/Index/Resetter.php
index 9b65a8f69..d537dd8f2 100644
--- a/Index/Resetter.php
+++ b/Index/Resetter.php
@@ -8,7 +8,7 @@
use FOS\ElasticaBundle\Configuration\ConfigManager;
/**
- * Deletes and recreates indexes
+ * Deletes and recreates indexes.
*/
class Resetter
{
@@ -41,7 +41,7 @@ public function __construct(ConfigManager $configManager, IndexManager $indexMan
}
/**
- * Deletes and recreates all indexes
+ * Deletes and recreates all indexes.
*/
public function resetAllIndexes($populating = false, $force = false)
{
@@ -55,8 +55,9 @@ public function resetAllIndexes($populating = false, $force = false)
* with a randomised name for an alias to be set after population.
*
* @param string $indexName
- * @param bool $populating
- * @param bool $force If index exists with same name as alias, remove it
+ * @param bool $populating
+ * @param bool $force If index exists with same name as alias, remove it
+ *
* @throws \InvalidArgumentException if no index exists for the given name
*/
public function resetIndex($indexName, $populating = false, $force = false)
@@ -77,10 +78,11 @@ public function resetIndex($indexName, $populating = false, $force = false)
}
/**
- * Deletes and recreates a mapping type for the named index
+ * Deletes and recreates a mapping type for the named index.
*
* @param string $indexName
* @param string $typeName
+ *
* @throws \InvalidArgumentException if no index or type mapping exists for the given names
* @throws ResponseException
*/
@@ -97,7 +99,7 @@ public function resetIndexType($indexName, $typeName)
}
}
- $mapping = new Mapping;
+ $mapping = new Mapping();
foreach ($this->mappingBuilder->buildTypeMapping($typeConfig) as $name => $field) {
$mapping->setParam($name, $field);
}
diff --git a/Manager/RepositoryManager.php b/Manager/RepositoryManager.php
index 7697b58a1..1a0601c2f 100644
--- a/Manager/RepositoryManager.php
+++ b/Manager/RepositoryManager.php
@@ -25,13 +25,13 @@ public function __construct(Reader $reader)
public function addEntity($entityName, FinderInterface $finder, $repositoryName = null)
{
- $this->entities[$entityName]= array();
+ $this->entities[$entityName] = array();
$this->entities[$entityName]['finder'] = $finder;
$this->entities[$entityName]['repositoryName'] = $repositoryName;
}
/**
- * Return repository for entity
+ * Return repository for entity.
*
* Returns custom repository if one specified otherwise
* returns a basic repository.
@@ -63,6 +63,7 @@ protected function getRepositoryName($entityName)
if ($annotation) {
$this->entities[$entityName]['repositoryName']
= $annotation->repositoryClass;
+
return $annotation->repositoryClass;
}
diff --git a/Manager/RepositoryManagerInterface.php b/Manager/RepositoryManagerInterface.php
index 1008371e5..0a38e0ee0 100644
--- a/Manager/RepositoryManagerInterface.php
+++ b/Manager/RepositoryManagerInterface.php
@@ -12,7 +12,6 @@
*/
interface RepositoryManagerInterface
{
-
/**
* Adds entity name and its finder.
* Custom repository class name can also be added.
@@ -24,7 +23,7 @@ interface RepositoryManagerInterface
public function addEntity($entityName, FinderInterface $finder, $repositoryName = null);
/**
- * Return repository for entity
+ * Return repository for entity.
*
* Returns custom repository if one specified otherwise
* returns a basic repository.
diff --git a/Paginator/FantaPaginatorAdapter.php b/Paginator/FantaPaginatorAdapter.php
index 2ad698343..2ac541233 100644
--- a/Paginator/FantaPaginatorAdapter.php
+++ b/Paginator/FantaPaginatorAdapter.php
@@ -29,7 +29,7 @@ public function getNbResults()
}
/**
- * Returns Facets
+ * Returns Facets.
*
* @return mixed
*
diff --git a/Paginator/PaginatorAdapterInterface.php b/Paginator/PaginatorAdapterInterface.php
index 25786a0a3..126373d30 100644
--- a/Paginator/PaginatorAdapterInterface.php
+++ b/Paginator/PaginatorAdapterInterface.php
@@ -11,7 +11,7 @@ interface PaginatorAdapterInterface
*
* @api
*/
- function getTotalHits();
+ public function getTotalHits();
/**
* Returns an slice of the results.
@@ -23,12 +23,12 @@ function getTotalHits();
*
* @api
*/
- function getResults($offset, $length);
+ public function getResults($offset, $length);
/**
- * Returns Facets
+ * Returns Facets.
*
* @return mixed
*/
- function getFacets();
+ public function getFacets();
}
diff --git a/Paginator/PartialResultsInterface.php b/Paginator/PartialResultsInterface.php
index 9efe7f371..a4f8f7da9 100644
--- a/Paginator/PartialResultsInterface.php
+++ b/Paginator/PartialResultsInterface.php
@@ -11,7 +11,7 @@ interface PartialResultsInterface
*
* @api
*/
- function toArray();
+ public function toArray();
/**
* Returns the number of results.
@@ -20,12 +20,12 @@ function toArray();
*
* @api
*/
- function getTotalHits();
+ public function getTotalHits();
/**
- * Returns the facets
+ * Returns the facets.
*
* @return array
*/
- function getFacets();
-}
\ No newline at end of file
+ public function getFacets();
+}
diff --git a/Paginator/RawPaginatorAdapter.php b/Paginator/RawPaginatorAdapter.php
index f05205a34..cfbe24a6a 100644
--- a/Paginator/RawPaginatorAdapter.php
+++ b/Paginator/RawPaginatorAdapter.php
@@ -8,7 +8,7 @@
use InvalidArgumentException;
/**
- * Allows pagination of Elastica\Query. Does not map results
+ * Allows pagination of Elastica\Query. Does not map results.
*/
class RawPaginatorAdapter implements PaginatorAdapterInterface
{
@@ -41,7 +41,7 @@ class RawPaginatorAdapter implements PaginatorAdapterInterface
* @see PaginatorAdapterInterface::__construct
*
* @param SearchableInterface $searchable the object to search in
- * @param Query $query the query to search
+ * @param Query $query the query to search
* @param array $options
*/
public function __construct(SearchableInterface $searchable, Query $query, array $options = array())
@@ -56,7 +56,9 @@ public function __construct(SearchableInterface $searchable, Query $query, array
*
* @param integer $offset
* @param integer $itemCountPerPage
+ *
* @throws \InvalidArgumentException
+ *
* @return ResultSet
*/
protected function getElasticaResults($offset, $itemCountPerPage)
@@ -82,6 +84,7 @@ protected function getElasticaResults($offset, $itemCountPerPage)
$resultSet = $this->searchable->search($query, $this->options);
$this->totalHits = $resultSet->getTotalHits();
$this->facets = $resultSet->getFacets();
+
return $resultSet;
}
@@ -90,6 +93,7 @@ protected function getElasticaResults($offset, $itemCountPerPage)
*
* @param int $offset
* @param int $itemCountPerPage
+ *
* @return PartialResultsInterface
*/
public function getResults($offset, $itemCountPerPage)
@@ -104,7 +108,7 @@ public function getResults($offset, $itemCountPerPage)
*/
public function getTotalHits()
{
- if ( ! isset($this->totalHits)) {
+ if (! isset($this->totalHits)) {
$this->totalHits = $this->searchable->search($this->query)->getTotalHits();
}
@@ -114,13 +118,13 @@ public function getTotalHits()
}
/**
- * Returns Facets
+ * Returns Facets.
*
* @return mixed
*/
public function getFacets()
{
- if ( ! isset($this->facets)) {
+ if (! isset($this->facets)) {
$this->facets = $this->searchable->search($this->query)->getFacets();
}
@@ -128,7 +132,7 @@ public function getFacets()
}
/**
- * Returns the Query
+ * Returns the Query.
*
* @return Query the search query
*/
diff --git a/Paginator/RawPartialResults.php b/Paginator/RawPartialResults.php
index a4afb003b..3a79abdaa 100644
--- a/Paginator/RawPartialResults.php
+++ b/Paginator/RawPartialResults.php
@@ -6,7 +6,7 @@
use Elastica\Result;
/**
- * Raw partial results transforms to a simple array
+ * Raw partial results transforms to a simple array.
*/
class RawPartialResults implements PartialResultsInterface
{
@@ -25,7 +25,7 @@ public function __construct(ResultSet $resultSet)
*/
public function toArray()
{
- return array_map(function(Result $result) {
+ return array_map(function (Result $result) {
return $result->getSource();
}, $this->resultSet->getResults());
}
@@ -47,6 +47,6 @@ public function getFacets()
return $this->resultSet->getFacets();
}
- return null;
+ return;
}
-}
\ No newline at end of file
+}
diff --git a/Paginator/TransformedPaginatorAdapter.php b/Paginator/TransformedPaginatorAdapter.php
index 3b4716f1b..bf152fb4f 100644
--- a/Paginator/TransformedPaginatorAdapter.php
+++ b/Paginator/TransformedPaginatorAdapter.php
@@ -7,15 +7,15 @@
use Elastica\Query;
/**
- * Allows pagination of \Elastica\Query
+ * Allows pagination of \Elastica\Query.
*/
class TransformedPaginatorAdapter extends RawPaginatorAdapter
{
private $transformer;
/**
- * @param SearchableInterface $searchable the object to search in
- * @param Query $query the query to search
+ * @param SearchableInterface $searchable the object to search in
+ * @param Query $query the query to search
* @param array $options
* @param ElasticaToModelTransformerInterface $transformer the transformer for fetching the results
*/
diff --git a/Paginator/TransformedPartialResults.php b/Paginator/TransformedPartialResults.php
index 13d716cb0..c9470c301 100644
--- a/Paginator/TransformedPartialResults.php
+++ b/Paginator/TransformedPartialResults.php
@@ -6,14 +6,14 @@
use Elastica\ResultSet;
/**
- * Partial transformed result set
+ * Partial transformed result set.
*/
class TransformedPartialResults extends RawPartialResults
{
protected $transformer;
/**
- * @param ResultSet $resultSet
+ * @param ResultSet $resultSet
* @param \FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface $transformer
*/
public function __construct(ResultSet $resultSet, ElasticaToModelTransformerInterface $transformer)
@@ -30,4 +30,4 @@ public function toArray()
{
return $this->transformer->transform($this->resultSet->getResults());
}
-}
\ No newline at end of file
+}
diff --git a/Persister/ObjectPersister.php b/Persister/ObjectPersister.php
index 0fe40c3e2..a34e671d9 100644
--- a/Persister/ObjectPersister.php
+++ b/Persister/ObjectPersister.php
@@ -10,7 +10,7 @@
/**
* Inserts, replaces and deletes single documents in an elastica type
- * Accepts domain model objects and converts them to elastica documents
+ * Accepts domain model objects and converts them to elastica documents.
*
* @author Thibault Duplessis
*/
@@ -34,6 +34,7 @@ public function __construct(Type $type, ModelToElasticaTransformerInterface $tra
* If the ObjectPersister handles a given object.
*
* @param object $object
+ *
* @return bool
*/
public function handlesObject($object)
@@ -47,11 +48,11 @@ public function setLogger(LoggerInterface $logger)
}
/**
- * Log exception if logger defined for persister belonging to the current listener, otherwise re-throw
+ * Log exception if logger defined for persister belonging to the current listener, otherwise re-throw.
*
* @param BulkException $e
+ *
* @throws BulkException
- * @return null
*/
private function log(BulkException $e)
{
@@ -64,7 +65,7 @@ private function log(BulkException $e)
/**
* Insert one object into the type
- * The object will be transformed to an elastica document
+ * The object will be transformed to an elastica document.
*
* @param object $object
*/
@@ -74,10 +75,9 @@ public function insertOne($object)
}
/**
- * Replaces one object in the type
+ * Replaces one object in the type.
*
* @param object $object
- * @return null
**/
public function replaceOne($object)
{
@@ -85,10 +85,9 @@ public function replaceOne($object)
}
/**
- * Deletes one object in the type
+ * Deletes one object in the type.
*
* @param object $object
- * @return null
**/
public function deleteOne($object)
{
@@ -96,11 +95,9 @@ public function deleteOne($object)
}
/**
- * Deletes one object in the type by id
+ * Deletes one object in the type by id.
*
* @param mixed $id
- *
- * @return null
**/
public function deleteById($id)
{
@@ -108,7 +105,7 @@ public function deleteById($id)
}
/**
- * Bulk insert an array of objects in the type for the given method
+ * Bulk insert an array of objects in the type for the given method.
*
* @param array $objects array of domain model objects
* @param string Method to call
@@ -148,7 +145,7 @@ public function replaceMany(array $objects)
}
/**
- * Bulk deletes an array of objects in the type
+ * Bulk deletes an array of objects in the type.
*
* @param array $objects array of domain model objects
*/
@@ -166,7 +163,7 @@ public function deleteMany(array $objects)
}
/**
- * Bulk deletes records from an array of identifiers
+ * Bulk deletes records from an array of identifiers.
*
* @param array $identifiers array of domain model object identifiers
*/
@@ -180,9 +177,10 @@ public function deleteManyByIdentifiers(array $identifiers)
}
/**
- * Transforms an object to an elastica document
+ * Transforms an object to an elastica document.
*
* @param object $object
+ *
* @return Document the elastica document
*/
public function transformToElasticaDocument($object)
diff --git a/Persister/ObjectPersisterInterface.php b/Persister/ObjectPersisterInterface.php
index 2b4c8eeff..85758871c 100644
--- a/Persister/ObjectPersisterInterface.php
+++ b/Persister/ObjectPersisterInterface.php
@@ -4,7 +4,7 @@
/**
* Inserts, replaces and deletes single documents in an elastica type
- * Accepts domain model objects and converts them to elastica documents
+ * Accepts domain model objects and converts them to elastica documents.
*
* @author Thibault Duplessis
*/
@@ -12,58 +12,56 @@ interface ObjectPersisterInterface
{
/**
* Insert one object into the type
- * The object will be transformed to an elastica document
+ * The object will be transformed to an elastica document.
*
* @param object $object
*/
- function insertOne($object);
+ public function insertOne($object);
/**
- * Replaces one object in the type
+ * Replaces one object in the type.
*
* @param object $object
**/
- function replaceOne($object);
+ public function replaceOne($object);
/**
- * Deletes one object in the type
+ * Deletes one object in the type.
*
* @param object $object
**/
- function deleteOne($object);
+ public function deleteOne($object);
/**
- * Deletes one object in the type by id
+ * Deletes one object in the type by id.
*
* @param mixed $id
- *
- * @return null
*/
- function deleteById($id);
+ public function deleteById($id);
/**
- * Bulk inserts an array of objects in the type
+ * Bulk inserts an array of objects in the type.
*
* @param array $objects array of domain model objects
*/
- function insertMany(array $objects);
+ public function insertMany(array $objects);
/**
- * Bulk updates an array of objects in the type
+ * Bulk updates an array of objects in the type.
*
* @param array $objects array of domain model objects
*/
- function replaceMany(array $objects);
+ public function replaceMany(array $objects);
/**
- * Bulk deletes an array of objects in the type
+ * Bulk deletes an array of objects in the type.
*
* @param array $objects array of domain model objects
*/
- function deleteMany(array $objects);
+ public function deleteMany(array $objects);
/**
- * Bulk deletes records from an array of identifiers
+ * Bulk deletes records from an array of identifiers.
*
* @param array $identifiers array of domain model object identifiers
*/
diff --git a/Persister/ObjectSerializerPersister.php b/Persister/ObjectSerializerPersister.php
index 3e33f8d48..018f85123 100644
--- a/Persister/ObjectSerializerPersister.php
+++ b/Persister/ObjectSerializerPersister.php
@@ -9,7 +9,7 @@
/**
* Inserts, replaces and deletes single objects in an elastica type, making use
* of elastica's serializer support to convert objects in to elastica documents.
- * Accepts domain model objects and passes them directly to elastica
+ * Accepts domain model objects and passes them directly to elastica.
*
* @author Lea Haensenberber
*/
@@ -28,9 +28,10 @@ public function __construct(Type $type, ModelToElasticaTransformerInterface $tra
/**
* Transforms an object to an elastica document
- * with just the identifier set
+ * with just the identifier set.
*
* @param object $object
+ *
* @return Document the elastica document
*/
public function transformToElasticaDocument($object)
diff --git a/Propel/ElasticaToModelTransformer.php b/Propel/ElasticaToModelTransformer.php
index e3602e51c..87c404794 100644
--- a/Propel/ElasticaToModelTransformer.php
+++ b/Propel/ElasticaToModelTransformer.php
@@ -44,7 +44,7 @@ class ElasticaToModelTransformer implements ElasticaToModelTransformerInterface
* Constructor.
*
* @param string $objectClass
- * @param array $options
+ * @param array $options
*/
public function __construct($objectClass, array $options = array())
{
@@ -67,6 +67,7 @@ public function setPropertyAccessor(PropertyAccessorInterface $propertyAccessor)
* fetched from the database.
*
* @param array $elasticaObjects
+ *
* @return array|\ArrayObject
*/
public function transform(array $elasticaObjects)
@@ -83,7 +84,7 @@ public function transform(array $elasticaObjects)
$identifier = $this->options['identifier'];
$propertyAccessor = $this->propertyAccessor;
- $sortCallback = function($a, $b) use ($idPos, $identifier, $propertyAccessor) {
+ $sortCallback = function ($a, $b) use ($idPos, $identifier, $propertyAccessor) {
return $idPos[$propertyAccessor->getValue($a, $identifier)] > $idPos[$propertyAccessor->getValue($b, $identifier)];
};
@@ -135,6 +136,7 @@ public function getIdentifierField()
*
* @param array $identifierValues Identifier values
* @param boolean $hydrate Whether or not to hydrate the results
+ *
* @return array
*/
protected function findByIdentifiers(array $identifierValues, $hydrate)
@@ -145,7 +147,7 @@ protected function findByIdentifiers(array $identifierValues, $hydrate)
$query = $this->createQuery($this->objectClass, $this->options['identifier'], $identifierValues);
- if ( ! $hydrate) {
+ if (! $hydrate) {
return $query->toArray();
}
@@ -158,6 +160,7 @@ protected function findByIdentifiers(array $identifierValues, $hydrate)
* @param string $class Propel model class
* @param string $identifierField Identifier field name (e.g. "id")
* @param array $identifierValues Identifier values
+ *
* @return \ModelCriteria
*/
protected function createQuery($class, $identifierField, array $identifierValues)
@@ -170,6 +173,7 @@ protected function createQuery($class, $identifierField, array $identifierValues
/**
* @see https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Util/Inflector.php
+ *
* @param string $str
*/
private function camelize($str)
diff --git a/Propel/Provider.php b/Propel/Provider.php
index 38f7a6107..ecace96d8 100644
--- a/Propel/Provider.php
+++ b/Propel/Provider.php
@@ -5,7 +5,7 @@
use FOS\ElasticaBundle\Provider\AbstractProvider;
/**
- * Propel provider
+ * Propel provider.
*
* @author William Durand
*/
@@ -16,7 +16,7 @@ class Provider extends AbstractProvider
*/
public function populate(\Closure $loggerClosure = null, array $options = array())
{
- $queryClass = $this->objectClass . 'Query';
+ $queryClass = $this->objectClass.'Query';
$nbObjects = $queryClass::create()->count();
$offset = isset($options['offset']) ? intval($options['offset']) : 0;
$sleep = isset($options['sleep']) ? intval($options['sleep']) : 0;
diff --git a/Provider/AbstractProvider.php b/Provider/AbstractProvider.php
index 82ea914d1..83d2e06d5 100644
--- a/Provider/AbstractProvider.php
+++ b/Provider/AbstractProvider.php
@@ -5,7 +5,7 @@
use FOS\ElasticaBundle\Persister\ObjectPersisterInterface;
/**
- * AbstractProvider
+ * AbstractProvider.
*/
abstract class AbstractProvider implements ProviderInterface
{
@@ -33,9 +33,9 @@ abstract class AbstractProvider implements ProviderInterface
* Constructor.
*
* @param ObjectPersisterInterface $objectPersister
- * @param IndexableInterface $indexable
- * @param string $objectClass
- * @param array $options
+ * @param IndexableInterface $indexable
+ * @param string $objectClass
+ * @param array $options
*/
public function __construct(
ObjectPersisterInterface $objectPersister,
@@ -56,6 +56,7 @@ public function __construct(
* Checks if a given object should be indexed or not.
*
* @param object $object
+ *
* @return bool
*/
protected function isObjectIndexable($object)
@@ -68,7 +69,7 @@ protected function isObjectIndexable($object)
}
/**
- * Get string with RAM usage information (current and peak)
+ * Get string with RAM usage information (current and peak).
*
* @return string
*/
diff --git a/Provider/Indexable.php b/Provider/Indexable.php
index 197aeb8e1..c72c9b94c 100644
--- a/Provider/Indexable.php
+++ b/Provider/Indexable.php
@@ -33,7 +33,7 @@ class Indexable implements IndexableInterface
private $container;
/**
- * An instance of ExpressionLanguage
+ * An instance of ExpressionLanguage.
*
* @var ExpressionLanguage
*/
@@ -47,7 +47,7 @@ class Indexable implements IndexableInterface
private $initialisedCallbacks = array();
/**
- * PropertyAccessor instance
+ * PropertyAccessor instance.
*
* @var PropertyAccessorInterface
*/
@@ -68,7 +68,8 @@ public function __construct(array $callbacks, ContainerInterface $container)
*
* @param string $indexName
* @param string $typeName
- * @param mixed $object
+ * @param mixed $object
+ *
* @return bool
*/
public function isObjectIndexable($indexName, $typeName, $object)
@@ -82,7 +83,7 @@ public function isObjectIndexable($indexName, $typeName, $object)
if ($callback instanceof Expression) {
return $this->getExpressionLanguage()->evaluate($callback, array(
'object' => $object,
- $this->getExpressionVar($object) => $object
+ $this->getExpressionVar($object) => $object,
));
}
@@ -96,12 +97,13 @@ public function isObjectIndexable($indexName, $typeName, $object)
*
* @param string $type
* @param object $object
+ *
* @return mixed
*/
private function buildCallback($type, $object)
{
if (!array_key_exists($type, $this->callbacks)) {
- return null;
+ return;
}
$callback = $this->callbacks[$type];
@@ -148,6 +150,7 @@ private function buildCallback($type, $object)
*
* @param string $type
* @param object $object
+ *
* @return mixed
*/
private function getCallback($type, $object)
@@ -177,6 +180,7 @@ private function getExpressionLanguage()
/**
* @param mixed $object
+ *
* @return string
*/
private function getExpressionVar($object = null)
diff --git a/Provider/IndexableInterface.php b/Provider/IndexableInterface.php
index 4871b5827..0d9f04708 100644
--- a/Provider/IndexableInterface.php
+++ b/Provider/IndexableInterface.php
@@ -18,7 +18,8 @@ interface IndexableInterface
*
* @param string $indexName
* @param string $typeName
- * @param mixed $object
+ * @param mixed $object
+ *
* @return bool
*/
public function isObjectIndexable($indexName, $typeName, $object);
diff --git a/Provider/ProviderInterface.php b/Provider/ProviderInterface.php
index e8d7ea40a..47b0ba165 100644
--- a/Provider/ProviderInterface.php
+++ b/Provider/ProviderInterface.php
@@ -3,7 +3,7 @@
namespace FOS\ElasticaBundle\Provider;
/**
- * Insert application domain objects into elastica types
+ * Insert application domain objects into elastica types.
*
* @author Thibault Duplessis
*/
@@ -14,7 +14,8 @@ interface ProviderInterface
*
* @param \Closure $loggerClosure
* @param array $options
+ *
* @return
*/
- function populate(\Closure $loggerClosure = null, array $options = array());
+ public function populate(\Closure $loggerClosure = null, array $options = array());
}
diff --git a/Provider/ProviderRegistry.php b/Provider/ProviderRegistry.php
index 214222342..1c389ae69 100644
--- a/Provider/ProviderRegistry.php
+++ b/Provider/ProviderRegistry.php
@@ -57,8 +57,10 @@ public function getAllProviders()
*
* Providers will be indexed by "type" strings in the returned array.
*
- * @param string $index
+ * @param string $index
+ *
* @return array of ProviderInterface instances
+ *
* @throws \InvalidArgumentException if no providers were registered for the index
*/
public function getIndexProviders($index)
@@ -81,7 +83,9 @@ public function getIndexProviders($index)
*
* @param string $index
* @param string $type
+ *
* @return ProviderInterface
+ *
* @throws \InvalidArgumentException if no provider was registered for the index and type
*/
public function getProvider($index, $type)
diff --git a/Repository.php b/Repository.php
index fcc278499..04a51c568 100644
--- a/Repository.php
+++ b/Repository.php
@@ -20,9 +20,10 @@ public function __construct(PaginatedFinderInterface $finder)
}
/**
- * @param mixed $query
+ * @param mixed $query
* @param integer $limit
- * @param array $options
+ * @param array $options
+ *
* @return array
*/
public function find($query, $limit = null, $options = array())
@@ -31,9 +32,10 @@ public function find($query, $limit = null, $options = array())
}
/**
- * @param mixed $query
+ * @param mixed $query
* @param integer $limit
- * @param array $options
+ * @param array $options
+ *
* @return mixed
*/
public function findHybrid($query, $limit = null, $options = array())
@@ -44,6 +46,7 @@ public function findHybrid($query, $limit = null, $options = array())
/**
* @param mixed $query
* @param array $options
+ *
* @return \Pagerfanta\Pagerfanta
*/
public function findPaginated($query, $options = array())
@@ -53,7 +56,8 @@ public function findPaginated($query, $options = array())
/**
* @param string $query
- * @param array $options
+ * @param array $options
+ *
* @return Paginator\PaginatorAdapterInterface
*/
public function createPaginatorAdapter($query, $options = array())
diff --git a/Resources/config/orm.xml b/Resources/config/orm.xml
index 94f21d4cd..d78ae8d6f 100644
--- a/Resources/config/orm.xml
+++ b/Resources/config/orm.xml
@@ -10,7 +10,7 @@
FOS\ElasticaBundle\Doctrine\ORM\ElasticaToModelTransformer
FOS\ElasticaBundle\Doctrine\RepositoryManager
-
+
diff --git a/Subscriber/PaginateElasticaQuerySubscriber.php b/Subscriber/PaginateElasticaQuerySubscriber.php
index 0b7cfd679..6ae49124b 100644
--- a/Subscriber/PaginateElasticaQuerySubscriber.php
+++ b/Subscriber/PaginateElasticaQuerySubscriber.php
@@ -38,7 +38,7 @@ public function items(ItemsEvent $event)
}
/**
- * Adds knp paging sort to query
+ * Adds knp paging sort to query.
*
* @param ItemsEvent $event
*/
@@ -70,7 +70,7 @@ protected function setSorting(ItemsEvent $event)
public static function getSubscribedEvents()
{
return array(
- 'knp_pager.items' => array('items', 1)
+ 'knp_pager.items' => array('items', 1),
);
}
-}
\ No newline at end of file
+}
diff --git a/Tests/Command/ResetCommandTest.php b/Tests/Command/ResetCommandTest.php
index b6548aa2c..eb0aaa901 100644
--- a/Tests/Command/ResetCommandTest.php
+++ b/Tests/Command/ResetCommandTest.php
@@ -2,7 +2,6 @@
namespace FOS\ElasticaBundle\Tests\Command;
-
use FOS\ElasticaBundle\Command\ResetCommand;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
@@ -88,4 +87,4 @@ public function testResetIndexType()
new NullOutput()
);
}
-}
\ No newline at end of file
+}
diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php
index 30e0f7a89..062db5c07 100644
--- a/Tests/DependencyInjection/ConfigurationTest.php
+++ b/Tests/DependencyInjection/ConfigurationTest.php
@@ -6,7 +6,7 @@
use Symfony\Component\Config\Definition\Processor;
/**
- * ConfigurationTest
+ * ConfigurationTest.
*/
class ConfigurationTest extends \PHPUnit_Framework_TestCase
{
@@ -34,7 +34,7 @@ public function testUnconfiguredConfiguration()
$this->assertSame(array(
'clients' => array(),
'indexes' => array(),
- 'default_manager' => 'orm'
+ 'default_manager' => 'orm',
), $configuration);
}
@@ -50,18 +50,18 @@ public function testClientConfiguration()
array(
'url' => 'http://es1:9200',
'headers' => array(
- 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
- )
+ 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==',
+ ),
),
array(
'url' => 'http://es2:9200',
'headers' => array(
- 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
- )
+ 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==',
+ ),
),
- )
- )
- )
+ ),
+ ),
+ ),
));
$this->assertCount(2, $configuration['clients']);
@@ -91,9 +91,9 @@ public function testLogging()
),
'logging_custom' => array(
'url' => 'http://localhost:9200',
- 'logger' => 'custom.service'
+ 'logger' => 'custom.service',
),
- )
+ ),
));
$this->assertCount(4, $configuration['clients']);
@@ -131,8 +131,8 @@ public function testTypeConfig()
),
'serializer' => array(
'groups' => array('Search'),
- 'version' => 1
- )
+ 'version' => 1,
+ ),
),
'types' => array(
'test' => array(
@@ -144,20 +144,20 @@ public function testTypeConfig()
'persistence' => array(
'listener' => array(
'logger' => true,
- )
- )
+ ),
+ ),
),
'test2' => array(
'mappings' => array(
'title' => null,
'children' => array(
'type' => 'nested',
- )
- )
- )
- )
- )
- )
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
));
}
@@ -169,7 +169,7 @@ public function testClientConfigurationNoUrl()
'host' => 'localhost',
'port' => 9200,
),
- )
+ ),
));
$this->assertTrue(empty($configuration['clients']['default']['connections'][0]['url']));
@@ -189,11 +189,11 @@ public function testMappingsRenamedToProperties()
'title' => array(),
'published' => array('type' => 'datetime'),
'body' => null,
- )
- )
- )
- )
- )
+ ),
+ ),
+ ),
+ ),
+ ),
));
$this->assertCount(3, $configuration['indexes']['test']['types']['test']['properties']);
@@ -208,10 +208,10 @@ public function testUnconfiguredType()
'indexes' => array(
'test' => array(
'types' => array(
- 'test' => null
- )
- )
- )
+ 'test' => null,
+ ),
+ ),
+ ),
));
$this->assertArrayHasKey('properties', $configuration['indexes']['test']['types']['test']);
@@ -243,23 +243,23 @@ public function testNestedProperties()
'type' => 'nested',
'properties' => array(
'nested_field1' => array(
- 'type' => 'integer'
+ 'type' => 'integer',
),
'nested_field2' => array(
'type' => 'object',
'properties' => array(
'id' => array(
- 'type' => 'integer'
- )
- )
- )
- )
- )
- )
- )
- )
- )
- )
+ 'type' => 'integer',
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
));
}
}
diff --git a/Tests/DependencyInjection/FOSElasticaExtensionTest.php b/Tests/DependencyInjection/FOSElasticaExtensionTest.php
index feb520fa4..1bef2b642 100644
--- a/Tests/DependencyInjection/FOSElasticaExtensionTest.php
+++ b/Tests/DependencyInjection/FOSElasticaExtensionTest.php
@@ -12,10 +12,10 @@ public function testShouldAddParentParamToObjectPersisterCall()
{
$config = Yaml::parse(file_get_contents(__DIR__.'/fixtures/config.yml'));
- $containerBuilder = new ContainerBuilder;
+ $containerBuilder = new ContainerBuilder();
$containerBuilder->setParameter('kernel.debug', true);
- $extension = new FOSElasticaExtension;
+ $extension = new FOSElasticaExtension();
$extension->load($config, $containerBuilder);
diff --git a/Tests/Doctrine/AbstractElasticaToModelTransformerTest.php b/Tests/Doctrine/AbstractElasticaToModelTransformerTest.php
index 325171b4b..b026eb87d 100644
--- a/Tests/Doctrine/AbstractElasticaToModelTransformerTest.php
+++ b/Tests/Doctrine/AbstractElasticaToModelTransformerTest.php
@@ -19,7 +19,7 @@ class AbstractElasticaToModelTransformerTest extends \PHPUnit_Framework_TestCase
protected $objectClass = 'stdClass';
/**
- * Tests if ignore_missing option is properly handled in transformHybrid() method
+ * Tests if ignore_missing option is properly handled in transformHybrid() method.
*/
public function testIgnoreMissingOptionDuringTransformHybrid()
{
diff --git a/Tests/Doctrine/AbstractListenerTest.php b/Tests/Doctrine/AbstractListenerTest.php
index 724225505..623231b17 100644
--- a/Tests/Doctrine/AbstractListenerTest.php
+++ b/Tests/Doctrine/AbstractListenerTest.php
@@ -3,7 +3,7 @@
namespace FOS\ElasticaBundle\Tests\Doctrine;
/**
- * See concrete MongoDB/ORM instances of this abstract test
+ * See concrete MongoDB/ORM instances of this abstract test.
*
* @author Richard Miller
*/
@@ -213,8 +213,8 @@ private function getMockObjectManager()
/**
* @param Listener\Entity $object
- * @param string $indexName
- * @param string $typeName
+ * @param string $indexName
+ * @param string $typeName
*/
private function getMockPersister($object, $indexName, $typeName)
{
@@ -247,10 +247,10 @@ private function getMockPersister($object, $indexName, $typeName)
}
/**
- * @param string $indexName
- * @param string $typeName
+ * @param string $indexName
+ * @param string $typeName
* @param Listener\Entity $object
- * @param boolean $return
+ * @param boolean $return
*/
private function getMockIndexable($indexName, $typeName, $object, $return = null)
{
@@ -286,4 +286,3 @@ public function getId()
return $this->id;
}
}
-
diff --git a/Tests/Doctrine/AbstractProviderTest.php b/Tests/Doctrine/AbstractProviderTest.php
index a129a6cd6..50b28b70a 100644
--- a/Tests/Doctrine/AbstractProviderTest.php
+++ b/Tests/Doctrine/AbstractProviderTest.php
@@ -84,7 +84,7 @@ public function providePopulateIterations()
return array(
array(
100,
- array(range(1,100)),
+ array(range(1, 100)),
100,
),
array(
@@ -231,7 +231,6 @@ public function testPopulateRunsIndexCallable()
->with('index', 'type', 2)
->will($this->returnValue(true));
-
$this->objectPersister->expects($this->once())
->method('insertMany')
->with(array(1 => 2));
@@ -259,7 +258,7 @@ private function getMockAbstractProvider()
private function getMockBulkResponseException()
{
return $this->getMock('Elastica\Exception\Bulk\ResponseException', null, array(
- new ResponseSet(new Response(array()), array())
+ new ResponseSet(new Response(array()), array()),
));
}
@@ -276,7 +275,7 @@ private function getMockManagerRegistry()
*/
private function getMockObjectManager()
{
- return $this->getMock(__NAMESPACE__ . '\ObjectManager');
+ return $this->getMock(__NAMESPACE__.'\ObjectManager');
}
/**
@@ -302,5 +301,5 @@ private function getMockIndexable()
*/
interface ObjectManager
{
- function clear();
+ public function clear();
}
diff --git a/Tests/Doctrine/ORM/ElasticaToModelTransformerTest.php b/Tests/Doctrine/ORM/ElasticaToModelTransformerTest.php
index 14f3ffb85..fe85331d7 100644
--- a/Tests/Doctrine/ORM/ElasticaToModelTransformerTest.php
+++ b/Tests/Doctrine/ORM/ElasticaToModelTransformerTest.php
@@ -109,7 +109,7 @@ protected function setUp()
'findAll',
'findBy',
'findOneBy',
- 'getClassName'
+ 'getClassName',
));
$this->manager->expects($this->any())
diff --git a/Tests/Doctrine/RepositoryManagerTest.php b/Tests/Doctrine/RepositoryManagerTest.php
index ce7b14b07..aa6117dee 100644
--- a/Tests/Doctrine/RepositoryManagerTest.php
+++ b/Tests/Doctrine/RepositoryManagerTest.php
@@ -4,9 +4,13 @@
use FOS\ElasticaBundle\Doctrine\RepositoryManager;
-class CustomRepository{}
+class CustomRepository
+{
+}
-class Entity{}
+class Entity
+{
+}
/**
* @author Richard Miller
diff --git a/Tests/Elastica/ClientTest.php b/Tests/Elastica/ClientTest.php
index 43ac7a281..158b55395 100644
--- a/Tests/Elastica/ClientTest.php
+++ b/Tests/Elastica/ClientTest.php
@@ -5,11 +5,11 @@
use Elastica\Request;
use Elastica\Transport\Null as NullTransport;
-class LoggingClientTest extends \PHPUnit_Framework_TestCase
+class ClientTest extends \PHPUnit_Framework_TestCase
{
public function testRequestsAreLogged()
{
- $transport = new NullTransport;
+ $transport = new NullTransport();
$connection = $this->getMock('Elastica\Connection');
$connection->expects($this->any())->method('getTransportObject')->will($this->returnValue($transport));
diff --git a/Tests/FOSElasticaBundleTest.php b/Tests/FOSElasticaBundleTest.php
index 4290e1d29..c9513db08 100644
--- a/Tests/FOSElasticaBundleTest.php
+++ b/Tests/FOSElasticaBundleTest.php
@@ -16,7 +16,6 @@ public function testCompilerPassesAreRegistered()
->method('addCompilerPass')
->with($this->isInstanceOf('Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface'));
-
$bundle = new FOSElasticaBundle();
$bundle->build($container);
}
diff --git a/Tests/Functional/ConfigurationManagerTest.php b/Tests/Functional/ConfigurationManagerTest.php
index 7ef02c55d..a6028b750 100644
--- a/Tests/Functional/ConfigurationManagerTest.php
+++ b/Tests/Functional/ConfigurationManagerTest.php
@@ -47,6 +47,7 @@ protected function tearDown()
/**
* @param Client $client
+ *
* @return \FOS\ElasticaBundle\Configuration\ConfigManager
*/
private function getManager(Client $client)
diff --git a/Tests/Functional/IndexableCallbackTest.php b/Tests/Functional/IndexableCallbackTest.php
index 41ed402c6..3f84286da 100644
--- a/Tests/Functional/IndexableCallbackTest.php
+++ b/Tests/Functional/IndexableCallbackTest.php
@@ -17,7 +17,7 @@
class IndexableCallbackTest extends WebTestCase
{
/**
- * 2 reasons for this test:
+ * 2 reasons for this test:.
*
* 1) To test that the configuration rename from is_indexable_callback under the listener
* key is respected, and
diff --git a/Tests/Functional/MappingToElasticaTest.php b/Tests/Functional/MappingToElasticaTest.php
index 11c0db606..350565959 100644
--- a/Tests/Functional/MappingToElasticaTest.php
+++ b/Tests/Functional/MappingToElasticaTest.php
@@ -100,6 +100,7 @@ public function testMappingIteratorToArrayField()
/**
* @param Client $client
+ *
* @return \FOS\ElasticaBundle\Resetter $resetter
*/
private function getResetter(Client $client)
@@ -109,11 +110,12 @@ private function getResetter(Client $client)
/**
* @param Client $client
+ *
* @return \Elastica\Type
*/
private function getType(Client $client, $type = 'type')
{
- return $client->getContainer()->get('fos_elastica.index.index.' . $type);
+ return $client->getContainer()->get('fos_elastica.index.index.'.$type);
}
protected function setUp()
diff --git a/Tests/Functional/app/AppKernel.php b/Tests/Functional/app/AppKernel.php
index f47a5b398..d75910aef 100644
--- a/Tests/Functional/app/AppKernel.php
+++ b/Tests/Functional/app/AppKernel.php
@@ -115,4 +115,4 @@ protected function getKernelParameters()
return $parameters;
}
-}
\ No newline at end of file
+}
diff --git a/Tests/Functional/app/Serializer/config.yml b/Tests/Functional/app/Serializer/config.yml
index 9bea4ba5d..a96896823 100644
--- a/Tests/Functional/app/Serializer/config.yml
+++ b/Tests/Functional/app/Serializer/config.yml
@@ -47,4 +47,3 @@ fos_elastica:
serializer:
groups: ['search', 'Default']
version: 1.1
-
diff --git a/Tests/Index/IndexManagerTest.php b/Tests/Index/IndexManagerTest.php
index 98e4d8a9b..78a3d2899 100644
--- a/Tests/Index/IndexManagerTest.php
+++ b/Tests/Index/IndexManagerTest.php
@@ -13,7 +13,6 @@ class IndexManagerTest extends \PHPUnit_Framework_TestCase
*/
private $indexManager;
-
public function setUp()
{
foreach (array('index1', 'index2', 'index3') as $indexName) {
diff --git a/Tests/Integration/MappingTest.php b/Tests/Integration/MappingTest.php
index be134ed32..ae7e40949 100644
--- a/Tests/Integration/MappingTest.php
+++ b/Tests/Integration/MappingTest.php
@@ -8,10 +8,8 @@
* with this source code in the file LICENSE.
*/
-
namespace FOS\ElasticaBundle\Tests\Integration;
-
-class MappingTest {
-
-}
\ No newline at end of file
+class MappingTest
+{
+}
diff --git a/Tests/Logger/ElasticaLoggerTest.php b/Tests/Logger/ElasticaLoggerTest.php
index 96adf5355..7d906398f 100644
--- a/Tests/Logger/ElasticaLoggerTest.php
+++ b/Tests/Logger/ElasticaLoggerTest.php
@@ -22,7 +22,8 @@ private function getMockLogger()
/**
* @param string $level
* @param string $message
- * @param array $context
+ * @param array $context
+ *
* @return ElasticaLogger
*/
private function getMockLoggerForLevelMessageAndContext($level, $message, $context)
@@ -45,7 +46,7 @@ private function getMockLoggerForLevelMessageAndContext($level, $message, $conte
public function testGetZeroIfNoQueriesAdded()
{
- $elasticaLogger = new ElasticaLogger;
+ $elasticaLogger = new ElasticaLogger();
$this->assertEquals(0, $elasticaLogger->getNbQueries());
}
diff --git a/Tests/Manager/RepositoryManagerTest.php b/Tests/Manager/RepositoryManagerTest.php
index 88490359f..71bb076d6 100644
--- a/Tests/Manager/RepositoryManagerTest.php
+++ b/Tests/Manager/RepositoryManagerTest.php
@@ -4,16 +4,19 @@
use FOS\ElasticaBundle\Manager\RepositoryManager;
-class CustomRepository{}
+class CustomRepository
+{
+}
-class Entity{}
+class Entity
+{
+}
/**
* @author Richard Miller
*/
class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
{
-
public function testThatGetRepositoryReturnsDefaultRepository()
{
/** @var $finderMock \PHPUnit_Framework_MockObject_MockObject|\FOS\ElasticaBundle\Finder\TransformedFinder */
diff --git a/Tests/Persister/ObjectPersisterTest.php b/Tests/Persister/ObjectPersisterTest.php
index 77a8809e2..18390ae45 100644
--- a/Tests/Persister/ObjectPersisterTest.php
+++ b/Tests/Persister/ObjectPersisterTest.php
@@ -33,9 +33,9 @@ class ObjectPersisterTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
- if (!class_exists('Elastica\Type')) {
- $this->markTestSkipped('The Elastica library classes are not available');
- }
+ if (!class_exists('Elastica\Type')) {
+ $this->markTestSkipped('The Elastica library classes are not available');
+ }
}
public function testThatCanReplaceObject()
diff --git a/Tests/Persister/ObjectSerializerPersisterTest.php b/Tests/Persister/ObjectSerializerPersisterTest.php
index 914b5dd6e..31a999fd4 100644
--- a/Tests/Persister/ObjectSerializerPersisterTest.php
+++ b/Tests/Persister/ObjectSerializerPersisterTest.php
@@ -26,9 +26,9 @@ class ObjectSerializerPersisterTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
- if (!class_exists('Elastica\Type')) {
- $this->markTestSkipped('The Elastica library classes are not available');
- }
+ if (!class_exists('Elastica\Type')) {
+ $this->markTestSkipped('The Elastica library classes are not available');
+ }
}
public function testThatCanReplaceObject()
diff --git a/Tests/Provider/IndexableTest.php b/Tests/Provider/IndexableTest.php
index 6ef5669e4..3080c888b 100644
--- a/Tests/Provider/IndexableTest.php
+++ b/Tests/Provider/IndexableTest.php
@@ -21,7 +21,7 @@ class IndexableTest extends \PHPUnit_Framework_TestCase
public function testIndexableUnknown()
{
$indexable = new Indexable(array(), $this->container);
- $index = $indexable->isObjectIndexable('index', 'type', new Entity);
+ $index = $indexable->isObjectIndexable('index', 'type', new Entity());
$this->assertTrue($index);
}
@@ -32,9 +32,9 @@ public function testIndexableUnknown()
public function testValidIndexableCallbacks($callback, $return)
{
$indexable = new Indexable(array(
- 'index/type' => $callback
+ 'index/type' => $callback,
), $this->container);
- $index = $indexable->isObjectIndexable('index', 'type', new Entity);
+ $index = $indexable->isObjectIndexable('index', 'type', new Entity());
$this->assertEquals($return, $index);
}
@@ -46,9 +46,9 @@ public function testValidIndexableCallbacks($callback, $return)
public function testInvalidIsIndexableCallbacks($callback)
{
$indexable = new Indexable(array(
- 'index/type' => $callback
+ 'index/type' => $callback,
), $this->container);
- $indexable->isObjectIndexable('index', 'type', new Entity);
+ $indexable->isObjectIndexable('index', 'type', new Entity());
}
public function provideInvalidIsIndexableCallbacks()
@@ -67,7 +67,7 @@ public function provideIsIndexableCallbacks()
array('isIndexable', false),
array(array(new IndexableDecider(), 'isIndexable'), true),
array(array('@indexableService', 'isIndexable'), true),
- array(function(Entity $entity) { return $entity->maybeIndex(); }, true),
+ array(function (Entity $entity) { return $entity->maybeIndex(); }, true),
array('entity.maybeIndex()', true),
array('!object.isIndexable() && entity.property == "abc"', true),
array('entity.property != "abc"', false),
diff --git a/Tests/RepositoryTest.php b/Tests/RepositoryTest.php
index c4d4efc3e..2d5bc66c9 100644
--- a/Tests/RepositoryTest.php
+++ b/Tests/RepositoryTest.php
@@ -13,14 +13,7 @@ public function testThatFindCallsFindOnFinder()
{
$testQuery = 'Test Query';
- /** @var $typeMock \PHPUnit_Framework_MockObject_MockObject|\FOS\ElasticaBundle\Finder\TransformedFinder */
- $finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
- ->disableOriginalConstructor()
- ->getMock();
- $finderMock->expects($this->once())
- ->method('find')
- ->with($this->equalTo($testQuery));
-
+ $finderMock = $this->getFinderMock($testQuery);
$repository = new Repository($finderMock);
$repository->find($testQuery);
}
@@ -30,14 +23,7 @@ public function testThatFindCallsFindOnFinderWithLimit()
$testQuery = 'Test Query';
$testLimit = 20;
- /** @var $typeMock \PHPUnit_Framework_MockObject_MockObject|\FOS\ElasticaBundle\Finder\TransformedFinder */
- $finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
- ->disableOriginalConstructor()
- ->getMock();
- $finderMock->expects($this->once())
- ->method('find')
- ->with($this->equalTo($testQuery), $this->equalTo($testLimit));
-
+ $finderMock = $this->getFinderMock($testQuery, $testLimit);
$repository = new Repository($finderMock);
$repository->find($testQuery, $testLimit);
}
@@ -46,14 +32,7 @@ public function testThatFindPaginatedCallsFindPaginatedOnFinder()
{
$testQuery = 'Test Query';
- /** @var $typeMock \PHPUnit_Framework_MockObject_MockObject|\FOS\ElasticaBundle\Finder\TransformedFinder */
- $finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
- ->disableOriginalConstructor()
- ->getMock();
- $finderMock->expects($this->once())
- ->method('findPaginated')
- ->with($this->equalTo($testQuery));
-
+ $finderMock = $this->getFinderMock($testQuery, array(), 'findPaginated');
$repository = new Repository($finderMock);
$repository->findPaginated($testQuery);
}
@@ -62,14 +41,7 @@ public function testThatCreatePaginatorCreatesAPaginatorViaFinder()
{
$testQuery = 'Test Query';
- /** @var $typeMock \PHPUnit_Framework_MockObject_MockObject|\FOS\ElasticaBundle\Finder\TransformedFinder */
- $finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
- ->disableOriginalConstructor()
- ->getMock();
- $finderMock->expects($this->once())
- ->method('createPaginatorAdapter')
- ->with($this->equalTo($testQuery));
-
+ $finderMock = $this->getFinderMock($testQuery, array(), 'createPaginatorAdapter');
$repository = new Repository($finderMock);
$repository->createPaginatorAdapter($testQuery);
}
@@ -77,17 +49,27 @@ public function testThatCreatePaginatorCreatesAPaginatorViaFinder()
public function testThatFindHybridCallsFindHybridOnFinder()
{
$testQuery = 'Test Query';
- $testLimit = 20;
- /** @var $typeMock \PHPUnit_Framework_MockObject_MockObject|\FOS\ElasticaBundle\Finder\TransformedFinder */
+ $finderMock = $this->getFinderMock($testQuery, null, 'findHybrid');
+ $repository = new Repository($finderMock);
+ $repository->findHybrid($testQuery);
+ }
+
+ /**
+ * @param string $testQuery
+ * @param int $testLimit
+ * @param string $method
+ * @return \FOS\ElasticaBundle\Finder\TransformedFinder|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private function getFinderMock($testQuery, $testLimit = null, $method = 'find')
+ {
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
$finderMock->expects($this->once())
- ->method('findHybrid')
+ ->method($method)
->with($this->equalTo($testQuery), $this->equalTo($testLimit));
- $repository = new Repository($finderMock);
- $repository->findHybrid($testQuery, $testLimit);
+ return $finderMock;
}
}
diff --git a/Tests/Transformer/ElasticaToModelTransformerCollectionTest.php b/Tests/Transformer/ElasticaToModelTransformerCollectionTest.php
index c3fc323bc..d83f5965f 100644
--- a/Tests/Transformer/ElasticaToModelTransformerCollectionTest.php
+++ b/Tests/Transformer/ElasticaToModelTransformerCollectionTest.php
@@ -47,7 +47,7 @@ public function testGetObjectClass()
$objectClasses = $this->collection->getObjectClass();
$this->assertEquals(array(
'type1' => 'FOS\ElasticaBundle\Tests\Transformer\POPO',
- 'type2' => 'FOS\ElasticaBundle\Tests\Transformer\POPO2'
+ 'type2' => 'FOS\ElasticaBundle\Tests\Transformer\POPO2',
), $objectClasses);
}
@@ -89,8 +89,8 @@ public function testTransformOrder()
$this->transformers['type1']->expects($this->once())
->method('transform')
- ->with(array($document1,$document2))
- ->will($this->returnValue(array($result1,$result2)));
+ ->with(array($document1, $document2))
+ ->will($this->returnValue(array($result1, $result2)));
$results = $this->collection->transform(array($document1, $document2));
@@ -120,8 +120,8 @@ public function elasticaResults()
return array(
array(
- $result, $transformedObject
- )
+ $result, $transformedObject,
+ ),
);
}
diff --git a/Tests/Transformer/ModelToElasticaAutoTransformerTest.php b/Tests/Transformer/ModelToElasticaAutoTransformerTest.php
index 1fa6a8e85..ca7182573 100644
--- a/Tests/Transformer/ModelToElasticaAutoTransformerTest.php
+++ b/Tests/Transformer/ModelToElasticaAutoTransformerTest.php
@@ -21,8 +21,8 @@ class POPO
public function __construct()
{
$this->date = new \DateTime('1979-05-05');
- $this->file = new \SplFileInfo(__DIR__ . '/../fixtures/attachment.odt');
- $this->fileContents = file_get_contents(__DIR__ . '/../fixtures/attachment.odt');
+ $this->file = new \SplFileInfo(__DIR__.'/../fixtures/attachment.odt');
+ $this->fileContents = file_get_contents(__DIR__.'/../fixtures/attachment.odt');
}
public function getId()
@@ -47,7 +47,7 @@ public function getArray()
{
return array(
'key1' => 'value1',
- 'key2' => 'value2'
+ 'key2' => 'value2',
);
}
@@ -109,7 +109,7 @@ public function getObj()
public function getNestedObject()
{
- return array('key1' => (object)array('id' => 1, 'key1sub1' => 'value1sub1', 'key1sub2' => 'value1sub2'));
+ return array('key1' => (object) array('id' => 1, 'key1sub1' => 'value1sub1', 'key1sub2' => 'value1sub2'));
}
public function getUpper()
@@ -152,7 +152,7 @@ public function testThatCanTransformObjectWithCorrectTypes()
'float' => array(),
'bool' => array(),
'date' => array(),
- 'falseBool' => array()
+ 'falseBool' => array(),
)
);
$data = $document->getData();
@@ -185,7 +185,7 @@ public function testThatCanTransformObjectWithArrayValue()
$this->assertEquals(
array(
'key1' => 'value1',
- 'key2' => 'value2'
+ 'key2' => 'value2',
), $data['array']
);
}
@@ -230,7 +230,7 @@ public function testFileAddedForAttachmentMapping()
$document = $transformer->transform(new POPO(), array('file' => array('type' => 'attachment')));
$data = $document->getData();
- $this->assertEquals(base64_encode(file_get_contents(__DIR__ . '/../fixtures/attachment.odt')), $data['file']);
+ $this->assertEquals(base64_encode(file_get_contents(__DIR__.'/../fixtures/attachment.odt')), $data['file']);
}
public function testFileContentsAddedForAttachmentMapping()
@@ -240,7 +240,7 @@ public function testFileContentsAddedForAttachmentMapping()
$data = $document->getData();
$this->assertEquals(
- base64_encode(file_get_contents(__DIR__ . '/../fixtures/attachment.odt')), $data['fileContents']
+ base64_encode(file_get_contents(__DIR__.'/../fixtures/attachment.odt')), $data['fileContents']
);
}
@@ -250,8 +250,8 @@ public function testNestedMapping()
$document = $transformer->transform(new POPO(), array(
'sub' => array(
'type' => 'nested',
- 'properties' => array('foo' => '~')
- )
+ 'properties' => array('foo' => '~'),
+ ),
));
$data = $document->getData();
@@ -259,7 +259,7 @@ public function testNestedMapping()
$this->assertInternalType('array', $data['sub']);
$this->assertEquals(array(
array('foo' => 'foo'),
- array('foo' => 'bar')
+ array('foo' => 'bar'),
), $data['sub']);
}
@@ -269,8 +269,8 @@ public function tesObjectMapping()
$document = $transformer->transform(new POPO(), array(
'sub' => array(
'type' => 'object',
- 'properties' => array('bar')
- )
+ 'properties' => array('bar'),
+ ),
));
$data = $document->getData();
@@ -278,7 +278,7 @@ public function tesObjectMapping()
$this->assertInternalType('array', $data['sub']);
$this->assertEquals(array(
array('bar' => 'foo'),
- array('bar' => 'bar')
+ array('bar' => 'bar'),
), $data['sub']);
}
@@ -287,17 +287,17 @@ public function testObjectDoesNotRequireProperties()
$transformer = $this->getTransformer();
$document = $transformer->transform(new POPO(), array(
'obj' => array(
- 'type' => 'object'
- )
+ 'type' => 'object',
+ ),
));
$data = $document->getData();
$this->assertTrue(array_key_exists('obj', $data));
$this->assertInternalType('array', $data['obj']);
$this->assertEquals(array(
- 'foo' => 'foo',
- 'bar' => 'foo',
- 'id' => 1
+ 'foo' => 'foo',
+ 'bar' => 'foo',
+ 'id' => 1,
), $data['obj']);
}
@@ -313,14 +313,14 @@ public function testObjectsMappingOfAtLeastOneAutoMappedObjectAndAtLeastOneManua
'properties' => array(
'key1sub1' => array(
'type' => 'string',
- 'properties' => array()
+ 'properties' => array(),
),
'key1sub2' => array(
'type' => 'string',
- 'properties' => array()
- )
- )
- )
+ 'properties' => array(),
+ ),
+ ),
+ ),
)
);
$data = $document->getData();
@@ -333,14 +333,14 @@ public function testObjectsMappingOfAtLeastOneAutoMappedObjectAndAtLeastOneManua
array(
'foo' => 'foo',
'bar' => 'foo',
- 'id' => 1
+ 'id' => 1,
),
$data['obj']
);
$this->assertEquals(
array(
'key1sub1' => 'value1sub1',
- 'key1sub2' => 'value1sub2'
+ 'key1sub2' => 'value1sub2',
),
$data['nestedObject'][0]
);
@@ -350,7 +350,7 @@ public function testParentMapping()
{
$transformer = $this->getTransformer();
$document = $transformer->transform(new POPO(), array(
- '_parent' => array('type' => 'upper', 'property'=>'upper', 'identifier' => 'id'),
+ '_parent' => array('type' => 'upper', 'property' => 'upper', 'identifier' => 'id'),
));
$this->assertEquals("parent", $document->getParent());
@@ -360,7 +360,7 @@ public function testParentMappingWithCustomIdentifier()
{
$transformer = $this->getTransformer();
$document = $transformer->transform(new POPO(), array(
- '_parent' => array('type' => 'upper', 'property'=>'upper', 'identifier' => 'name'),
+ '_parent' => array('type' => 'upper', 'property' => 'upper', 'identifier' => 'name'),
));
$this->assertEquals("a random name", $document->getParent());
@@ -370,7 +370,7 @@ public function testParentMappingWithNullProperty()
{
$transformer = $this->getTransformer();
$document = $transformer->transform(new POPO(), array(
- '_parent' => array('type' => 'upper', 'property'=>null, 'identifier' => 'id'),
+ '_parent' => array('type' => 'upper', 'property' => null, 'identifier' => 'id'),
));
$this->assertEquals("parent", $document->getParent());
@@ -380,7 +380,7 @@ public function testParentMappingWithCustomProperty()
{
$transformer = $this->getTransformer();
$document = $transformer->transform(new POPO(), array(
- '_parent' => array('type' => 'upper', 'property'=>'upperAlias', 'identifier' => 'id'),
+ '_parent' => array('type' => 'upper', 'property' => 'upperAlias', 'identifier' => 'id'),
));
$this->assertEquals("parent", $document->getParent());
diff --git a/Transformer/ElasticaToModelTransformerCollection.php b/Transformer/ElasticaToModelTransformerCollection.php
index f65f8db21..041e361c4 100644
--- a/Transformer/ElasticaToModelTransformerCollection.php
+++ b/Transformer/ElasticaToModelTransformerCollection.php
@@ -41,6 +41,7 @@ public function getIdentifierField()
/**
* @param Document[] $elasticaObjects
+ *
* @return array
*/
public function transform(array $elasticaObjects)
@@ -51,12 +52,12 @@ public function transform(array $elasticaObjects)
}
$transformed = array();
- foreach ($sorted AS $type => $objects) {
+ foreach ($sorted as $type => $objects) {
$transformedObjects = $this->transformers[$type]->transform($objects);
- $identifierGetter = 'get' . ucfirst($this->transformers[$type]->getIdentifierField());
+ $identifierGetter = 'get'.ucfirst($this->transformers[$type]->getIdentifierField());
$transformed[$type] = array_combine(
array_map(
- function($o) use ($identifierGetter) {
+ function ($o) use ($identifierGetter) {
return $o->$identifierGetter();
},
$transformedObjects
diff --git a/Transformer/ElasticaToModelTransformerInterface.php b/Transformer/ElasticaToModelTransformerInterface.php
index 5635ef3ef..71cd651e9 100644
--- a/Transformer/ElasticaToModelTransformerInterface.php
+++ b/Transformer/ElasticaToModelTransformerInterface.php
@@ -3,32 +3,33 @@
namespace FOS\ElasticaBundle\Transformer;
/**
- * Maps Elastica documents with model objects
+ * Maps Elastica documents with model objects.
*/
interface ElasticaToModelTransformerInterface
{
/**
* Transforms an array of elastica objects into an array of
- * model objects fetched from the doctrine repository
+ * model objects fetched from the doctrine repository.
*
* @param array $elasticaObjects array of elastica objects
+ *
* @return array of model objects
**/
- function transform(array $elasticaObjects);
+ public function transform(array $elasticaObjects);
- function hybridTransform(array $elasticaObjects);
+ public function hybridTransform(array $elasticaObjects);
/**
* Returns the object class used by the transformer.
*
* @return string
*/
- function getObjectClass();
+ public function getObjectClass();
/**
- * Returns the identifier field from the options
+ * Returns the identifier field from the options.
*
* @return string the identifier field
*/
- function getIdentifierField();
+ public function getIdentifierField();
}
diff --git a/Transformer/HighlightableModelInterface.php b/Transformer/HighlightableModelInterface.php
index d55407e6b..70b8ed349 100644
--- a/Transformer/HighlightableModelInterface.php
+++ b/Transformer/HighlightableModelInterface.php
@@ -1,16 +1,16 @@
- 'id'
+ 'identifier' => 'id',
);
/**
- * PropertyAccessor instance
+ * PropertyAccessor instance.
*
* @var PropertyAccessorInterface
*/
protected $propertyAccessor;
/**
- * Instanciates a new Mapper
+ * Instanciates a new Mapper.
*
* @param array $options
*/
@@ -39,7 +39,7 @@ public function __construct(array $options = array())
}
/**
- * Set the PropertyAccessor
+ * Set the PropertyAccessor.
*
* @param PropertyAccessorInterface $propertyAccessor
*/
@@ -49,7 +49,7 @@ public function setPropertyAccessor(PropertyAccessorInterface $propertyAccessor)
}
/**
- * Transforms an object into an elastica object having the required keys
+ * Transforms an object into an elastica object having the required keys.
*
* @param object $object the object to convert
* @param array $fields the keys we want to have in the returned array
@@ -63,7 +63,7 @@ public function transform($object, array $fields)
foreach ($fields as $key => $mapping) {
if ($key == '_parent') {
- $property = (null !== $mapping['property'])?$mapping['property']:$mapping['type'];
+ $property = (null !== $mapping['property']) ? $mapping['property'] : $mapping['type'];
$value = $this->propertyAccessor->getValue($object, $property);
$document->setParent($this->propertyAccessor->getValue($value, $mapping['identifier']));
continue;
@@ -96,10 +96,10 @@ public function transform($object, array $fields)
}
/**
- * transform a nested document or an object property into an array of ElasticaDocument
+ * transform a nested document or an object property into an array of ElasticaDocument.
*
* @param array|\Traversable|\ArrayAccess $objects the object to convert
- * @param array $fields the keys we want to have in the returned array
+ * @param array $fields the keys we want to have in the returned array
*
* @return array
*/
@@ -123,7 +123,7 @@ protected function transformNested($objects, array $fields)
}
/**
- * Attempts to convert any type to a string or an array of strings
+ * Attempts to convert any type to a string or an array of strings.
*
* @param mixed $value
*
@@ -131,12 +131,11 @@ protected function transformNested($objects, array $fields)
*/
protected function normalizeValue($value)
{
- $normalizeValue = function(&$v)
- {
+ $normalizeValue = function (&$v) {
if ($v instanceof \DateTime) {
$v = $v->format('c');
} elseif (!is_scalar($v) && !is_null($v)) {
- $v = (string)$v;
+ $v = (string) $v;
}
};
diff --git a/Transformer/ModelToElasticaIdentifierTransformer.php b/Transformer/ModelToElasticaIdentifierTransformer.php
index 7cf97e6e5..6301be1f8 100644
--- a/Transformer/ModelToElasticaIdentifierTransformer.php
+++ b/Transformer/ModelToElasticaIdentifierTransformer.php
@@ -6,12 +6,12 @@
/**
* Creates an Elastica document with the ID of
- * the Doctrine object as Elastica document ID
+ * the Doctrine object as Elastica document ID.
*/
class ModelToElasticaIdentifierTransformer extends ModelToElasticaAutoTransformer
{
/**
- * Creates an elastica document with the id of the doctrine object as id
+ * Creates an elastica document with the id of the doctrine object as id.
*
* @param object $object the object to convert
* @param array $fields the keys we want to have in the returned array
diff --git a/Transformer/ModelToElasticaTransformerInterface.php b/Transformer/ModelToElasticaTransformerInterface.php
index ec9ada37b..0ad9f128a 100644
--- a/Transformer/ModelToElasticaTransformerInterface.php
+++ b/Transformer/ModelToElasticaTransformerInterface.php
@@ -3,16 +3,17 @@
namespace FOS\ElasticaBundle\Transformer;
/**
- * Maps Elastica documents with model objects
+ * Maps Elastica documents with model objects.
*/
interface ModelToElasticaTransformerInterface
{
/**
- * Transforms an object into an elastica object having the required keys
+ * Transforms an object into an elastica object having the required keys.
*
* @param object $object the object to convert
- * @param array $fields the keys we want to have in the returned array
+ * @param array $fields the keys we want to have in the returned array
+ *
* @return \Elastica\Document
**/
- function transform($object, array $fields);
+ public function transform($object, array $fields);
}