LinkHelper   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 38
ccs 8
cts 8
cp 1
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 5 2
A __construct() 0 3 1
A name() 0 3 1
1
<?php
2
3
namespace Staticka\Helpers;
4
5
use Staticka\Contracts\HelperContract;
6
7
/**
8
 * Link Helper
9
 *
10
 * @package Staticka
11
 * @author  Rougin Gutib <[email protected]>
12
 */
13
class LinkHelper implements HelperContract
14
{
15
    /**
16
     * @var string
17
     */
18
    protected $base;
19
20
    /**
21
     * Initializes the URL instance.
22
     *
23
     * @param string $base
24
     */
25 9
    public function __construct($base)
26
    {
27 9
        $this->base = $base;
28 9
    }
29
30
    /**
31
     * Returns the name of the helper.
32
     *
33
     * @return string
34
     */
35 6
    public function name()
36
    {
37 6
        return 'url';
38
    }
39
40
    /**
41
     * Sets the specified link.
42
     *
43
     * @param  string $link
44
     * @return string
45
     */
46 6
    public function set($link)
47
    {
48 6
        $link = $link[0] !== '/' ? '/' . $link : $link;
49
50 6
        return $this->base . $link;
51
    }
52
}
53