Completed
Push — master ( 6137a2...6b103b )
by Denis
01:30
created

AbstractProvider   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 65
rs 10
c 0
b 0
f 0
wmc 6
lcom 3
cbo 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
setFormClasses() 0 1 ?
A __construct() 0 4 1
A orientation() 0 8 1
A getElementClasses() 0 4 1
A getViewsDirPath() 0 4 1
A getFormClasses() 0 4 1
A getCommonClasses() 0 4 1
1
<?php
2
3
namespace Ngtfkx\Laradeck\FormBuilder\Providers;
4
5
6
use Illuminate\Support\Collection;
7
8
abstract class AbstractProvider
9
{
10
    /**
11
     * @var string $cssFramework Тип верстки. Допустимые значения: html, bootstrap3, bootstrap4
12
     */
13
    protected $cssFramework;
14
15
    /**
16
     * @var string $orientation Тип верстки формы
17
     */
18
    protected $orientation;
19
20
    /**
21
     * @var string $formClasses Классы, которые надо назначить на форму
22
     */
23
    protected $formClasses = '';
24
25
    protected $commonClasses = '';
26
27
    protected $elementClasses;
28
29
    protected $orientationDir;
30
31
    public $skipCommonClassesForElements;
32
33
    abstract protected function setFormClasses();
34
35
    /**
36
     * AbstractLayout constructor.
37
     */
38
    public function __construct()
39
    {
40
        $this->elementClasses = new Collection($this->elementClasses);
41
    }
42
43
    public function orientation(?string $orientation = null): self
44
    {
45
        $this->orientation = $orientation;
46
47
        $this->setFormClasses();
48
49
        return $this;
50
    }
51
52
    public function getElementClasses(string $name): ?string
53
    {
54
        return $this->elementClasses->get($name);
55
    }
56
57
    public function getViewsDirPath(): string
58
    {
59
        return $this->cssFramework . '.' . $this->orientationDir;
60
    }
61
62
    public function getFormClasses(): string
63
    {
64
        return $this->formClasses;
65
    }
66
67
    public function getCommonClasses(): string
68
    {
69
        return $this->commonClasses;
70
    }
71
72
}