Conditions | 3 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
1 | <?php |
||
43 | 2 | public function execute(array $arguments) : array |
|
44 | { |
||
45 | 2 | $entityManagerName = 'default'; |
|
46 | 2 | $firstArgument = reset($arguments); |
|
47 | |||
48 | 2 | if (is_string($firstArgument)) { |
|
49 | 1 | $entityManagerName = array_shift($arguments); |
|
50 | } |
||
51 | |||
52 | 2 | $entityManager = $this->getEntityManagerByName($entityManagerName); |
|
53 | |||
54 | 2 | foreach ($arguments as $argument) { |
|
55 | 2 | $entityManager->persist($argument); |
|
56 | } |
||
57 | |||
58 | 2 | $entityManager->flush(); |
|
59 | |||
60 | 2 | return $arguments; |
|
61 | } |
||
62 | } |
||
63 |