Completed
Push — master ( 6ec6b5...364731 )
by Adam
02:30
created

Component::getGrid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Boduch\Grid\Components;
4
5
use Boduch\Grid\Grid;
6
7
abstract class Component
8
{
9
    /**
10
     * @var Grid
11
     */
12
    protected $grid;
13
14
    /**
15
     * @return mixed
16
     */
17
    abstract public function render();
18
19
    /**
20
     * @return Grid
21
     */
22
    public function getGrid()
23
    {
24
        return $this->grid;
25
    }
26
27
    /**
28
     * @param Grid $grid
29
     */
30
    public function setGrid(Grid $grid)
31
    {
32
        $this->grid = $grid;
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getName()
39
    {
40
        return snake_case(class_basename($this));
41
    }
42
43
    /**
44
     * @param string $tag
45
     * @param string $content
46
     * @param array $attributes
47
     * @return \Illuminate\Support\HtmlString
48
     */
49
    protected function tag($tag, $content, array $attributes = [])
50
    {
51
        return $this->grid->getGridHelper()->getHtmlBuilder()->tag($tag, $content, $attributes);
52
    }
53
}
54