@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | parent::__construct(); |
| 88 | 88 | |
| 89 | - include __DIR__ . '/bootstrap.php'; |
|
| 89 | + include __DIR__.'/bootstrap.php'; |
|
| 90 | 90 | |
| 91 | 91 | synapse()->brain->setMaster($this); |
| 92 | 92 | synapse()->rivescript = $this; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | private function registerTags(): void |
| 103 | 103 | { |
| 104 | 104 | synapse()->tags->each( |
| 105 | - function ($tag) { |
|
| 105 | + function($tag) { |
|
| 106 | 106 | $class = "\\Axiom\\Rivescript\\Cortex\\Tags\\$tag"; |
| 107 | 107 | $tagInstance = new $class(); |
| 108 | 108 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | public function warn(string $message, array $args = [], int $verbosity = Rivescript::VERBOSITY_NORMAL): void |
| 244 | 244 | { |
| 245 | - $message = "[WARNING]: " . $this->formatString($message, $args); |
|
| 245 | + $message = "[WARNING]: ".$this->formatString($message, $args); |
|
| 246 | 246 | |
| 247 | 247 | if ($this->onWarn) { |
| 248 | 248 | call_user_func($this->onWarn, $message, $verbosity); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | public function attach(Node $node): void |
| 82 | 82 | { |
| 83 | 83 | $type = $this->determineResponseType($node->source()); |
| 84 | - $queueItem = new ResponseQueueItem($node->command(), $node->value(), $type, 0, $this->options); |
|
| 84 | + $queueItem = new ResponseQueueItem($node->command(), $node->value(), $type, 0, $this->options); |
|
| 85 | 85 | $this->responses->put($node->value(), $queueItem); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | private function sortResponses(Collection $responses): Collection |
| 96 | 96 | { |
| 97 | 97 | return $responses->sort( |
| 98 | - function ($current, $previous) { |
|
| 98 | + function($current, $previous) { |
|
| 99 | 99 | return ($current->order < $previous->order) ? -1 : 1; |
| 100 | 100 | } |
| 101 | 101 | )->reverse(); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | $continues = Collection::make($responses->all()); |
| 148 | 148 | $continues->each( |
| 149 | - function (ResponseQueueItem $data, $response) use (&$lastData, &$lastResponse, &$continues) { |
|
| 149 | + function(ResponseQueueItem $data, $response) use (&$lastData, &$lastResponse, &$continues) { |
|
| 150 | 150 | |
| 151 | 151 | if ($data->type === 'continue') { |
| 152 | 152 | $continues->remove($lastResponse); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | private function determineResponseOrder(Collection $responses): Collection |
| 200 | 200 | { |
| 201 | 201 | return $responses->each( |
| 202 | - function (ResponseQueueItem $data, $response) use ($responses) { |
|
| 202 | + function(ResponseQueueItem $data, $response) use ($responses) { |
|
| 203 | 203 | if (isset($data->type)) { |
| 204 | 204 | switch ($data->type) { |
| 205 | 205 | case 'condition': |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | */ |
| 143 | 143 | public function parse(): string |
| 144 | 144 | { |
| 145 | - // $this->reset(); |
|
| 145 | + // $this->reset(); |
|
| 146 | 146 | |
| 147 | 147 | $this->changesTopic = false; |
| 148 | 148 | |
@@ -167,7 +167,7 @@ |
||
| 167 | 167 | protected function searchTriggers2(string $trigger): void |
| 168 | 168 | { |
| 169 | 169 | synapse()->triggers->each( |
| 170 | - function ($class) use ($trigger) { |
|
| 170 | + function($class) use ($trigger) { |
|
| 171 | 171 | $triggerClass = "\\Axiom\\Rivescript\\Cortex\\Triggers\\$class"; |
| 172 | 172 | $triggerInstance = new $triggerClass(synapse()->input); |
| 173 | 173 | |
@@ -7,11 +7,11 @@ discard block |
||
| 7 | 7 | * For the full copyright and license information, please view the LICENSE |
| 8 | 8 | * file that was distributed with this source code. |
| 9 | 9 | */ |
| 10 | -define('TESTS_DIR', realpath(__DIR__ . '.\tests\Cortex')); |
|
| 10 | +define('TESTS_DIR', realpath(__DIR__.'.\tests\Cortex')); |
|
| 11 | 11 | |
| 12 | -require(__DIR__ . '/../../vendor/autoload.php'); |
|
| 13 | -require(__DIR__ . '/vendor/autoload.php'); |
|
| 14 | -require(__DIR__ . '/app/FileIO.php'); |
|
| 12 | +require(__DIR__.'/../../vendor/autoload.php'); |
|
| 13 | +require(__DIR__.'/vendor/autoload.php'); |
|
| 14 | +require(__DIR__.'/app/FileIO.php'); |
|
| 15 | 15 | |
| 16 | 16 | use App\TestCase; |
| 17 | 17 | use Symfony\Component\Yaml\Yaml; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | foreach ($tests as $filename) { |
| 36 | 36 | $files = Yaml::parseFile($filename); |
| 37 | 37 | $basename = basename($filename); |
| 38 | - $relativeFile = substr($filename, strlen(TESTS_DIR) +1); |
|
| 38 | + $relativeFile = substr($filename, strlen(TESTS_DIR) + 1); |
|
| 39 | 39 | |
| 40 | 40 | echo "{$relativeFile}\n"; |
| 41 | 41 | |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | $this->rs = new Rivescript(); |
| 75 | 75 | $this->rs->setClientId($this->client_id); |
| 76 | 76 | |
| 77 | - $this->rs->onSay = function ($msg) { |
|
| 77 | + $this->rs->onSay = function($msg) { |
|
| 78 | 78 | // echo "{$msg}\n"; |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | 81 | |
| 82 | - $this->rs->onWarn = function ($msg) { |
|
| 82 | + $this->rs->onWarn = function($msg) { |
|
| 83 | 83 | // echo "{$msg}\n"; |
| 84 | 84 | }; |
| 85 | 85 | $this->file = $file; |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | $expected = rtrim($expected, "\n"); |
| 121 | 121 | if (strtolower($reply) !== strtolower($expected)) { |
| 122 | 122 | throw new AssertionError( |
| 123 | - "Got unexpected exception from reply() for input: {$step['input']}\n\n" . |
|
| 124 | - " Expected: {$expected}\n" . |
|
| 123 | + "Got unexpected exception from reply() for input: {$step['input']}\n\n". |
|
| 124 | + " Expected: {$expected}\n". |
|
| 125 | 125 | " Got: {$reply}" |
| 126 | 126 | ); |
| 127 | 127 | } |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | if ($correct === 0) { |
| 138 | 138 | $expected = implode(' or ', $expected); |
| 139 | 139 | throw new AssertionError( |
| 140 | - "Got unexpected exception from reply() for input: {$step['input']}\n\n" . |
|
| 141 | - " Expected: {$expected}\n" . |
|
| 140 | + "Got unexpected exception from reply() for input: {$step['input']}\n\n". |
|
| 141 | + " Expected: {$expected}\n". |
|
| 142 | 142 | " Got: {$reply}" |
| 143 | 143 | ); |
| 144 | 144 | } |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | if ($actual != $value) { |
| 178 | 178 | throw new AssertionError( |
| 179 | - "Failed to assert that the value of user variable: {$key}\n\n" . |
|
| 180 | - " Expected: {$expected}\n" . |
|
| 179 | + "Failed to assert that the value of user variable: {$key}\n\n". |
|
| 180 | + " Expected: {$expected}\n". |
|
| 181 | 181 | " Got: {$actual}" |
| 182 | 182 | ); |
| 183 | 183 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | private function fail(AssertionError $e): void |
| 245 | 245 | { |
| 246 | 246 | $banner = "x {$this->name}"; |
| 247 | - $banner .= "\n " . str_repeat("=", strlen($banner)) . "\n"; |
|
| 247 | + $banner .= "\n ".str_repeat("=", strlen($banner))."\n"; |
|
| 248 | 248 | |
| 249 | 249 | echo " {$banner} {$e->getMessage()} \n\n"; |
| 250 | 250 | } |
@@ -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) { |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | * Find the match |
| 76 | 76 | */ |
| 77 | 77 | |
| 78 | - $regex = "(" . implode('|', $array) . ")"; |
|
| 79 | - if (@preg_match_all('/' . $regex . '/ui', $input->source(), $wildcards)) { |
|
| 78 | + $regex = "(".implode('|', $array).")"; |
|
| 79 | + if (@preg_match_all('/'.$regex.'/ui', $input->source(), $wildcards)) { |
|
| 80 | 80 | array_shift($wildcards); |
| 81 | 81 | |
| 82 | 82 | if ($wildcards) { |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | /** |
| 93 | 93 | * Find the match |
| 94 | 94 | */ |
| 95 | - $regex = "(?:" . implode('|', $array) . ")"; |
|
| 95 | + $regex = "(?:".implode('|', $array).")"; |
|
| 96 | 96 | |
| 97 | - if (@preg_match_all('/' . $regex . '/ui', $source, $results)) { |
|
| 97 | + if (@preg_match_all('/'.$regex.'/ui', $source, $results)) { |
|
| 98 | 98 | foreach ($results as $result) { |
| 99 | 99 | $source = str_replace("@{$name}", $result[0], $source); |
| 100 | 100 | } |
@@ -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) { |