Framework   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 22
c 1
b 0
f 0
dl 0
loc 49
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A htmlFooter() 0 6 1
A __construct() 0 3 1
A htmlHead() 0 20 1
A editableCompose() 0 3 1
A viewableCompose() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Formularium\Frontend\Bootstrap;
4
5
use Formularium\FrameworkComposer;
6
use Formularium\HTMLNode;
7
8
class Framework extends \Formularium\Framework
9
{
10
    public function __construct(string $name = 'Bootstrap')
11
    {
12
        parent::__construct($name);
13
    }
14
15
    public function htmlHead(HTMLNode &$head)
16
    {
17
        $head->appendContent(
18
            HTMLNode::factory('meta', ['name' => "viewport", 'content' => "width=device-width, initial-scale=1"])
19
        )->appendContent(
20
            HTMLNode::factory(
21
                'link',
22
                [
23
                    'rel' => "stylesheet",
24
                    'href' => "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css",
25
                    'integrity' => "sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh",
26
                    'crossorigin' => "anonymous"
27
                ]
28
            )
29
        )->appendContent(
30
            HTMLNode::factory(
31
                'link',
32
                [
33
                    'rel' => "stylesheet",
34
                    'href' => "https://use.fontawesome.com/releases/v5.2.0/css/all.css",
35
                ]
36
            )
37
        );
38
    }
39
40
    public function htmlFooter(HTMLNode &$footer)
41
    {
42
        $footer->appendContent([
43
            HTMLNode::factory('script', ['src' => "https://code.jquery.com/jquery-3.4.1.slim.min.js", 'integrity' => "sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n", 'crossorigin' => "anonymous"]),
44
            HTMLNode::factory('script', ['src' => "https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js", 'integrity' => "sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo", 'crossorigin' => "anonymous"]),
45
            HTMLNode::factory('script', ['src' => "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js", 'integrity' => "sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6", 'crossorigin' => "anonymous"])
46
        ]);
47
    }
48
49
    public function viewableCompose(\Formularium\Model $m, array $elements, string $previousCompose, FrameworkComposer $composer): string
50
    {
51
        return '<section class="section"><div class="container">' . $previousCompose . '</div></section>';
52
    }
53
54
    public function editableCompose(\Formularium\Model $m, array $elements, string $previousCompose, FrameworkComposer $composer): string
55
    {
56
        return '<section class="section"><div class="container">' . $previousCompose . '</div></section>';
57
    }
58
}
59