@@ -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 | } |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | /** |
| 74 | 74 | * Find the match |
| 75 | 75 | */ |
| 76 | - $regex = "(" . implode('|', $array) . ")"; |
|
| 77 | - if (@preg_match_all('/' . $regex . '/ui', $input->source(), $wildcards)) { |
|
| 76 | + $regex = "(".implode('|', $array).")"; |
|
| 77 | + if (@preg_match_all('/'.$regex.'/ui', $input->source(), $wildcards)) { |
|
| 78 | 78 | array_shift($wildcards); |
| 79 | 79 | |
| 80 | 80 | if ($wildcards) { |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | /** |
| 91 | 91 | * Find the match |
| 92 | 92 | */ |
| 93 | - $regex = "(?:" . implode('|', $array) . ")"; |
|
| 93 | + $regex = "(?:".implode('|', $array).")"; |
|
| 94 | 94 | |
| 95 | - if (@preg_match_all('/' . $regex . '/ui', $source, $results)) { |
|
| 95 | + if (@preg_match_all('/'.$regex.'/ui', $source, $results)) { |
|
| 96 | 96 | foreach ($results as $result) { |
| 97 | 97 | $source = str_replace("@{$name}", $result[0], $source); |
| 98 | 98 | } |
@@ -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) { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | parent::__construct(); |
| 96 | 96 | |
| 97 | - include __DIR__ . '/bootstrap.php'; |
|
| 97 | + include __DIR__.'/bootstrap.php'; |
|
| 98 | 98 | |
| 99 | 99 | synapse()->brain->setMaster($this); |
| 100 | 100 | synapse()->rivescript = $this; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | private function registerTags(): void |
| 112 | 112 | { |
| 113 | 113 | synapse()->tags->each( |
| 114 | - function ($tag) { |
|
| 114 | + function($tag) { |
|
| 115 | 115 | $class = "\\Axiom\\Rivescript\\Cortex\\Tags\\$tag"; |
| 116 | 116 | $tagInstance = new $class(); |
| 117 | 117 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function warn(string $message, array $args = [], int $verbosity = Rivescript::VERBOSITY_DEBUG): void |
| 261 | 261 | { |
| 262 | - $message = "[WARNING]: " . $this->formatString($message, $args); |
|
| 262 | + $message = "[WARNING]: ".$this->formatString($message, $args); |
|
| 263 | 263 | |
| 264 | 264 | if ($this->onWarn) { |
| 265 | 265 | call_user_func($this->onWarn, $message, $verbosity); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function debug(string $message, array $args = [], int $verbosity = Rivescript::VERBOSITY_NORMAL): void |
| 279 | 279 | { |
| 280 | - $message = "[DEBUG]: " . $this->formatString($message, $args); |
|
| 280 | + $message = "[DEBUG]: ".$this->formatString($message, $args); |
|
| 281 | 281 | |
| 282 | 282 | if ($this->onDebug) { |
| 283 | 283 | call_user_func($this->onDebug, $message, $verbosity); |