@@ -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 | |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | use Axiom\Rivescript\Events\Event; |
| 5 | 5 | use Axiom\Rivescript\Rivescript; |
| 6 | 6 | |
| 7 | -$script =<<<EOF |
|
| 7 | +$script = <<<EOF |
|
| 8 | 8 | + hi bot |
| 9 | 9 | - hello human |
| 10 | 10 | EOF; |