PostInsertObjectsEvent   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 13.21 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 7
loc 53
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 7 7 1
A getPager() 0 4 1
A getOptions() 0 4 1
A getObjectPersister() 0 4 1
A getObjects() 0 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/*
4
 * This file is part of the FOSElasticaBundle package.
5
 *
6
 * (c) FriendsOfSymfony <https://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\ElasticaBundle\Persister\Event;
13
14
use FOS\ElasticaBundle\Persister\ObjectPersisterInterface;
15
use FOS\ElasticaBundle\Provider\PagerInterface;
16
use Symfony\Contracts\EventDispatcher\Event;
17
18
final class PostInsertObjectsEvent extends Event implements PersistEvent
19
{
20
    /**
21
     * @var PagerInterface
22
     */
23
    private $pager;
24
25
    /**
26
     * @var ObjectPersisterInterface
27
     */
28
    private $objectPersister;
29
30
    /**
31
     * @var object[]
32
     */
33
    private $objects;
34
35
    /**
36
     * @var array
37
     */
38
    private $options;
39
40 20 View Code Duplication
    public function __construct(PagerInterface $pager, ObjectPersisterInterface $objectPersister, array $objects, array $options)
41
    {
42 20
        $this->pager = $pager;
43 20
        $this->objectPersister = $objectPersister;
44 20
        $this->objects = $objects;
45 20
        $this->options = $options;
46 20
    }
47
48 6
    public function getPager(): PagerInterface
49
    {
50 6
        return $this->pager;
51
    }
52
53 2
    public function getOptions(): array
54
    {
55 2
        return $this->options;
56
    }
57
58 2
    public function getObjectPersister(): ObjectPersisterInterface
59
    {
60 2
        return $this->objectPersister;
61
    }
62
63
    /**
64
     * @return object[]
65
     */
66 2
    public function getObjects(): array
67
    {
68 2
        return $this->objects;
69
    }
70
}
71