@@ -73,7 +73,7 @@ |
||
73 | 73 | if (strpos($sub, '.') > -1) { |
74 | 74 | $parts = explode('.', $sub); |
75 | 75 | if (count($parts) !== 0) { |
76 | - array_walk($parts, static function (&$part) { |
|
76 | + array_walk($parts, static function(&$part) { |
|
77 | 77 | $part = ucfirst(trim($part)); |
78 | 78 | }); |
79 | 79 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $this->sourceType = $sourceType; |
63 | 63 | |
64 | 64 | if (!isset($this->allowedSources)) { |
65 | - throw new LogicException(get_class($this) . " must have an \"allowedSources\" property declared."); |
|
65 | + throw new LogicException(get_class($this)." must have an \"allowedSources\" property declared."); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $triggers = $this->determineWordCount($triggers); |
95 | 95 | $triggers = $this->determineTypeCount($triggers); |
96 | 96 | |
97 | - return $triggers->sort(function ($current, $previous) { |
|
97 | + return $triggers->sort(function($current, $previous) { |
|
98 | 98 | return ($current['order'] < $previous['order']) ? -1 : 1; |
99 | 99 | })->reverse(); |
100 | 100 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function determineTypeCount(Collection $triggers): Collection |
110 | 110 | { |
111 | - return $triggers->each(function ($data, $trigger) use ($triggers) { |
|
111 | + return $triggers->each(function($data, $trigger) use ($triggers) { |
|
112 | 112 | if (isset($data['type'])) { |
113 | 113 | switch ($data['type']) { |
114 | 114 | case 'atomic': |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | protected function determineWordCount(Collection $triggers): Collection |
142 | 142 | { |
143 | - return $triggers->each(function ($data, $trigger) use ($triggers) { |
|
143 | + return $triggers->each(function($data, $trigger) use ($triggers) { |
|
144 | 144 | $data['order'] = count(explode(' ', $trigger)); |
145 | 145 | |
146 | 146 | $triggers->put($trigger, $data); |
@@ -70,7 +70,7 @@ |
||
70 | 70 | stream_wrapper_unregister($this->name); |
71 | 71 | } |
72 | 72 | if (stream_wrapper_register($this->name, ContentStream::class) === true) { |
73 | - $this->stream = fopen($this->name . "://input", 'wb+'); |
|
73 | + $this->stream = fopen($this->name."://input", 'wb+'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | if (is_resource($this->stream) === false) { |
@@ -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) { |
@@ -52,13 +52,13 @@ |
||
52 | 52 | ]; |
53 | 53 | |
54 | 54 | foreach ($wildcards as $pattern => $replacement) { |
55 | - $parsedTrigger = preg_replace($pattern, '(' . $replacement . ')', $trigger); |
|
55 | + $parsedTrigger = preg_replace($pattern, '('.$replacement.')', $trigger); |
|
56 | 56 | |
57 | 57 | if ($parsedTrigger === $trigger) { |
58 | 58 | continue; |
59 | 59 | } |
60 | 60 | |
61 | - if (@preg_match_all('/' . $parsedTrigger . '$/u', $input->source(), $wildcards)) { |
|
61 | + if (@preg_match_all('/'.$parsedTrigger.'$/u', $input->source(), $wildcards)) { |
|
62 | 62 | array_shift($wildcards); |
63 | 63 | |
64 | 64 | $wildcards = Collection::make($wildcards)->flatten()->all(); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $sub = ""; |
68 | 68 | |
69 | 69 | foreach ($patterns as $index => $pattern) { |
70 | - $patterns[$index] = "/\b" . $pattern . "\b/i"; |
|
70 | + $patterns[$index] = "/\b".$pattern."\b/i"; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // TODO: Test multiple person wildcards |
@@ -76,14 +76,14 @@ discard block |
||
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] === '{') { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | protected function searchTriggers(string $trigger): void |
79 | 79 | { |
80 | 80 | synapse()->triggers->each( |
81 | - function ($class) use ($trigger) { |
|
81 | + function($class) use ($trigger) { |
|
82 | 82 | $triggerClass = "\\Axiom\\Rivescript\\Cortex\\Triggers\\$class"; |
83 | 83 | $triggerClass = new $triggerClass(synapse()->input); |
84 | 84 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | { |
158 | 158 | synapse()->brain->say("Start response is {$response}"); |
159 | 159 | synapse()->tags->each( |
160 | - function ($tag) use (&$response) { |
|
160 | + function($tag) use (&$response) { |
|
161 | 161 | $class = "\\Axiom\\Rivescript\\Cortex\\Tags\\$tag"; |
162 | 162 | $tagClass = new $class(); |
163 | 163 |