@@ -11,7 +11,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -13,7 +13,7 @@ |
||
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 |
@@ -75,7 +75,7 @@ |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | public function template($val, $element) { |
78 | - $newTemplate = new \Transphporm\Builder($this->baseDir . $val[0]); |
|
78 | + $newTemplate = new \Transphporm\Builder($this->baseDir.$val[0]); |
|
79 | 79 | $newTemplate->setLocale($this->locale); |
80 | 80 | |
81 | 81 | $doc = $newTemplate->output([], true)->body; |
@@ -55,7 +55,7 @@ |
||
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); |
@@ -39,9 +39,9 @@ |
||
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 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | $selector = trim(substr($this->tss, $pos, $next-$pos)); |
30 | 30 | $rule = $this->cssToRule($selector, count($rules)); |
31 | - $pos = strpos($this->tss, '}', $next)+1; |
|
31 | + $pos = strpos($this->tss, '}', $next)+1; |
|
32 | 32 | $rule->properties = $this->getProperties(trim(substr($this->tss, $next+1, $pos-2-$next))); |
33 | 33 | $rules = $this->writeRule($rules, $selector, $rule); |
34 | 34 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | private function processingInstructions($tss, $pos, $next) { |
55 | 55 | $rules = []; |
56 | 56 | while (($atPos = strpos($tss, '@', $pos)) !== false) { |
57 | - if ($atPos <= (int) $next) { |
|
57 | + if ($atPos <= (int) $next) { |
|
58 | 58 | $spacePos = strpos($tss, ' ', $atPos); |
59 | 59 | $funcName = substr($tss, $atPos+1, $spacePos-$atPos-1); |
60 | 60 | $pos = strpos($tss, ';', $spacePos); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | private function import($args) { |
73 | - $sheet = new Sheet(file_get_contents($this->baseDir . trim($args, '\'" ')), $this->baseDir, $this->valueParser, $this->prefix); |
|
73 | + $sheet = new Sheet(file_get_contents($this->baseDir.trim($args, '\'" ')), $this->baseDir, $this->valueParser, $this->prefix); |
|
74 | 74 | return $sheet->parse(); |
75 | 75 | } |
76 | 76 |
@@ -17,8 +17,8 @@ |
||
17 | 17 | while (($pos = strpos($str, '"', $pos+1)) !== false) { |
18 | 18 | $end = strpos($str, '"', $pos+1); |
19 | 19 | while ($str[$end-1] == '\\') $end = strpos($str, '"', $end+1); |
20 | - $strings['$+STR' . ++$num] = substr($str, $pos, $end-$pos+1); |
|
21 | - $str = substr_replace($str, '$+STR' . $num, $pos, $end-$pos+1); |
|
20 | + $strings['$+STR'.++$num] = substr($str, $pos, $end-$pos+1); |
|
21 | + $str = substr_replace($str, '$+STR'.$num, $pos, $end-$pos+1); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | return [$str, $strings]; |
@@ -64,7 +64,7 @@ |
||
64 | 64 | $finalPos = $this->findMatchingPos($str, $marker); |
65 | 65 | $string = substr($str, 1, $finalPos-1); |
66 | 66 | //Now remove escape characters |
67 | - return str_replace('\\' . $marker, $marker, $string); |
|
67 | + return str_replace('\\'.$marker, $marker, $string); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | private function parseFunction($function) { |
@@ -15,14 +15,14 @@ |
||
15 | 15 | public function __construct($css, Value $valueParser, $prefix = '') { |
16 | 16 | $hash = $this->registerInstance(); |
17 | 17 | $this->valueParser = $valueParser; |
18 | - $this->css = str_replace([' >', '> '],['>', '>'], trim($css)); |
|
18 | + $this->css = str_replace([' >', '> '], ['>', '>'], trim($css)); |
|
19 | 19 | $this->translators = [ |
20 | - ' ' => function($string) use ($prefix) { return '//' . $prefix . $string; }, |
|
21 | - '' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
22 | - '>' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
23 | - '#' => function($string) { return '[@id=\'' . $string . '\']'; }, |
|
24 | - '.' => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' ' . $string . ' \')]'; }, |
|
25 | - '[' => function($string, $xpath) use($hash) { return '[' .'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \'' . $string . '\', ., "' . $hash . '")' . ']'; }, |
|
20 | + ' ' => function($string) use ($prefix) { return '//'.$prefix.$string; }, |
|
21 | + '' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
22 | + '>' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
23 | + '#' => function($string) { return '[@id=\''.$string.'\']'; }, |
|
24 | + '.' => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' '.$string.' \')]'; }, |
|
25 | + '[' => function($string, $xpath) use($hash) { return '['.'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \''.$string.'\', ., "'.$hash.'")'.']'; }, |
|
26 | 26 | ']' => function() { return ''; } |
27 | 27 | ]; |
28 | 28 | } |