Completed
Push — master ( 9caa90...8321d8 )
by Tom
02:40
created

PropertyBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 9

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A registerBasicProperties() 0 13 2
1
<?php
2
/* @description     Transformation Style Sheets - Revolutionising PHP templating    *
3
 * @author          Tom Butler [email protected]                                             *
4
 * @copyright       2015 Tom Butler <[email protected]> | https://r.je/                      *
5
 * @license         http://www.opensource.org/licenses/bsd-license.php  BSD License *
6
 * @version         1.0                                                             */
7
namespace Transphporm;
8
/** Assigns all the basic properties repeat, comment, etc to a $builder instance */
9
class PropertyBuilder {
10
	private $builder;
11
12
	public function __construct(Builder $builder) {
13
		$this->builder = $builder;
14
	}
15
16
	//Register the basic properties, content, repeat, display and bind
17
	public function registerBasicProperties($data, $locale, &$headers, $formatters) {
18
		$formatter = new Hook\Formatter();
19
		$formatter->register(new Formatter\Number($locale));
20
		$formatter->register(new Formatter\Date($locale));
21
		$formatter->register(new Formatter\StringFormatter());
22
		
23
		foreach ($formatters as $format) $formatter->register($format);
24
25
		$this->builder->registerProperty('content', new Property\Content($data, $headers, $formatter));
26
		$this->builder->registerProperty('repeat', new Property\Repeat($data));
27
		$this->builder->registerProperty('display', new Property\Display);
28
		$this->builder->registerProperty('bind', new Property\Bind($data));
29
	}
30
}