@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * Repository constructor. |
| 54 | 54 | * @param $name |
| 55 | - * @param $manager |
|
| 55 | + * @param \Pouzor\MongoDBBundle\DocumentManager\DocumentManager $manager |
|
| 56 | 56 | */ |
| 57 | 57 | public function __construct($name, $manager) |
| 58 | 58 | { |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | /** |
| 546 | 546 | * Return the max value for a field in a collection |
| 547 | 547 | * |
| 548 | - * @param $field |
|
| 548 | + * @param string $field |
|
| 549 | 549 | * @param array $query |
| 550 | 550 | * @param array $options |
| 551 | 551 | * @return mixed |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | /** |
| 583 | 583 | * Return the min value for a field in a collection |
| 584 | 584 | * |
| 585 | - * @param $field |
|
| 585 | + * @param string $field |
|
| 586 | 586 | * @param array $query |
| 587 | 587 | * @param array $options |
| 588 | 588 | * @return \Traversable |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | if (preg_match($regex, $re->getMessage(), $output)) { |
| 93 | 93 | $name = $output['name']; |
| 94 | 94 | |
| 95 | - $this->logger->info('Dropping index ' . $name); |
|
| 95 | + $this->logger->info('Dropping index '.$name); |
|
| 96 | 96 | $result = $this->collection->dropIndex($name); |
| 97 | 97 | |
| 98 | - $this->logger->info('Result from dropping index ' . $name, $result); |
|
| 98 | + $this->logger->info('Result from dropping index '.$name, $result); |
|
| 99 | 99 | |
| 100 | 100 | $this->ensureIndex($fields, $options, $callback); |
| 101 | 101 | } |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | $query = [$field => ['$gt' => $min, '$lte' => $max]]; |
| 520 | 520 | |
| 521 | 521 | $this->logger->info( |
| 522 | - 'Counting ' . $field, |
|
| 522 | + 'Counting '.$field, |
|
| 523 | 523 | [ |
| 524 | 524 | 'filter' => [ |
| 525 | 525 | $field => ['$gt' => $min, '$lte' => $max] |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | ] |
| 576 | 576 | )->toArray(); |
| 577 | 577 | |
| 578 | - return ArrayAccessor::dget($result, '0.' . $field); |
|
| 578 | + return ArrayAccessor::dget($result, '0.'.$field); |
|
| 579 | 579 | |
| 580 | 580 | } |
| 581 | 581 | |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | ] |
| 613 | 613 | )->toArray(); |
| 614 | 614 | |
| 615 | - return ArrayAccessor::dget($result, '0.' . $field); |
|
| 615 | + return ArrayAccessor::dget($result, '0.'.$field); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | /** |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | { |
| 626 | 626 | |
| 627 | 627 | $this->logger->info( |
| 628 | - 'Distinct over ' . $field, |
|
| 628 | + 'Distinct over '.$field, |
|
| 629 | 629 | [ |
| 630 | 630 | 'filter' => $filter, |
| 631 | 631 | 'options' => $options, |
@@ -667,28 +667,28 @@ discard block |
||
| 667 | 667 | * Sort |
| 668 | 668 | */ |
| 669 | 669 | if (isset($options[Query::SORT]) && !is_array($options[Query::SORT])) { |
| 670 | - throw new \InvalidArgumentException(Query::SORT . ' option must be an array'); |
|
| 670 | + throw new \InvalidArgumentException(Query::SORT.' option must be an array'); |
|
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | /** |
| 674 | 674 | * Proj |
| 675 | 675 | */ |
| 676 | 676 | if (isset($options[Query::PROJECTION]) && !is_array($options[Query::PROJECTION])) { |
| 677 | - throw new \InvalidArgumentException(Query::PROJECTION . ' option must be an array'); |
|
| 677 | + throw new \InvalidArgumentException(Query::PROJECTION.' option must be an array'); |
|
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | /** |
| 681 | 681 | * limit |
| 682 | 682 | */ |
| 683 | 683 | if (isset($options[Query::LIMIT]) && !is_integer($options[Query::LIMIT])) { |
| 684 | - throw new \InvalidArgumentException(Query::LIMIT . " option must be an integer"); |
|
| 684 | + throw new \InvalidArgumentException(Query::LIMIT." option must be an integer"); |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | /** |
| 688 | 688 | * offset |
| 689 | 689 | */ |
| 690 | 690 | if (isset($options[Query::OFFSET]) && !is_integer($options[Query::OFFSET])) { |
| 691 | - throw new \InvalidArgumentException(Query::OFFSET . ' option must be an array'); |
|
| 691 | + throw new \InvalidArgumentException(Query::OFFSET.' option must be an array'); |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | // TODO validate other options |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | // note that this method is called loadInternal and not load |
| 22 | 22 | protected function loadInternal(array $mergedConfig, ContainerBuilder $container) |
| 23 | 23 | { |
| 24 | - $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 24 | + $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 25 | 25 | $loader->load('services.yml'); |
| 26 | 26 | |
| 27 | 27 | foreach ($mergedConfig['connections'] as $name => $con) { |
@@ -30,15 +30,15 @@ discard block |
||
| 30 | 30 | file_get_contents($con['schema']) |
| 31 | 31 | ); |
| 32 | 32 | |
| 33 | - $def = $container->register('document.manager.' . $name, DocumentManager::class); |
|
| 33 | + $def = $container->register('document.manager.'.$name, DocumentManager::class); |
|
| 34 | 34 | $def->addTag('document.manager', ['name' => $name]); |
| 35 | 35 | $def->setArguments([$con, new Reference('logger')]); |
| 36 | 36 | $def->addTag('monolog.logger', ['channel' => 'odm.mongo']); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | if (isset($mergedConfig['default_connection']) && $container->hasDefinition( |
| 40 | - 'document.manager.' . $mergedConfig['default_connection'])) { |
|
| 41 | - $container->setAlias('document.manager', 'document.manager.' . $mergedConfig['default_connection']); |
|
| 40 | + 'document.manager.'.$mergedConfig['default_connection'])) { |
|
| 41 | + $container->setAlias('document.manager', 'document.manager.'.$mergedConfig['default_connection']); |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -195,8 +195,9 @@ |
||
| 195 | 195 | */ |
| 196 | 196 | public static function get_key_exist($array, $key, $default = null) { |
| 197 | 197 | |
| 198 | - if (isset($array[$key])) |
|
| 199 | - return $array[$key]; |
|
| 198 | + if (isset($array[$key])) { |
|
| 199 | + return $array[$key]; |
|
| 200 | + } |
|
| 200 | 201 | |
| 201 | 202 | return $default; |
| 202 | 203 | |