1 | <?php |
||
13 | abstract class AbstractServiceAdapter implements VideoAdapterInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | public $rawUrl; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | public $videoId; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | public $pattern; |
||
29 | |||
30 | /** |
||
31 | * @var EmbedRendererInterface |
||
32 | */ |
||
33 | public $renderer; |
||
34 | |||
35 | /** |
||
36 | * AbstractVideoAdapter constructor. |
||
37 | * |
||
38 | * @param string $url |
||
39 | * @param string $pattern |
||
40 | * @param EmbedRendererInterface $renderer |
||
41 | */ |
||
42 | 51 | public function __construct($url, $pattern, EmbedRendererInterface $renderer) |
|
43 | { |
||
44 | 51 | $this->rawUrl = $url; |
|
|
|||
45 | 51 | $this->pattern = $pattern; |
|
46 | 51 | $this->renderer = $renderer; |
|
47 | 51 | } |
|
48 | |||
49 | /** |
||
50 | * Returns the input URL. |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | 2 | public function getRawUrl() |
|
58 | |||
59 | /** |
||
60 | * @param string $rawUrl |
||
61 | */ |
||
62 | 1 | public function setRawUrl($rawUrl) |
|
66 | |||
67 | /** |
||
68 | * @return string |
||
69 | */ |
||
70 | 17 | public function getVideoId() |
|
74 | |||
75 | /** |
||
76 | * @param string $videoId |
||
77 | */ |
||
78 | 51 | public function setVideoId($videoId) |
|
82 | |||
83 | /** |
||
84 | * @return string |
||
85 | */ |
||
86 | 2 | public function getPattern() |
|
90 | |||
91 | /** |
||
92 | * @param string $pattern |
||
93 | */ |
||
94 | 1 | public function setPattern($pattern) |
|
98 | |||
99 | /** |
||
100 | * @return EmbedRendererInterface |
||
101 | */ |
||
102 | 2 | public function getRenderer() |
|
106 | |||
107 | /** |
||
108 | * @param EmbedRendererInterface $renderer |
||
109 | */ |
||
110 | 1 | public function setRenderer($renderer) |
|
114 | |||
115 | /** |
||
116 | * @param int $width |
||
117 | * @param int $height |
||
118 | * @param bool $autoplay |
||
119 | * |
||
120 | * @return string |
||
121 | * |
||
122 | * @throws NotEmbeddableException |
||
123 | */ |
||
124 | 1 | public function getEmbedCode($width, $height, $autoplay = false, $secure = false) |
|
132 | |||
133 | /** |
||
134 | * Switches the protocol scheme between http and https |
||
135 | * |
||
136 | * @param bool|false $secure |
||
137 | * @return string |
||
138 | */ |
||
139 | public function getScheme($secure = false) |
||
143 | } |
||
144 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.