@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | private $pseudo; |
| 11 | 11 | private $depth; |
| 12 | 12 | private $index; |
| 13 | - private $baseDir; |
|
| 13 | + private $baseDir; |
|
| 14 | 14 | private $properties = []; |
| 15 | 15 | private $lastRun = 0; |
| 16 | 16 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $this->pseudo = $pseudo; |
| 26 | 26 | $this->depth = $depth; |
| 27 | 27 | $this->index = $index; |
| 28 | - $this->baseDir = $baseDir; |
|
| 28 | + $this->baseDir = $baseDir; |
|
| 29 | 29 | $this->properties = $properties; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -42,23 +42,32 @@ |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | private function timeFrequency($frequency, $time = null) { |
| 45 | - if ($time === null) $time = time(); |
|
| 45 | + if ($time === null) { |
|
| 46 | + $time = time(); |
|
| 47 | + } |
|
| 46 | 48 | $num = (int) $frequency; |
| 47 | 49 | $unit = strtoupper(trim(str_replace($num, '', $frequency))); |
| 48 | 50 | |
| 49 | 51 | $offset = $num * constant(self::class . '::' . $unit); |
| 50 | 52 | |
| 51 | - if ($time > $this->lastRun + $offset) return true; |
|
| 52 | - else return false; |
|
| 53 | + if ($time > $this->lastRun + $offset) { |
|
| 54 | + return true; |
|
| 55 | + } else { |
|
| 56 | + return false; |
|
| 57 | + } |
|
| 53 | 58 | } |
| 54 | 59 | |
| 55 | 60 | public function shouldRun($time = null) { |
| 56 | 61 | if (isset($this->properties['update-frequency']) && $this->lastRun !== 0) { |
| 57 | 62 | $frequency = $this->properties['update-frequency']; |
| 58 | 63 | $static = ['always' => true, 'never' => false]; |
| 59 | - if (isset($static[$frequency])) return $static[$frequency]; |
|
| 60 | - else return $this->timeFrequency($frequency, $time); |
|
| 64 | + if (isset($static[$frequency])) { |
|
| 65 | + return $static[$frequency]; |
|
| 66 | + } else { |
|
| 67 | + return $this->timeFrequency($frequency, $time); |
|
| 68 | + } |
|
| 69 | + } else { |
|
| 70 | + return true; |
|
| 61 | 71 | } |
| 62 | - else return true; |
|
| 63 | 72 | } |
| 64 | 73 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $selector = trim(substr($this->tss, $pos, $next-$pos)); |
| 31 | - $pos = strpos($this->tss, '}', $next)+1; |
|
| 31 | + $pos = strpos($this->tss, '}', $next)+1; |
|
| 32 | 32 | $newRules = $this->cssToRules($selector, count($rules)+$indexStart, $this->getProperties(trim(substr($this->tss, $next+1, $pos-2-$next)))); |
| 33 | 33 | $rules = $this->writeRule($rules, $newRules); |
| 34 | 34 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | private function processingInstructions($tss, $pos, $next, $indexStart) { |
| 63 | 63 | $rules = []; |
| 64 | 64 | while (($atPos = strpos($tss, '@', $pos)) !== false) { |
| 65 | - if ($atPos <= (int) $next) { |
|
| 65 | + if ($atPos <= (int) $next) { |
|
| 66 | 66 | $spacePos = strpos($tss, ' ', $atPos); |
| 67 | 67 | $funcName = substr($tss, $atPos+1, $spacePos-$atPos-1); |
| 68 | 68 | $pos = strpos($tss, ';', $spacePos); |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | private function import($args, $indexStart) { |
| 81 | - if (is_file(trim($args,'\'" '))) $fileName = trim($args,'\'" '); |
|
| 81 | + if (is_file(trim($args, '\'" '))) $fileName = trim($args, '\'" '); |
|
| 82 | 82 | else $fileName = $this->valueParser->parse($args)[0]; |
| 83 | - $sheet = new Sheet(file_get_contents($this->baseDir . $fileName), dirname(realpath($this->baseDir . $fileName)) . DIRECTORY_SEPARATOR, $this->xPath, $this->valueParser); |
|
| 83 | + $sheet = new Sheet(file_get_contents($this->baseDir.$fileName), dirname(realpath($this->baseDir.$fileName)).DIRECTORY_SEPARATOR, $this->xPath, $this->valueParser); |
|
| 84 | 84 | return $sheet->parse(0, [], $indexStart); |
| 85 | 85 | } |
| 86 | 86 | |