@@ -90,7 +90,7 @@ |
||
| 90 | 90 | $sentences [] = trim($tmp); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $result = array_filter($sentences, static function (string $sentence) use ($input) { |
|
| 93 | + $result = array_filter($sentences, static function(string $sentence) use ($input) { |
|
| 94 | 94 | return (strtolower($sentence) === strtolower($input->source())); |
| 95 | 95 | }); |
| 96 | 96 | |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | $sentences [] = trim($tmp); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $result = array_filter($sentences, static function (string $sentence) use ($input) { |
|
| 93 | + $result = array_filter($sentences, static function(string $sentence) use ($input) { |
|
| 94 | 94 | return (strtolower($sentence) === strtolower($input->source())); |
| 95 | 95 | }); |
| 96 | 96 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | if (count($set) > 0) { |
| 91 | 91 | if ($match[1] === '(') { |
| 92 | 92 | foreach ($set as $setIndex => $item) { |
| 93 | - $set[$setIndex] = $this->signatures['alternation'] . $item; |
|
| 93 | + $set[$setIndex] = $this->signatures['alternation'].$item; |
|
| 94 | 94 | $set[$setIndex] = str_replace(" ", $this->signatures['alternation'], $set[$setIndex]); |
| 95 | 95 | } |
| 96 | 96 | $triggerString = str_replace($match[0], "{{$index}}", $triggerString); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $tmp = str_replace("{{$index}}", $string, $tmp); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $tmp = str_replace([$this->signatures['optional'] . " ", $this->signatures['optional']], "", $tmp); |
|
| 124 | + $tmp = str_replace([$this->signatures['optional']." ", $this->signatures['optional']], "", $tmp); |
|
| 125 | 125 | $tmp = trim($tmp); |
| 126 | 126 | |
| 127 | 127 | $sentences [] = $tmp; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $signature = $this->signatures['alternation']; |
| 131 | 131 | $cmp = [$this, 'isMatchesWithoutSignature']; |
| 132 | 132 | |
| 133 | - $result = array_filter($sentences, static function (string $sentence) use ($input, $signature, $cmp) { |
|
| 133 | + $result = array_filter($sentences, static function(string $sentence) use ($input, $signature, $cmp) { |
|
| 134 | 134 | if (strpos($sentence, $signature) > -1) { |
| 135 | 135 | return $cmp(strtolower($sentence), strtolower($input->source())); |
| 136 | 136 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | public function execute(InputInterface $input, OutputInterface $output): int |
| 76 | 76 | { |
| 77 | 77 | try { |
| 78 | - $this->rivescript->onSay = static function (string $msg, int $verbosity) use ($output) { |
|
| 78 | + $this->rivescript->onSay = static function(string $msg, int $verbosity) use ($output) { |
|
| 79 | 79 | $output->writeln("Say: {$msg}", $verbosity); |
| 80 | 80 | }; |
| 81 | 81 | |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | $output->writeln('RiveScript Interpreter (PHP) -- Interactive Console v2.0'); |
| 92 | 92 | $output->writeln('--------------------------------------------------------'); |
| 93 | 93 | $output->writeln('RiveScript Version: 2.0'); |
| 94 | - $output->writeln('Currently Loaded Source: ' . $loadedSource); |
|
| 95 | - $output->writeln('Debug mode: ' . $debugMode); |
|
| 94 | + $output->writeln('Currently Loaded Source: '.$loadedSource); |
|
| 95 | + $output->writeln('Debug mode: '.$debugMode); |
|
| 96 | 96 | |
| 97 | 97 | $output->writeln(''); |
| 98 | 98 | $output->writeln('You are now chatting with a RiveScript bot. Type a message and press Return'); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $reply = $this->rivescript->reply($message); |
| 183 | 183 | $response = "<info>{$reply}</info>"; |
| 184 | 184 | |
| 185 | - $output->writeln($bot . $response); |
|
| 185 | + $output->writeln($bot.$response); |
|
| 186 | 186 | |
| 187 | 187 | $this->waitForUserInput($input, $output); |
| 188 | 188 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | if (is_dir($info)) { |
| 200 | 200 | $directory = realpath($info); |
| 201 | 201 | $files = []; |
| 202 | - $brains = glob($directory . '/*.rive'); |
|
| 202 | + $brains = glob($directory.'/*.rive'); |
|
| 203 | 203 | |
| 204 | 204 | foreach ($brains as $brain) { |
| 205 | 205 | $files[] = $brain; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $this->sourceType = $sourceType; |
| 72 | 72 | |
| 73 | 73 | if (!isset($this->allowedSources)) { |
| 74 | - throw new LogicException(get_class($this) . " must have an \"allowedSources\" property declared."); |
|
| 74 | + throw new LogicException(get_class($this)." must have an \"allowedSources\" property declared."); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | break; |
| 110 | 110 | } elseif ($content[$i] === '>') { |
| 111 | 111 | $reminder = substr($content, $i + 1); |
| 112 | - return ['response' => "<" . $tag . ">", 'reminder' => $reminder]; |
|
| 112 | + return ['response' => "<".$tag.">", 'reminder' => $reminder]; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $tag .= $content[$i]; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $result = $this->secureSource($reminder, $tagName, ">"); |
| 119 | 119 | $reminder = $result['reminder']; |
| 120 | 120 | |
| 121 | - $response = (isset($tags[$tag]) === true) ? $result['response'] : "<" . $tag . " " . $result['response'] . ">"; |
|
| 121 | + $response = (isset($tags[$tag]) === true) ? $result['response'] : "<".$tag." ".$result['response'].">"; |
|
| 122 | 122 | |
| 123 | 123 | return ['response' => $response, 'reminder' => $reminder]; |
| 124 | 124 | } |
@@ -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) { |
@@ -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) { |