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

AbstractProvider::getFormClasses()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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