Passed
Push — master ( 8cf222...7fa05a )
by Stephen
04:50
created

ImgShieldsUrl   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 26
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A withGlobalParams() 0 7 2
1
<?php
2
3
namespace Sfneal\Dependencies\Utils;
4
5
class ImgShieldsUrl extends Url
6
{
7
    /**
8
     * Url constructor.
9
     *
10
     * @param  string  $uri
11
     * @param  array|null  $params
12
     */
13
    public function __construct(string $uri, array $params = null)
14
    {
15
        parent::__construct('img.shields.io/'.$uri, $params);
16
    }
17
18
    /**
19
     * Merge global Img Shields params with the original params.
20
     *
21
     * @param  array|null  $globalParams
22
     * @return $this
23
     */
24
    public function withGlobalParams(array $globalParams = null): self
25
    {
26
        if (! is_null($globalParams)) {
27
            $this->params = array_merge($this->params ?? [], $globalParams);
28
        }
29
30
        return $this;
31
    }
32
}
33