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 Knp\Rad\FixturesLoad\FixturesFactory; |
||
6 | |||
7 | use Doctrine\Common\Persistence\ObjectManager; |
||
8 | use Nelmio\Alice\Fixtures; |
||
9 | use Nelmio\Alice\Persister\Doctrine; |
||
10 | |||
11 | class PersisterFactory extends LegacyFactory |
||
12 | { |
||
13 | /** |
||
14 | * {@inheritdoc} |
||
15 | */ |
||
16 | View Code Duplication | public function create(ObjectManager $om, $locale = null): Fixtures |
|
0 ignored issues
–
show
|
|||
17 | { |
||
18 | $options = [ |
||
19 | 'providers' => $this->providers, |
||
20 | ]; |
||
21 | |||
22 | if (null !== $locale) { |
||
23 | $options['locale'] = $locale; |
||
24 | } |
||
25 | |||
26 | $doctrinePersister = new Doctrine($om); |
||
27 | |||
28 | return new Fixtures($doctrinePersister, $options, $this->processors); |
||
29 | } |
||
30 | } |
||
31 |
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.