Filter   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 63
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 4
A getType() 0 4 1
A getMethod() 0 4 1
A getService() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: polidog
5
 * Date: 2017/05/12
6
 * Time: 19:13.
7
 */
8
9
namespace Polidog\ControllerFilterBundle\Annotations;
10
11
use Doctrine\Common\Annotations\Annotation\Target;
12
13
/**
14
 * @Annotation
15
 * @Target({"METHOD","CLASS"})
16
 */
17
final class Filter implements FilterInterface
18
{
19
    const TYPE_BEFORE = 'before';
20
21
    const TYPE_AFTER = 'after';
22
23
    /**
24
     * @var string
25
     */
26
    private $type;
27
28
    /**
29
     * @var string
30
     */
31
    private $method;
32
33
    /**
34
     * @var string
35
     */
36
    private $service;
37
38
    /**
39
     * Filter constructor.
40
     *
41
     * @param array $params
42
     */
43
    public function __construct(array $params)
44
    {
45
        if (isset($params['value'])) {
46
            $this->type = (string) $params['value'];
47
        }
48
49
        foreach (['method', 'service', 'type'] as $target) {
50
            if (isset($params[$target])) {
51
                $this->$target = $params[$target];
52
            }
53
        }
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function getType()
60
    {
61
        return $this->type;
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function getMethod(): string
68
    {
69
        return $this->method;
70
    }
71
72
    /**
73
     * @return string
74
     */
75
    public function getService(): string
76
    {
77
        return $this->service;
78
    }
79
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
80