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

HeadElements::jqueryUiCss()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
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
}