Completed
Push — master ( 4e4cd8...063296 )
by Maksim
16s
created

PrePersistEvent   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 72
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 1
dl 72
loc 72
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A getPager() 4 4 1
A setPager() 4 4 1
A getOptions() 4 4 1
A setOptions() 4 4 1
A getObjectPersister() 4 4 1
A setObjectPersister() 4 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
namespace FOS\ElasticaBundle\Persister\Event;
3
4
use FOS\ElasticaBundle\Persister\ObjectPersisterInterface;
5
use FOS\ElasticaBundle\Provider\PagerInterface;
6
use Symfony\Component\EventDispatcher\Event;
7
8 View Code Duplication
final class PrePersistEvent extends Event
0 ignored issues
show
Duplication introduced by
This class 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.

Loading history...
9
{
10
    /**
11
     * @var PagerInterface
12
     */
13
    private $pager;
14
15
    /**
16
     * @var ObjectPersisterInterface
17
     */
18
    private $objectPersister;
19
20
    /**
21
     * @var array
22
     */
23
    private $options;
24
25 15
    public function __construct(PagerInterface $pager, ObjectPersisterInterface $objectPersister, array $options)
26
    {
27 15
        $this->pager = $pager;
28 15
        $this->objectPersister = $objectPersister;
29 15
        $this->options = $options;
30 15
    }
31
32
    /**
33
     * @return PagerInterface
34
     */
35 10
    public function getPager()
36
    {
37 10
        return $this->pager;
38
    }
39
40
    /**
41
     * @param PagerInterface $pager
42
     */
43 1
    public function setPager($pager)
44
    {
45 1
        $this->pager = $pager;
46 1
    }
47
48
    /**
49
     * @return array
50
     */
51 10
    public function getOptions()
52
    {
53 10
        return $this->options;
54
    }
55
56
    /**
57
     * @param array $options
58
     */
59 1
    public function setOptions(array $options)
60
    {
61 1
        $this->options = $options;
62 1
    }
63
64
    /**
65
     * @return ObjectPersisterInterface
66
     */
67 3
    public function getObjectPersister()
68
    {
69 3
        return $this->objectPersister;
70
    }
71
72
    /**
73
     * @param ObjectPersisterInterface $objectPersister
74
     */
75 1
    public function setObjectPersister(ObjectPersisterInterface $objectPersister)
76
    {
77 1
        $this->objectPersister = $objectPersister;
78 1
    }
79
}
80