Branding::link()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 3
eloc 2
nc 4
nop 3
crap 12
1
<?php
2
3
namespace Zoutapps\Laravel\Backpack\Branding;
4
5
use Illuminate\Support\Facades\Config;
6
7
class Branding
8
{
9
    public function asset($key)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
10
    {
11
        return asset($this->get('asset.' . $key));
12
    }
13
14
    public function link($content = null, $class = null, $target = '_blank')
15
    {
16
        return '<a href="' . $this->url() . '" ' . ($class ? 'class="' . $class . '" ' : '') . 'target="' . $target . '">' . ($content ? $content : $this->url()) . '</a>';
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 171 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
17
    }
18
19
    public function developer()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
20
    {
21
        return $this->get('developer');
22
    }
23
24
    public function url()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
25
    {
26
        return $this->get('url');
27
    }
28
29
    private function get($key)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
30
    {
31
        $configKey = 'zoutapps.branding.' . $key;
32
33
        if (!Config::has($configKey)) {
34
            throw new \InvalidArgumentException('Your branding value ' . $key . ' is not specified. Please add the desired value to <comment>config/zoutapps/branding.php</comment> in order to use it.');
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 202 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
35
        }
36
37
        return config($configKey);
38
    }
39
}