1717 * @method bool hasNotice($record)
1818 * @method bool hasInfo($record)
1919 * @method bool hasDebug($record)
20- *
2120 * @method bool hasEmergencyRecords()
2221 * @method bool hasAlertRecords()
2322 * @method bool hasCriticalRecords()
2625 * @method bool hasNoticeRecords()
2726 * @method bool hasInfoRecords()
2827 * @method bool hasDebugRecords()
29- *
3028 * @method bool hasEmergencyThatContains($message)
3129 * @method bool hasAlertThatContains($message)
3230 * @method bool hasCriticalThatContains($message)
3533 * @method bool hasNoticeThatContains($message)
3634 * @method bool hasInfoThatContains($message)
3735 * @method bool hasDebugThatContains($message)
38- *
3936 * @method bool hasEmergencyThatMatches($message)
4037 * @method bool hasAlertThatMatches($message)
4138 * @method bool hasCriticalThatMatches($message)
4441 * @method bool hasNoticeThatMatches($message)
4542 * @method bool hasInfoThatMatches($message)
4643 * @method bool hasDebugThatMatches($message)
47- *
4844 * @method bool hasEmergencyThatPasses($message)
4945 * @method bool hasAlertThatPasses($message)
5046 * @method bool hasCriticalThatPasses($message)
@@ -64,7 +60,7 @@ class TestLogger extends AbstractLogger
6460 public $ recordsByLevel = [];
6561
6662 /**
67- * @inheritdoc
63+ * { @inheritdoc}
6864 */
6965 public function log ($ level , $ message , array $ context = []): void
7066 {
@@ -88,21 +84,23 @@ public function hasRecord($record, $level)
8884 if (is_string ($ record )) {
8985 $ record = ['message ' => $ record ];
9086 }
87+
9188 return $ this ->hasRecordThatPasses (function ($ rec ) use ($ record ) {
9289 if ($ rec ['message ' ] !== $ record ['message ' ]) {
9390 return false ;
9491 }
9592 if (isset ($ record ['context ' ]) && $ rec ['context ' ] !== $ record ['context ' ]) {
9693 return false ;
9794 }
95+
9896 return true ;
9997 }, $ level );
10098 }
10199
102100 public function hasRecordThatContains ($ message , $ level )
103101 {
104102 return $ this ->hasRecordThatPasses (function ($ rec ) use ($ message ) {
105- return strpos ($ rec ['message ' ], $ message ) !== false ;
103+ return false !== strpos ($ rec ['message ' ], $ message );
106104 }, $ level );
107105 }
108106
@@ -123,20 +121,22 @@ public function hasRecordThatPasses(callable $predicate, $level)
123121 return true ;
124122 }
125123 }
124+
126125 return false ;
127126 }
128127
129128 public function __call ($ method , $ args )
130129 {
131130 if (preg_match ('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/ ' , $ method , $ matches ) > 0 ) {
132- $ genericMethod = $ matches [1 ] . ('Records ' !== $ matches [3 ] ? 'Record ' : '' ) . $ matches [3 ];
131+ $ genericMethod = $ matches [1 ]. ('Records ' !== $ matches [3 ] ? 'Record ' : '' ). $ matches [3 ];
133132 $ level = strtolower ($ matches [2 ]);
134133 if (method_exists ($ this , $ genericMethod )) {
135134 $ args [] = $ level ;
135+
136136 return call_user_func_array ([$ this , $ genericMethod ], $ args );
137137 }
138138 }
139- throw new \BadMethodCallException ('Call to undefined method ' . get_class ($ this ) . ':: ' . $ method . '() ' );
139+ throw new \BadMethodCallException ('Call to undefined method ' . get_class ($ this ). ':: ' . $ method. '() ' );
140140 }
141141
142142 public function reset ()
0 commit comments