RowTemplate   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 2
Metric Value
wmc 4
eloc 11
c 3
b 0
f 2
dl 0
loc 24
ccs 11
cts 11
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A setTemplateData() 0 14 4
1
<?php
2
3
/**
4
 * @copyright Bluz PHP Team
5
 * @link https://github.com/bluzphp/bluzman
6
 */
7
8
namespace Bluzman\Generator\Template;
9
10
/**
11
 * RowTemplate
12
 *
13
 * @package  Bluzman\Generator\Template
14
 *
15
 * @author   Pavel Machekhin
16
 * @created  2013-04-16 15:35
17
 */
18
19
class RowTemplate extends AbstractTemplate
20
{
21
    /**
22
     * @var string
23
     */
24
    protected $templatePath = 'views/models/row.phtml';
25
26
    /**
27
     * @param array $templateData
28 1
     */
29
    public function setTemplateData(array $templateData)
30 1
    {
31 1
        $properties = '';
32 1
        if ($templateData['columns']) {
33 1
            $columns = $templateData['columns'];
34
            foreach ($columns as $column) {
35 1
                // all properties will be `string` except `bigint`, `int`, etc. columns
36 1
                $columnType = false !== strpos($column['type'], 'int') ? 'integer' : 'string';
37
                $properties .= ' * @property ' . $columnType . ' $' . $column['name'] . "\n";
38 1
            }
39
            unset($templateData['columns']);
40 1
        }
41 1
        $templateData['properties'] = $properties;
42 1
        $this->templateData = $templateData;
43
    }
44
}
45