@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | if (trim($template)[0] !== '<') { |
14 | 14 | $this->template = file_get_contents($template); |
15 | 15 | if ($tss) { |
16 | - $this->baseDir = dirname(realpath($tss)) . DIRECTORY_SEPARATOR; |
|
16 | + $this->baseDir = dirname(realpath($tss)).DIRECTORY_SEPARATOR; |
|
17 | 17 | $this->tss = trim(file_get_contents($tss)); |
18 | 18 | } |
19 | 19 | } |
20 | 20 | else { |
21 | - $this->template = $template; |
|
21 | + $this->template = $template; |
|
22 | 22 | $this->tss = trim($tss); |
23 | 23 | } |
24 | 24 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->registerProperties($this->getBasicProperties($data, $locale, $headers)); |
31 | 31 | |
32 | 32 | //To be a valid XML document it must have a root element, automatically wrap it in <template> to ensure it does |
33 | - $template = new Template($this->isValidDoc() ? $this->template : '<template>' . $this->template . '</template>' ); |
|
33 | + $template = new Template($this->isValidDoc() ? $this->template : '<template>'.$this->template.'</template>'); |
|
34 | 34 | $rules = (new Sheet($this->tss, $this->baseDir, $template->getPrefix()))->parse(); |
35 | 35 | |
36 | 36 | foreach ($rules as $rule) { |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | |
55 | 55 | private function getLocale() { |
56 | 56 | if (is_array($this->locale)) return $this->locale; |
57 | - 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); |
|
58 | - else return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true); |
|
57 | + 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); |
|
58 | + else return json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'Formatter'.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.'enGB.json'), true); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function registerProperties($object) { |
@@ -7,14 +7,14 @@ |
||
7 | 7 | private $depth; |
8 | 8 | |
9 | 9 | public function __construct($css, $prefix = '') { |
10 | - $this->css = str_replace([' >', '> '],['>', '>'], trim($css)); |
|
10 | + $this->css = str_replace([' >', '> '], ['>', '>'], trim($css)); |
|
11 | 11 | $this->translators = [ |
12 | - ' ' => function($string) use ($prefix) { return '//' . $prefix . $string; }, |
|
13 | - '' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
14 | - '>' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
15 | - '#' => function($string) { return '[@id=\'' . $string . '\']'; }, |
|
16 | - '.' => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' ' . $string . ' \')]'; }, |
|
17 | - '[' => function($string) { return '[@' . $string . ']'; }, |
|
12 | + ' ' => function($string) use ($prefix) { return '//'.$prefix.$string; }, |
|
13 | + '' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
14 | + '>' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
15 | + '#' => function($string) { return '[@id=\''.$string.'\']'; }, |
|
16 | + '.' => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' '.$string.' \')]'; }, |
|
17 | + '[' => function($string) { return '[@'.$string.']'; }, |
|
18 | 18 | ']' => function() { return ''; } |
19 | 19 | ]; |
20 | 20 | } |
@@ -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 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | private function pseudoBefore($value, $element, $rule) { |
42 | 42 | if (in_array('before', $rule->getPseudoMatcher()->getPseudo())) { |
43 | - $element->firstChild->nodeValue = implode('', $value) . $element->firstChild->nodeValue; |
|
43 | + $element->firstChild->nodeValue = implode('', $value).$element->firstChild->nodeValue; |
|
44 | 44 | return true; |
45 | 45 | } |
46 | 46 | } |
@@ -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; |
@@ -77,7 +77,7 @@ |
||
77 | 77 | return false; |
78 | 78 | } |
79 | 79 | |
80 | - public function header($element) { |
|
80 | + public function header($element) { |
|
81 | 81 | if ($this->matches($element)) { |
82 | 82 | foreach ($this->pseudo as $pseudo) { |
83 | 83 | if (strpos($pseudo, 'header') === 0) return $this->getBetween($pseudo, '[', ']'); |
@@ -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) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | $selector = trim(substr($this->tss, $pos, $next-$pos)); |
23 | 23 | $rule = $this->cssToRule($selector, count($rules)); |
24 | - $pos = strpos($this->tss, '}', $next)+1; |
|
24 | + $pos = strpos($this->tss, '}', $next)+1; |
|
25 | 25 | $rule->properties = $this->getProperties(trim(substr($this->tss, $next+1, $pos-2-$next))); |
26 | 26 | $rules = $this->writeRule($rules, $selector, $rule); |
27 | 27 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | private function processingInstructions($tss, $pos, $next) { |
53 | 53 | $rules = []; |
54 | 54 | while (($atPos = strpos($tss, '@', $pos)) !== false) { |
55 | - if ($atPos <= (int) $next) { |
|
55 | + if ($atPos <= (int) $next) { |
|
56 | 56 | $spacePos = strpos($tss, ' ', $atPos); |
57 | 57 | $funcName = substr($tss, $atPos+1, $spacePos-$atPos-1); |
58 | 58 | $pos = strpos($tss, ';', $spacePos); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | private function import($args) { |
69 | - $sheet = new Sheet(file_get_contents($this->baseDir . trim($args, '\'" ')), $this->baseDir); |
|
69 | + $sheet = new Sheet(file_get_contents($this->baseDir.trim($args, '\'" ')), $this->baseDir); |
|
70 | 70 | return $sheet->parse(); |
71 | 71 | } |
72 | 72 |