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

PropertyBuilder::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
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
}