Completed
Push — master ( 211030...0ada29 )
by Tom
03:22
created
src/Formatter/Date.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	/** Converts $val into a \DateTime object if it's not already */
12 12
 	private function getDate($val) {
13 13
 		$tz = new \DateTimeZone($this->locale['timezone']);
14
-		$date =  $val instanceof \DateTime ? $val : new \DateTime($val, $tz);
14
+		$date = $val instanceof \DateTime ? $val : new \DateTime($val, $tz);
15 15
 		$date->setTimeZone($tz);
16 16
 		return $date;
17 17
 	}
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 	/** Formats \DateTime as Date and Time using formats from $locale */
32 32
 	public function dateTime($val) {
33
-		return $this->date($val, $this->locale['date_format'] . ' ' . $this->locale['time_format']);
33
+		return $this->date($val, $this->locale['date_format'].' '.$this->locale['time_format']);
34 34
 	}
35 35
 
36 36
 	/** Generates relative time offsets based on system clock. e.g "10 minutes ago" or "In 6 months"
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$diff = $now->diff($date);
43 43
 
44 44
 
45
-		$diffDays = $diff->invert === 1 ? $diff->days : 0- $diff->days;
45
+		$diffDays = $diff->invert === 1 ? $diff->days : 0-$diff->days;
46 46
 
47 47
 		if ($diffDays !== 0) return $this->dayOffset($diffDays);
48 48
 		else return $this->timeOffset($diff);
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 	/** Gets date ranges to represent uses of weeks/months/days/etc */
70 70
 	private function getRanges($strings) {
71
-		$ranges =  [
71
+		$ranges = [
72 72
 			[1, 1, $strings['yesterday'], 1, ''],
73 73
 			[1, 13, $strings['past'], 1, 'days'],
74 74
 			[13, 28, $strings['past'], 7, 'weeks'],
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 	/** Converts "week" to "weeks", "month" to "months" etc when plural is required using language from $locale */
89 89
 	private function getPlural($strings, $num, $interval) {
90
-		if ($interval !== '') return $num == 1 ? $strings[$interval . '_singular'] : $strings[$interval . '_plural'];
90
+		if ($interval !== '') return $num == 1 ? $strings[$interval.'_singular'] : $strings[$interval.'_plural'];
91 91
 		else return '';
92 92
 	}
93 93
 
Please login to merge, or discard this patch.
src/Formatter/Number.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 
14 14
 	public function currency($num) {
15 15
 		$num = $this->decimal($num, $this->locale['currency_decimals']);
16
-		if ($this->locale['currency_position'] === 'before') return $this->locale['currency'] . $num;
17
-		else return $num . $this->locale['currency'];
16
+		if ($this->locale['currency_position'] === 'before') return $this->locale['currency'].$num;
17
+		else return $num.$this->locale['currency'];
18 18
 	}
19 19
 }
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
src/Template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 		if ($document) return $this->document;
56 56
 
57 57
 
58
-		$output = ($this->document->doctype) ? $this->document->saveXml($this->document->doctype) . "\n" : '';
58
+		$output = ($this->document->doctype) ? $this->document->saveXml($this->document->doctype)."\n" : '';
59 59
 
60 60
 		if ($this->document->documentElement->tagName !== 'template') $output .= $this->document->saveXml($this->document->documentElement, LIBXML_NOEMPTYTAG);
61 61
 		else $output = $this->printDocument($this->document);
Please login to merge, or discard this patch.
src/Rule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@
 block discarded – undo
39 39
 		$num = (int) $frequency;
40 40
 		$unit = strtoupper(trim(str_replace($num, '', $frequency)));
41 41
 			
42
-		$offset = $num * constant(self::class . '::' . $unit);
42
+		$offset = $num * constant(self::class.'::'.$unit);
43 43
 
44
-		if ($time > $this->lastRun + $offset) return true;
44
+		if ($time > $this->lastRun+$offset) return true;
45 45
 		else return false;
46 46
 	}
47 47
 
Please login to merge, or discard this patch.
src/Builder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		
50 50
 		$cachedOutput = $this->loadTemplate();
51 51
 		//To be a valid XML document it must have a root element, automatically wrap it in <template> to ensure it does
52
-		$template = new Template($this->isValidDoc($cachedOutput['body']) ? str_ireplace('<!doctype', '<!DOCTYPE', $cachedOutput['body']) : '<template>' . $cachedOutput['body'] . '</template>' );
52
+		$template = new Template($this->isValidDoc($cachedOutput['body']) ? str_ireplace('<!doctype', '<!DOCTYPE', $cachedOutput['body']) : '<template>'.$cachedOutput['body'].'</template>');
53 53
 
54 54
 		$this->processRules($template, $data, $featureSet);
55 55
 		
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	//N.b. only files can be cached
99 99
 	private function getRules($template, $valueParser) {		
100 100
 		if (is_file($this->tss)) {
101
-			$this->baseDir = dirname(realpath($this->tss)) . DIRECTORY_SEPARATOR;
101
+			$this->baseDir = dirname(realpath($this->tss)).DIRECTORY_SEPARATOR;
102 102
 			//The cache for the key: the filename and template prefix
103 103
 			//Each template may have a different prefix which changes the parsed TSS,
104 104
 			//Because of this the cache needs to be generated for each template prefix.
105
-			$key = $this->tss . $template->getPrefix() . $this->baseDir;
105
+			$key = $this->tss.$template->getPrefix().$this->baseDir;
106 106
 			//Try to load the cached rules, if not set in the cache (or expired) parse the supplied sheet
107 107
 			$rules = $this->cache->load($key, filemtime($this->tss));
108 108
 			if (!$rules) return $this->cache->write($key, (new Parser\Sheet(file_get_contents($this->tss), $this->baseDir, $valueParser, $template->getPrefix()))->parse());
Please login to merge, or discard this patch.
src/Module/Format.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
 
15 15
 	private function getLocale() {
16 16
 		if (is_array($this->locale)) return $this->locale;
17
-		else if (strlen($this->locale) > 0) return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . $this->locale . '.json'), true);
18
-		else return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true);
17
+		else if (strlen($this->locale) > 0) return json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'../Formatter'.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.$this->locale.'.json'), true);
18
+		else return json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'../Formatter'.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.'enGB.json'), true);
19 19
 	}
