@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | private function getSheetLoader() { |
54 | - $tssRules = is_file((string)$this->tss) ? new SheetLoader\TSSFile($this->tss, $this->filePath, $this->cache, $this->time) : new SheetLoader\TSSString($this->tss, $this->filePath); |
|
54 | + $tssRules = is_file((string) $this->tss) ? new SheetLoader\TSSFile($this->tss, $this->filePath, $this->cache, $this->time) : new SheetLoader\TSSString($this->tss, $this->filePath); |
|
55 | 55 | return new SheetLoader\SheetLoader($this->cache, $this->filePath, $tssRules, $this->time); |
56 | 56 | } |
57 | 57 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | 'headers' => array_merge($result['headers'], $headers), |
73 | 73 | 'body' => $this->doPostProcessing($template)->output($document) |
74 | 74 | ]; |
75 | - $this->cache->write($tssCache->getCacheKey($data) . $this->template, $result); |
|
75 | + $this->cache->write($tssCache->getCacheKey($data).$this->template, $result); |
|
76 | 76 | } |
77 | 77 | unset($result['cache'], $result['renderTime']); |
78 | 78 | return (object) $result; |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | $elementData = new \Transphporm\Hook\ElementData(new \SplObjectStorage(), $data); |
83 | 83 | $functionSet = new FunctionSet($elementData); |
84 | 84 | //To be a valid XML document it must have a root element, automatically wrap it in <template> to ensure it does |
85 | - $template = new Template($this->isValidDoc($body) ? str_ireplace('<!doctype', '<!DOCTYPE', $body) : '<template>' . $body . '</template>' ); |
|
85 | + $template = new Template($this->isValidDoc($body) ? str_ireplace('<!doctype', '<!DOCTYPE', $body) : '<template>'.$body.'</template>'); |
|
86 | 86 | |
87 | 87 | $valueParser = new Parser\Value($functionSet); |
88 | - $this->config = new Config($functionSet, $valueParser, $elementData, new Hook\Formatter(), new Parser\CssToXpath($functionSet, $template->getPrefix(), md5((string)$this->tss)), $this->filePath, $headers); |
|
88 | + $this->config = new Config($functionSet, $valueParser, $elementData, new Hook\Formatter(), new Parser\CssToXpath($functionSet, $template->getPrefix(), md5((string) $this->tss)), $this->filePath, $headers); |
|
89 | 89 | |
90 | 90 | foreach ($this->modules as $module) $module->load($this->config); |
91 | 91 | return $template; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | private function loadTemplateFromFile($file) { |
109 | - $xml = $this->cache->load($this->cacheKey . $file, filemtime($file)); |
|
109 | + $xml = $this->cache->load($this->cacheKey.$file, filemtime($file)); |
|
110 | 110 | return $xml ? $xml : ['cache' => file_get_contents($file) ?: "", 'headers' => []]; |
111 | 111 | } |
112 | 112 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | public function next() { |
54 | 54 | $this->pos++; |
55 | - return $this->pos < strlen((string)$this->str); |
|
55 | + return $this->pos < strlen((string) $this->str); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | public function reset() { |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | public function read($offset = 0) { |
64 | - return $this->str[$this->pos + $offset]; |
|
64 | + return $this->str[$this->pos+$offset]; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | public function identifyChar($offset = 0) { |
68 | - $chr = $this->str[$this->pos + $offset]; |
|
68 | + $chr = $this->str[$this->pos+$offset]; |
|
69 | 69 | if (!empty($this->chars[$chr])) return $this->chars[$chr]; |
70 | 70 | else return Tokenizer::NAME; |
71 | 71 | } |
72 | 72 | |
73 | 73 | public function has($offset = 0) { |
74 | - return isset($this->str[$this->pos + $offset]); |
|
74 | + return isset($this->str[$this->pos+$offset]); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | public function pos($str) { |
78 | - $pos = strpos($this->str, $str, $this->pos); |
|
78 | + $pos = strpos($this->str, $str, $this->pos); |
|
79 | 79 | return $pos ? $pos-$this->pos : false; |
80 | 80 | } |
81 | 81 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | public function extractString($offset = 0) { |
91 | - $pos = $this->pos + $offset; |
|
91 | + $pos = $this->pos+$offset; |
|
92 | 92 | $char = $this->str[$pos]; |
93 | 93 | $end = strpos($this->str, $char, $pos+1); |
94 | 94 | while ($end !== false && $this->str[$end-1] == '\\') $end = strpos($this->str, $char, $end+1); |
@@ -15,8 +15,8 @@ |
||
15 | 15 | |
16 | 16 | private function getLocale() { |
17 | 17 | if (is_array($this->locale)) return $this->locale; |
18 | - else if (strlen((string)$this->locale) > 0) return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . $this->locale . '.json'), true); |
|
19 | - else return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true); |
|
18 | + else if (strlen((string) $this->locale) > 0) return json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'../Formatter'.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.$this->locale.'.json'), true); |
|
19 | + else return json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'../Formatter'.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.'enGB.json'), true); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function load(\Transphporm\Config $config) { |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** Converts $val into a \DateTime object if it's not already */ |
17 | 17 | private function getDate($val) { |
18 | 18 | $tz = new \DateTimeZone($this->locale['timezone']); |
19 | - $date = $val instanceof \DateTimeInterface ? $val : new \DateTime((string)$val, $tz); |
|
19 | + $date = $val instanceof \DateTimeInterface ? $val : new \DateTime((string) $val, $tz); |
|
20 | 20 | $date->setTimeZone($tz); |
21 | 21 | return $date; |
22 | 22 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | /** Formats \DateTime as Date and Time using formats from $locale */ |
37 | 37 | public function dateTime($val) { |
38 | - return $this->date($val, $this->locale['date_format'] . ' ' . $this->locale['time_format']); |
|
38 | + return $this->date($val, $this->locale['date_format'].' '.$this->locale['time_format']); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** Generates relative time offsets based on system clock. e.g "10 minutes ago" or "In 6 months" |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $date->add(new \DateInterval("PT${secondsToAdd}S")); |
50 | 50 | |
51 | 51 | $diff = $now->diff($date); |
52 | - $diffDays = $diff->invert === 1 ? $diff->days : 0- $diff->days; |
|
52 | + $diffDays = $diff->invert === 1 ? $diff->days : 0-$diff->days; |
|
53 | 53 | |
54 | 54 | if ($diffDays !== 0) return $this->dayOffset($diffDays); |
55 | 55 | else return $this->timeOffset($diff); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | /** Gets date ranges to represent uses of weeks/months/days/etc */ |
79 | 79 | private function getRanges($strings) { |
80 | - $ranges = [ |
|
80 | + $ranges = [ |
|
81 | 81 | [1, 1, $strings['yesterday'], 1, ''], |
82 | 82 | [1, 13, $strings['past'], 1, 'days'], |
83 | 83 | [13, 28, $strings['past'], 7, 'weeks'], |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | /** Converts "week" to "weeks", "month" to "months" etc when plural is required using language from $locale */ |
103 | 103 | private function getPlural($strings, $num, $interval) { |
104 | - if ($interval !== '') return $num == 1 ? $strings[$interval . '_singular'] : $strings[$interval . '_plural']; |
|
104 | + if ($interval !== '') return $num == 1 ? $strings[$interval.'_singular'] : $strings[$interval.'_plural']; |
|
105 | 105 | else return ''; |
106 | 106 | } |
107 | 107 |