@@ -60,7 +60,7 @@ |
||
60 | 60 | if (strpos($sub, '.') > -1) { |
61 | 61 | $parts = explode('.', $sub); |
62 | 62 | if (count($parts) !== 0) { |
63 | - array_walk($parts, function (&$part) { |
|
63 | + array_walk($parts, function(&$part) { |
|
64 | 64 | $part = ucfirst(trim($part)); |
65 | 65 | }); |
66 | 66 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | $triggers = $this->determineWordCount($triggers); |
86 | 86 | $triggers = $this->determineTypeCount($triggers); |
87 | - return $triggers->sort(function ($current, $previous) { |
|
87 | + return $triggers->sort(function($current, $previous) { |
|
88 | 88 | return ($current['order'] < $previous['order']) ? -1 : 1; |
89 | 89 | })->reverse(); |
90 | 90 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | protected function determineTypeCount(Collection $triggers): Collection |
100 | 100 | { |
101 | - return $triggers->each(function ($data, $trigger) use ($triggers) { |
|
101 | + return $triggers->each(function($data, $trigger) use ($triggers) { |
|
102 | 102 | if (isset($data['type'])) { |
103 | 103 | switch ($data['type']) { |
104 | 104 | case 'atomic': |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected function determineWordCount(Collection $triggers): Collection |
132 | 132 | { |
133 | - return $triggers->each(function ($data, $trigger) use ($triggers) { |
|
133 | + return $triggers->each(function($data, $trigger) use ($triggers) { |
|
134 | 134 | $data['order'] = count(explode(' ', $trigger)); |
135 | 135 | |
136 | 136 | $triggers->put($trigger, $data); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | parent::__construct(); |
31 | 31 | |
32 | - include __DIR__ . '/bootstrap.php'; |
|
32 | + include __DIR__.'/bootstrap.php'; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -61,7 +61,7 @@ |
||
61 | 61 | continue; |
62 | 62 | } |
63 | 63 | |
64 | - $commands->each(function ($command) use ($node) { |
|
64 | + $commands->each(function($command) use ($node) { |
|
65 | 65 | $class = "\\Axiom\\Rivescript\\Cortex\\Commands\\$command"; |
66 | 66 | $commandClass = new $class(); |
67 | 67 | $commandClass->parse($node); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | if (stream_wrapper_register($this->name, ContentStream::class)) { |
53 | - $this->stream = fopen($this->name . "://input", "r+"); |
|
53 | + $this->stream = fopen($this->name."://input", "r+"); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | if (is_resource($this->stream) === false) { |
@@ -111,8 +111,9 @@ |
||
111 | 111 | public function loadDirectory(string $path) |
112 | 112 | { |
113 | 113 | foreach (new DirectoryIterator($path) as $file) { |
114 | - if ($file->isDot()) |
|
115 | - continue; |
|
114 | + if ($file->isDot()) { |
|
115 | + continue; |
|
116 | + } |
|
116 | 117 | |
117 | 118 | $this->loadFile($file->getPathname()); |
118 | 119 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function stream_read(int $count): string |
78 | 78 | { |
79 | - $p =& $this->position; |
|
79 | + $p = & $this->position; |
|
80 | 80 | $ret = substr($this->content, $p, $count); |
81 | 81 | $p += strlen($ret); |
82 | 82 | return $ret; |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function stream_write(string $data): int |
93 | 93 | { |
94 | - $v =& $this->content; |
|
94 | + $v = & $this->content; |
|
95 | 95 | $l = strlen($data); |
96 | - $p =& $this->position; |
|
97 | - $v = substr($v, 0, $p) . $data . substr($v, $p += $l); |
|
96 | + $p = & $this->position; |
|
97 | + $v = substr($v, 0, $p).$data.substr($v, $p += $l); |
|
98 | 98 | return $l; |
99 | 99 | } |
100 | 100 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | public function stream_seek(int $offset, int $whence = SEEK_SET): bool |
133 | 133 | { |
134 | 134 | $l = strlen($this->content); |
135 | - $p =& $this->position; |
|
135 | + $p = & $this->position; |
|
136 | 136 | switch ($whence) { |
137 | 137 | case SEEK_SET: |
138 | 138 | $newPos = $offset; |
@@ -147,7 +147,9 @@ |
||
147 | 147 | return false; |
148 | 148 | } |
149 | 149 | $ret = ($newPos >= 0 && $newPos <= $l); |
150 | - if ($ret) $p = $newPos; |
|
150 | + if ($ret) { |
|
151 | + $p = $newPos; |
|
152 | + } |
|
151 | 153 | return $ret; |
152 | 154 | } |
153 | 155 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | private function sortResponses(Collection $responses): Collection |
64 | 64 | { |
65 | 65 | return $responses->sort( |
66 | - function ($current, $previous) { |
|
66 | + function($current, $previous) { |
|
67 | 67 | return ($current->order < $previous->order) ? -1 : 1; |
68 | 68 | } |
69 | 69 | )->reverse(); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $lastData = $responses->first(); |
103 | 103 | $lastResponse = ""; |
104 | 104 | $responses->each( |
105 | - function (ResponseQueueItem $data, $response) use (&$lastData, &$lastResponse, &$responses) { |
|
105 | + function(ResponseQueueItem $data, $response) use (&$lastData, &$lastResponse, &$responses) { |
|
106 | 106 | |
107 | 107 | if ($data->type == 'continue' && $lastData->command == '-') { |
108 | 108 | $responses->remove($lastResponse); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | private function determineResponseOrder(Collection $responses): Collection |
134 | 134 | { |
135 | 135 | return $responses->each( |
136 | - function (ResponseQueueItem $data, $response) use ($responses) { |
|
136 | + function(ResponseQueueItem $data, $response) use ($responses) { |
|
137 | 137 | if (isset($data->type)) { |
138 | 138 | switch ($data->type) { |
139 | 139 | case 'condition': |