Parametros::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
namespace src;
3
4
use src\Enlace;
5
use src\Metodo;
6
7
class Parametros
8
{
9
    private $_url;
10
    private $_metodo;
11
12
    public function __construct(Enlace $url, Metodo $metodo)
13
    {
14
        $this->_url = $url->enlace();
15
        $this->_metodo = $metodo;
16
    }
17
18
    public function parametros(): array
19
    {
20
        unset($this->_url[0]);
21
22
        if (isset($this->_url[1])) {
23
            if ($this->_metodo->metodo() == $this->_url[1]) {
24
                unset($this->_url[1]);
25
            }
26
        }
27
28
        return $this->_url ? array_values($this->_url) : [];
29
    }
30
}
31