Completed
Push — master ( bf71a3...ce0169 )
by Nikolas
03:09
created

HeadElements   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 9
c 3
b 0
f 0
lcom 2
cbo 1
dl 0
loc 49
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A jquery() 0 3 1
A jqueryUi() 0 3 1
A jqueryUiCss() 0 3 1
A bootstrap() 0 3 1
A bootstrapJs() 0 3 1
A fontAwesome() 0 3 1
A script() 0 5 1
A style() 0 6 1
A filter() 0 5 1
1
<?php
2
namespace rtens\domin\delivery\web;
3
4
class HeadElements {
5
6
    public static function jquery() {
7
        return self::script('//code.jquery.com/jquery-2.1.4.min.js');
8
    }
9
10
    public static function jqueryUi() {
11
        return self::script('//code.jquery.com/ui/1.11.4/jquery-ui.min.js');
12
    }
13
14
    public static function jqueryUiCss() {
15
        return self::style('//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css');
16
    }
17
18
    public static function bootstrap() {
19
        return self::style('//netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css');
20
    }
21
22
    public static function bootstrapJs() {
23
        return self::script('//netdna.bootstrapcdn.com/bootstrap/3.0.1/js/bootstrap.min.js');
24
    }
25
26
    public static function fontAwesome() {
27
        return self::style('//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css');
28
    }
29
30
    public static function script($src) {
31
        return new Element('script', [
32
            'src' => $src
33
        ]);
34
    }
35
36
    public static function style($href) {
37
        return new Element('link', [
38
            'rel' => 'stylesheet',
39
            'href' => $href
40
        ]);
41
    }
42
43
    /**
44
     * @param Element[] $headElements
45
     * @return array|string[]
46
     */
47
    public static function filter(array $headElements) {
48
        return array_values(array_unique(array_map(function (Element $element) {
49
            return (string)$element;
50
        }, $headElements)));
51
    }
52
}