20 20
 
21 21
 	public function load(\Transphporm\FeatureSet $featureSet) {
Please login to merge, or discard this patch.
src/Formatter/StringFormatter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,6 +27,6 @@
 block discarded – undo
27 27
 	public function debug($val) {
28 28
 		ob_start();
29 29
 		var_dump($val);
30
-		return $this->html('<pre>' . ob_get_clean() . '</pre>');
30
+		return $this->html('<pre>'.ob_get_clean().'</pre>');
31 31
 	}
32 32
 }
33 33
\ No newline at end of file
Please login to merge, or discard this patch.
src/TSSFunction/Template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	public function run(array $args, \DomElement $element) {
23 23
 		$selector = $this->readArray($args, 1);
24 24
 		$tss = $this->readArray($args, 2);
25
-		$newTemplate = new \Transphporm\Builder($this->baseDir . $args[0], $tss ? $this->baseDir . $tss : null);
25
+		$newTemplate = new \Transphporm\Builder($this->baseDir.$args[0], $tss ? $this->baseDir.$tss : null);
26 26
 
27 27
 		$doc = $newTemplate->output($this->elementData->getData($element), true)->body;
28 28
 		if ($selector != '') return $this->templateSubsection($doc, $selector);
Please login to merge, or discard this patch.
src/Parser/Tokenizer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
 			$string = $this->extractString($i);
106 106
 			$length = strlen($string)+1;
107 107
 			$char = $this->getChar($char);
108
-			$string = str_replace('\\' . $char, $char, $string);
108
+			$string = str_replace('\\'.$char, $char, $string);
109 109
 			$tokens[] = ['type' => self::STRING, 'value' => $string];
110 110
 			return $length;
111 111
 		}
Please login to merge, or discard this patch.