Completed
Push — dev ( 72cd7e...c5a23f )
by James Ekow Abaka
05:21
created

ListingHelper   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 47
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A stylesheet() 0 4 1
A help() 0 5 1
A __toString() 0 6 3
1
<?php
2
3
namespace ntentan\honam\engines\php\helpers;
4
5
use ntentan\honam\engines\php\Helper;
6
7
8
class ListingHelper extends Helper
9
{
10
    private $parameters =        array(
11
          "headers"               =>  array(),
12
          "data"                  =>  array(),
13
          "row_template"          =>  null,
14
          "cell_templates"        =>  null,
15
          "default_cell_template" =>  null,
16
          "variables"             =>  null
17
       );
18
    
19
    public function __construct() 
20
    {
21
        TemplateEngine::appendPath(
22
            __DIR__ . "/../../templates/lists"
23
        );
24
    }
25
    
26
    public function stylesheet()
27
    {
28
        return __DIR__ . '/../../assets/css/lists/lists.css';
29
    }
30
    
31
    /**
32
     *  array(
33
     *     "headers"               =>  $this->headers,
34
     *     "data"                  =>  $this->data,
35
     *     "row_template"          =>  $this->rowTemplate,
36
     *     "cell_templates"        =>  $this->cellTemplates,
37
     *     "default_cell_template" =>  $this->defaultCellTemplate,
38
     *     "variables"             =>  $this->variables,
39
     *  )
40
     * @param type $arguments
41
     */
42
    public function help($arguments)
43
    {
44
        $this->parameters = array_merge($this->parameters, $arguments);
45
        return $this;
46
    }
47
48
    public function __toString()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
49
    {
50
        $this->parameters['row_template'] = $this->parameters['row_template'] == null ? 'row.tpl.php' : $this->parameters['row_template'];
51
        $this->parameters['default_cell_template'] = $this->parameters['default_cell_template'] == null ? 'default_cell.tpl.php' : $this->parameters['default_cell_template'];
52
        return TemplateEngine::render('list.tpl.php', $this->parameters);
53
    }
54
}
55
56