This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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\Benchmark\Document; |
||
6 | |||
7 | use DateTimeImmutable; |
||
8 | use Doctrine\ODM\MongoDB\Benchmark\BaseBench; |
||
9 | use Documents\Account; |
||
10 | use Documents\Address; |
||
11 | use Documents\Group; |
||
12 | use Documents\Phonenumber; |
||
13 | use Documents\User; |
||
14 | use PhpBench\Benchmark\Metadata\Annotations\Warmup; |
||
15 | |||
16 | final class StoreDocumentBench extends BaseBench |
||
17 | { |
||
18 | /** |
||
19 | * @Warmup(2) |
||
20 | */ |
||
21 | public function benchStoreDocument() |
||
22 | { |
||
23 | $user = new User(); |
||
24 | $user->setUsername('alcaeus'); |
||
25 | $user->setCreatedAt(new DateTimeImmutable()); |
||
0 ignored issues
–
show
|
|||
26 | |||
27 | $this->getDocumentManager()->persist($user); |
||
28 | $this->getDocumentManager()->flush(); |
||
29 | $this->getDocumentManager()->clear(); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @Warmup(2) |
||
34 | */ |
||
35 | public function benchStoreDocumentWithEmbedOne() |
||
36 | { |
||
37 | $address = new Address(); |
||
38 | $address->setAddress('Redacted'); |
||
0 ignored issues
–
show
The method
setAddress() does not seem to exist on object<Documents\Address> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
39 | $address->setCity('Munich'); |
||
40 | |||
41 | $user = new User(); |
||
42 | $user->setUsername('alcaeus'); |
||
43 | $user->setCreatedAt(new DateTimeImmutable()); |
||
0 ignored issues
–
show
The method
setCreatedAt() does not seem to exist on object<Documents\User> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
44 | $user->setAddress($address); |
||
45 | |||
46 | $this->getDocumentManager()->persist($user); |
||
47 | $this->getDocumentManager()->flush(); |
||
48 | $this->getDocumentManager()->clear(); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @Warmup(2) |
||
53 | */ |
||
54 | View Code Duplication | public function benchStoreDocumentWithEmbedMany() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
55 | { |
||
56 | $user = new User(); |
||
57 | $user->setUsername('alcaeus'); |
||
58 | $user->setCreatedAt(new DateTimeImmutable()); |
||
0 ignored issues
–
show
The method
setCreatedAt() does not seem to exist on object<Documents\User> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
59 | $user->addPhonenumber(new Phonenumber('12345678')); |
||
60 | $user->addPhonenumber(new Phonenumber('12345678')); |
||
61 | |||
62 | $this->getDocumentManager()->persist($user); |
||
63 | $this->getDocumentManager()->flush(); |
||
64 | $this->getDocumentManager()->clear(); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @Warmup(2) |
||
69 | */ |
||
70 | View Code Duplication | public function benchStoreDocumentWithReferenceOne() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
71 | { |
||
72 | $account = new Account(); |
||
0 ignored issues
–
show
|
|||
73 | $account->setName('alcaeus'); |
||
74 | |||
75 | $user = new User(); |
||
76 | $user->setUsername('alcaeus'); |
||
77 | $user->setCreatedAt(new DateTimeImmutable()); |
||
0 ignored issues
–
show
The method
setCreatedAt() does not seem to exist on object<Documents\User> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
78 | $user->setAccount($account); |
||
79 | |||
80 | $this->getDocumentManager()->persist($user); |
||
81 | $this->getDocumentManager()->flush(); |
||
82 | $this->getDocumentManager()->clear(); |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * @Warmup(2) |
||
87 | */ |
||
88 | public function benchStoreDocumentWithReferenceMany() |
||
89 | { |
||
90 | $group1 = new Group('One'); |
||
91 | $group2 = new Group('Two'); |
||
92 | |||
93 | $user = new User(); |
||
94 | $user->setUsername('alcaeus'); |
||
95 | $user->setCreatedAt(new DateTimeImmutable()); |
||
0 ignored issues
–
show
The method
setCreatedAt() does not seem to exist on object<Documents\User> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
96 | $user->addGroup($group1); |
||
0 ignored issues
–
show
The method
addGroup() does not seem to exist on object<Documents\User> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
97 | $user->addGroup($group2); |
||
0 ignored issues
–
show
The method
addGroup() does not seem to exist on object<Documents\User> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
98 | |||
99 | $this->getDocumentManager()->persist($user); |
||
100 | $this->getDocumentManager()->flush(); |
||
101 | $this->getDocumentManager()->clear(); |
||
102 | } |
||
103 | } |
||
104 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.