Completed
Push — master ( 1c163b...8360e1 )
by Oliver
03:25
created

Branding::asset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
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($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 153 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
30
    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...
31
    {
32
        $configKey = 'zoutapps.branding.' . $key;
33
34
        if (!Config::has($configKey)) {
35
            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 201 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...
36
        }
37
38
        return config($configKey);
39
    }
40
}