@@ -35,7 +35,7 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | function dd() |
| 37 | 37 | { |
| 38 | - array_map(function ($x) { |
|
| 38 | + array_map(function($x) { |
|
| 39 | 39 | print_r($x); |
| 40 | 40 | echo "\n"; |
| 41 | 41 | }, func_get_args()); |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | continue; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $commands->each(function ($command) use ($node) { |
|
| 64 | + $commands->each(function($command) use ($node) { |
|
| 65 | 65 | $class = "\\Axiom\\Rivescript\\Cortex\\Commands\\$command"; |
| 66 | 66 | $commandClass = new $class(); |
| 67 | 67 | $commandClass->parse($node); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function stream_read(int $count): string |
| 78 | 78 | { |
| 79 | - $p =& $this->position; |
|
| 79 | + $p = & $this->position; |
|
| 80 | 80 | $ret = substr($this->content, $p, $count); |
| 81 | 81 | $p += strlen($ret); |
| 82 | 82 | return $ret; |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function stream_write(string $data): int |
| 93 | 93 | { |
| 94 | - $v =& $this->content; |
|
| 94 | + $v = & $this->content; |
|
| 95 | 95 | $l = strlen($data); |
| 96 | - $p =& $this->position; |
|
| 97 | - $v = substr($v, 0, $p) . $data . substr($v, $p += $l); |
|
| 96 | + $p = & $this->position; |
|
| 97 | + $v = substr($v, 0, $p).$data.substr($v, $p += $l); |
|
| 98 | 98 | return $l; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | public function stream_seek(int $offset, int $whence = SEEK_SET): bool |
| 133 | 133 | { |
| 134 | 134 | $l = strlen($this->content); |
| 135 | - $p =& $this->position; |
|
| 135 | + $p = & $this->position; |
|
| 136 | 136 | switch ($whence) { |
| 137 | 137 | case SEEK_SET: |
| 138 | 138 | $newPos = $offset; |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | public function __construct() |
| 44 | 44 | { |
| 45 | 45 | $this->logger = new Monolog('rivescript'); |
| 46 | - $this->logger->pushHandler(new StreamHandler(__DIR__ . '/../../logs/' . date('m-d-y') . '.log', Monolog::DEBUG)); |
|
| 46 | + $this->logger->pushHandler(new StreamHandler(__DIR__.'/../../logs/'.date('m-d-y').'.log', Monolog::DEBUG)); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -297,16 +297,16 @@ |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | if ($parens) { |
| 300 | - return "Unmatched " . ($parens > 0 ? "left" : "right") . " parenthesis bracket ()"; |
|
| 300 | + return "Unmatched ".($parens > 0 ? "left" : "right")." parenthesis bracket ()"; |
|
| 301 | 301 | } |
| 302 | 302 | if ($square) { |
| 303 | - return "Unmatched " . ($square > 0 ? "left" : "right") . " square bracket []"; |
|
| 303 | + return "Unmatched ".($square > 0 ? "left" : "right")." square bracket []"; |
|
| 304 | 304 | } |
| 305 | 305 | if ($curly) { |
| 306 | - return "Unmatched " . ($curly > 0 ? "left" : "right") . " curly bracket {}"; |
|
| 306 | + return "Unmatched ".($curly > 0 ? "left" : "right")." curly bracket {}"; |
|
| 307 | 307 | } |
| 308 | 308 | if ($chevron) { |
| 309 | - return "Unmatched " . ($chevron > 0 ? "left" : "right") . " angled bracket <>"; |
|
| 309 | + return "Unmatched ".($chevron > 0 ? "left" : "right")." angled bracket <>"; |
|
| 310 | 310 | } |
| 311 | 311 | } elseif (starts_with($this->source, '-') || starts_with($this->source, '^') |
| 312 | 312 | || starts_with($this->source, '/')) { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $this->source = remove_whitespace($source); |
| 95 | 95 | $this->number = $number; |
| 96 | 96 | |
| 97 | - // $this->source = $this->escape($this->source); |
|
| 97 | + // $this->source = $this->escape($this->source); |
|
| 98 | 98 | |
| 99 | 99 | $this->determineEmpty(); |
| 100 | 100 | $this->determineComment(); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $index = 0; |
| 113 | 113 | if (is_array($matches[$index]) && isset($matches[$index][0]) && is_null($knownTags) === false && count($matches) == 2) { |
| 114 | - $matches = $matches[$index]; |
|
| 114 | + $matches = $matches[$index]; |
|
| 115 | 115 | |
| 116 | 116 | foreach ($matches as $match) { |
| 117 | 117 | $str = str_replace(['<', '>'], "", $match); |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | [$key, $value] = explode('=', $value); |
| 48 | 48 | |
| 49 | 49 | $key = trim($key); |
| 50 | - $key = '/\b' . preg_quote($key, '/') . '\b/'; // Convert the "key" to a regular expression ready format |
|
| 50 | + $key = '/\b'.preg_quote($key, '/').'\b/'; // Convert the "key" to a regular expression ready format |
|
| 51 | 51 | $value = trim($value); |
| 52 | 52 | |
| 53 | 53 | synapse()->memory->substitute()->put($key, $value); |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | if (strpos($sub, '.') > -1) { |
| 74 | 74 | $parts = explode('.', $sub); |
| 75 | 75 | if (count($parts) !== 0) { |
| 76 | - array_walk($parts, static function (&$part) { |
|
| 76 | + array_walk($parts, static function(&$part) { |
|
| 77 | 77 | $part = ucfirst(trim($part)); |
| 78 | 78 | }); |
| 79 | 79 | } |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | $this->sourceType = $sourceType; |
| 63 | 63 | |
| 64 | 64 | if (!isset($this->allowedSources)) { |
| 65 | - throw new LogicException(get_class($this) . " must have an \"allowedSources\" property declared."); |
|
| 65 | + throw new LogicException(get_class($this)." must have an \"allowedSources\" property declared."); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $triggers = $this->determineWordCount($triggers); |
| 95 | 95 | $triggers = $this->determineTypeCount($triggers); |
| 96 | 96 | |
| 97 | - return $triggers->sort(function ($current, $previous) { |
|
| 97 | + return $triggers->sort(function($current, $previous) { |
|
| 98 | 98 | return ($current['order'] < $previous['order']) ? -1 : 1; |
| 99 | 99 | })->reverse(); |
| 100 | 100 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | protected function determineTypeCount(Collection $triggers): Collection |
| 110 | 110 | { |
| 111 | - return $triggers->each(function ($data, $trigger) use ($triggers) { |
|
| 111 | + return $triggers->each(function($data, $trigger) use ($triggers) { |
|
| 112 | 112 | if (isset($data['type'])) { |
| 113 | 113 | switch ($data['type']) { |
| 114 | 114 | case 'atomic': |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | protected function determineWordCount(Collection $triggers): Collection |
| 142 | 142 | { |
| 143 | - return $triggers->each(function ($data, $trigger) use ($triggers) { |
|
| 143 | + return $triggers->each(function($data, $trigger) use ($triggers) { |
|
| 144 | 144 | $data['order'] = count(explode(' ', $trigger)); |
| 145 | 145 | |
| 146 | 146 | $triggers->put($trigger, $data); |