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

Branding   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 0
loc 34
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A asset() 0 4 1
A link() 0 4 3
A developer() 0 4 1
A url() 0 4 1
A get() 0 10 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
}