@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | if (\is_array($levelMap)) { |
87 | 87 | $passedKeys = \array_keys($levelMap); |
88 | 88 | if ($passedKeys !== \array_keys($this->levelMap)) { |
89 | - throw new \InvalidArgumentException('Level map keys must be the LogLevel::* values; passed ' . \print_r($passedKeys, true)); |
|
89 | + throw new \InvalidArgumentException('Level map keys must be the LogLevel::* values; passed '.\print_r($passedKeys, true)); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | /** |
114 | 114 | * @param string|int $level |
115 | 115 | */ |
116 | - public function hasRecords(string|int $level): bool |
|
116 | + public function hasRecords(string | int $level): bool |
|
117 | 117 | { |
118 | 118 | return isset($this->recordsByLevel[$level]); |
119 | 119 | } |
@@ -121,31 +121,31 @@ discard block |
||
121 | 121 | /** |
122 | 122 | * @param string|array<string, mixed> $record |
123 | 123 | */ |
124 | - public function hasRecord(string|array $record, string|int $level): bool |
|
124 | + public function hasRecord(string | array $record, string | int $level): bool |
|
125 | 125 | { |
126 | 126 | if (\is_string($record)) { |
127 | 127 | $record = ['message' => $record]; |
128 | 128 | } |
129 | 129 | |
130 | - return $this->hasRecordThatPasses(static function (array $rec) use ($record) { |
|
130 | + return $this->hasRecordThatPasses(static function(array $rec) use ($record) { |
|
131 | 131 | if ($rec['message'] !== $record['message']) { |
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | |
135 | - return ! isset($record['context']) || $rec['context'] === $record['context']; |
|
135 | + return !isset($record['context']) || $rec['context'] === $record['context']; |
|
136 | 136 | }, $level); |
137 | 137 | } |
138 | 138 | |
139 | - public function hasRecordThatContains(string $message, string|int $level): bool |
|
139 | + public function hasRecordThatContains(string $message, string | int $level): bool |
|
140 | 140 | { |
141 | - return $this->hasRecordThatPasses(static function (array $rec) use ($message) { |
|
141 | + return $this->hasRecordThatPasses(static function(array $rec) use ($message) { |
|
142 | 142 | return \strpos($rec['message'], $message) !== false; |
143 | 143 | }, $level); |
144 | 144 | } |
145 | 145 | |
146 | - public function hasRecordThatMatches(string $regex, string|int $level): bool |
|
146 | + public function hasRecordThatMatches(string $regex, string | int $level): bool |
|
147 | 147 | { |
148 | - return $this->hasRecordThatPasses(static function ($rec) use ($regex) { |
|
148 | + return $this->hasRecordThatPasses(static function($rec) use ($regex) { |
|
149 | 149 | return \preg_match($regex, $rec['message']) > 0; |
150 | 150 | }, $level); |
151 | 151 | } |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | /** |
154 | 154 | * @param callable(array<string, mixed>, int): bool $predicate |
155 | 155 | */ |
156 | - public function hasRecordThatPasses(callable $predicate, string|int $level): bool |
|
156 | + public function hasRecordThatPasses(callable $predicate, string | int $level): bool |
|
157 | 157 | { |
158 | - if (! isset($this->recordsByLevel[$level])) { |
|
158 | + if (!isset($this->recordsByLevel[$level])) { |
|
159 | 159 | return false; |
160 | 160 | } |
161 | 161 | |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | public function __call(string $method, array $args): bool |
175 | 175 | { |
176 | 176 | $levelNames = \implode('|', \array_map('ucfirst', \array_keys($this->levelMap))); |
177 | - if (\preg_match('/(.*)(' . $levelNames . ')(.*)/', $method, $matches) > 0) { |
|
178 | - $genericMethod = $matches[1] . ($matches[3] !== 'Records' ? 'Record' : '') . $matches[3]; |
|
177 | + if (\preg_match('/(.*)('.$levelNames.')(.*)/', $method, $matches) > 0) { |
|
178 | + $genericMethod = $matches[1].($matches[3] !== 'Records' ? 'Record' : '').$matches[3]; |
|
179 | 179 | $callable = [$this, $genericMethod]; |
180 | 180 | $level = $this->levelMap[\strtolower($matches[2])]; |
181 | 181 | if (\is_callable($callable)) { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | - throw new \BadMethodCallException('Call to undefined method ' . static::class . '::' . $method . '()'); |
|
188 | + throw new \BadMethodCallException('Call to undefined method '.static::class.'::'.$method.'()'); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | public function reset(): void |