@@ -25,7 +25,7 @@ |
||
| 25 | 25 | $files = []; |
| 26 | 26 | // $iterator = new RecursiveDirectoryIterator($path) or die(__FUNCTION__ . ": Failed opening directory {$path} for reading"); |
| 27 | 27 | $iterator = new TestCaseFilter(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path))) or |
| 28 | - die(__FUNCTION__ . ": Failed opening directory {$path} for reading"); |
|
| 28 | + die(__FUNCTION__.": Failed opening directory {$path} for reading"); |
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | foreach ($iterator as $file) { |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if (@preg_match_all('/' . $trigger . '/ui', $input->source(), $wildcards)) { |
|
| 58 | + if (@preg_match_all('/'.$trigger.'/ui', $input->source(), $wildcards)) { |
|
| 59 | 59 | array_shift($wildcards); |
| 60 | 60 | |
| 61 | 61 | if ($wildcards) { |
@@ -69,21 +69,21 @@ |
||
| 69 | 69 | $sub = ""; |
| 70 | 70 | |
| 71 | 71 | foreach ($patterns as $index => $pattern) { |
| 72 | - $patterns[$index] = "/\b" . $pattern . "\b/i"; |
|
| 72 | + $patterns[$index] = "/\b".$pattern."\b/i"; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // TODO: Test multiple person wildcards |
| 76 | 76 | if ($match[0] === '<person>' && is_array($wildcards) === true && count($wildcards) > 0) { |
| 77 | 77 | if (count($patterns) > 0) { |
| 78 | 78 | foreach ($patterns as $index => $pattern) { |
| 79 | - $sub = preg_replace($pattern, $replacements[$index], $wildcards[0]);// ?? 'undefined'; |
|
| 79 | + $sub = preg_replace($pattern, $replacements[$index], $wildcards[0]); // ?? 'undefined'; |
|
| 80 | 80 | |
| 81 | 81 | if ($sub !== $wildcards[0]) { |
| 82 | 82 | $source = str_replace($match[0], $sub, $source); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } else { |
| 86 | - $sub = preg_replace($patterns, $replacements, $wildcards[0], 1);// ?? 'undefined'; |
|
| 86 | + $sub = preg_replace($patterns, $replacements, $wildcards[0], 1); // ?? 'undefined'; |
|
| 87 | 87 | $source = str_replace($match[0], $sub, $source); |
| 88 | 88 | } |
| 89 | 89 | } elseif ($match[1] === '{') { |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | $triggers = synapse()->brain->topic($topic)->triggers(); |
| 99 | 99 | |
| 100 | 100 | if ($recursion == 200) { |
| 101 | - synapse()->rivescript->warn("Top many recursive calls to :func", ["func" => __CLASS__ . "::" . __FUNCTION__]); |
|
| 101 | + synapse()->rivescript->warn("Top many recursive calls to :func", ["func" => __CLASS__."::".__FUNCTION__]); |
|
| 102 | 102 | exit; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | public function parse() |
| 39 | 39 | { |
| 40 | 40 | if ($this->responseQueueItem()->getCommand() === '@') { |
| 41 | - return $this->source(); |
|
| 41 | + return $this->source(); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | return false; |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - // $sub = str_replace(["<", ">"], ["<", ">"], $sub); |
|
| 89 | + // $sub = str_replace(["<", ">"], ["<", ">"], $sub); |
|
| 90 | 90 | |
| 91 | 91 | $source = str_replace($match[0], $sub, $source); |
| 92 | 92 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | if (strpos($sub, '.') > -1) { |
| 76 | 76 | $parts = explode('.', $sub); |
| 77 | 77 | if (count($parts) !== 0) { |
| 78 | - array_walk($parts, static function (&$part) { |
|
| 78 | + array_walk($parts, static function(&$part) { |
|
| 79 | 79 | $part = ucfirst(trim($part)); |
| 80 | 80 | }); |
| 81 | 81 | } |
@@ -40,8 +40,8 @@ |
||
| 40 | 40 | public function parse(Node $node): void |
| 41 | 41 | { |
| 42 | 42 | $types = [ |
| 43 | - '-', '*', |
|
| 44 | - '^', '@' |
|
| 43 | + '-', '*', |
|
| 44 | + '^', '@' |
|
| 45 | 45 | ]; |
| 46 | 46 | |
| 47 | 47 | if (in_array($node->command(), $types) === true) { |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * Find the match |
| 84 | 84 | */ |
| 85 | - $regex = "(" . implode('|', $array) . ")"; |
|
| 86 | - if (@preg_match_all('/' . $regex . '/ui', $input->source(), $wildcards)) { |
|
| 85 | + $regex = "(".implode('|', $array).")"; |
|
| 86 | + if (@preg_match_all('/'.$regex.'/ui', $input->source(), $wildcards)) { |
|
| 87 | 87 | array_shift($wildcards); |
| 88 | 88 | |
| 89 | 89 | if ($wildcards) { |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | /** |
| 100 | 100 | * Find the match |
| 101 | 101 | */ |
| 102 | - $regex = "(?:" . implode('|', $array) . ")"; |
|
| 102 | + $regex = "(?:".implode('|', $array).")"; |
|
| 103 | 103 | |
| 104 | - if (@preg_match_all('/' . $regex . '/ui', $source, $results)) { |
|
| 104 | + if (@preg_match_all('/'.$regex.'/ui', $source, $results)) { |
|
| 105 | 105 | foreach ($results as $result) { |
| 106 | 106 | $source = str_replace("@{$name}", $result[0], $source); |
| 107 | 107 | } |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | * @return void |
| 264 | 264 | */ |
| 265 | 265 | public function warn(string $message, |
| 266 | - array $args = [], |
|
| 267 | - int $verbosity = Rivescript::VERBOSITY_DEBUG): void |
|
| 266 | + array $args = [], |
|
| 267 | + int $verbosity = Rivescript::VERBOSITY_DEBUG): void |
|
| 268 | 268 | { |
| 269 | 269 | $message = "[WARNING]: " . $this->formatString($message, $args); |
| 270 | 270 | |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | * @return void |
| 282 | 282 | */ |
| 283 | 283 | public function debug(string $message, |
| 284 | - array $args = [], |
|
| 285 | - int $verbosity = Rivescript::VERBOSITY_NORMAL): void |
|
| 284 | + array $args = [], |
|
| 285 | + int $verbosity = Rivescript::VERBOSITY_NORMAL): void |
|
| 286 | 286 | { |
| 287 | 287 | $message = "[DEBUG]: " . $this->formatString($message, $args); |
| 288 | 288 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | parent::__construct(); |
| 101 | 101 | |
| 102 | - include __DIR__ . '/bootstrap.php'; |
|
| 102 | + include __DIR__.'/bootstrap.php'; |
|
| 103 | 103 | |
| 104 | 104 | $options; |
| 105 | 105 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | private function registerTags(): void |
| 119 | 119 | { |
| 120 | 120 | synapse()->tags->each( |
| 121 | - function ($tag) { |
|
| 121 | + function($tag) { |
|
| 122 | 122 | $class = "\\Axiom\\Rivescript\\Cortex\\Tags\\$tag"; |
| 123 | 123 | $tagInstance = new $class(); |
| 124 | 124 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | array $args = [], |
| 267 | 267 | int $verbosity = Rivescript::VERBOSITY_DEBUG): void |
| 268 | 268 | { |
| 269 | - $message = "[WARNING]: " . $this->formatString($message, $args); |
|
| 269 | + $message = "[WARNING]: ".$this->formatString($message, $args); |
|
| 270 | 270 | |
| 271 | 271 | $this->emit(Event::DEBUG_WARNING, $message); |
| 272 | 272 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | array $args = [], |
| 285 | 285 | int $verbosity = Rivescript::VERBOSITY_NORMAL): void |
| 286 | 286 | { |
| 287 | - $message = "[DEBUG]: " . $this->formatString($message, $args); |
|
| 287 | + $message = "[DEBUG]: ".$this->formatString($message, $args); |
|
| 288 | 288 | |
| 289 | 289 | $this->emit(EVENT::DEBUG, $message); |
| 290 | 290 | } |