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

Component   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 47
rs 10
wmc 4
lcom 1
cbo 3

5 Methods

Rating   Name   Duplication   Size   Complexity  
render() 0 1 ?
A getGrid() 0 4 1
A setGrid() 0 4 1
A getName() 0 4 1
A tag() 0 4 1
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