These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Doctrine\ODM\MongoDB\Aggregation\Stage; |
||
6 | |||
7 | use Doctrine\Common\Persistence\Mapping\MappingException as BaseMappingException; |
||
8 | use Doctrine\ODM\MongoDB\Aggregation\Builder; |
||
9 | use Doctrine\ODM\MongoDB\Aggregation\Stage; |
||
10 | use Doctrine\ODM\MongoDB\DocumentManager; |
||
11 | use Doctrine\ODM\MongoDB\Mapping\ClassMetadata; |
||
12 | use Doctrine\ODM\MongoDB\Mapping\MappingException; |
||
13 | |||
14 | class Out extends Stage |
||
15 | { |
||
16 | /** @var DocumentManager */ |
||
17 | private $dm; |
||
18 | |||
19 | /** @var string */ |
||
20 | private $collection; |
||
21 | |||
22 | 6 | public function __construct(Builder $builder, string $collection, DocumentManager $documentManager) |
|
23 | { |
||
24 | 6 | parent::__construct($builder); |
|
25 | |||
26 | 6 | $this->dm = $documentManager; |
|
27 | 6 | $this->out($collection); |
|
28 | 5 | } |
|
29 | |||
30 | /** |
||
31 | * {@inheritdoc} |
||
32 | */ |
||
33 | 5 | public function getExpression() : array |
|
34 | { |
||
35 | return [ |
||
36 | 5 | '$out' => $this->collection, |
|
37 | ]; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | 6 | public function out(string $collection) : Stage\Out |
|
44 | { |
||
45 | try { |
||
46 | 6 | $class = $this->dm->getClassMetadata($collection); |
|
47 | 4 | } catch (BaseMappingException $e) { |
|
0 ignored issues
–
show
|
|||
48 | 4 | $this->collection = $collection; |
|
49 | 4 | return $this; |
|
50 | } |
||
51 | |||
52 | 2 | $this->fromDocument($class); |
|
53 | 1 | return $this; |
|
54 | } |
||
55 | |||
56 | 2 | private function fromDocument(ClassMetadata $classMetadata) : void |
|
57 | { |
||
58 | 2 | if ($classMetadata->isSharded()) { |
|
59 | 1 | throw MappingException::cannotUseShardedCollectionInOutStage($classMetadata->name); |
|
60 | } |
||
61 | |||
62 | 1 | $this->collection = $classMetadata->getCollection(); |
|
63 | 1 | } |
|
64 | } |
||
65 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.