@@ -75,13 +75,22 @@ public function __construct(
7575 /**
7676 * @throws RuntimeException when cannot connect to DB in the first place
7777 */
78- private function isExists (string $ errorFile , int $ errorLine , string $ errorMessage , string $ url , string $ errorType ) : bool
79- {
78+ private function isExists (
79+ string $ errorFile ,
80+ int $ errorLine ,
81+ string $ errorMessage ,
82+ string $ url ,
83+ string $ errorType
84+ ) : bool {
8085 $ writers = $ this ->logger ->getWriters ()->toArray ();
8186 foreach ($ writers as $ writer ) {
8287 if ($ writer instanceof Db) {
8388 try {
84- $ handlerWriterDb = new Writer \Checker \Db ($ writer , $ this ->configLoggingSettings , $ this ->logWritersConfig );
89+ $ handlerWriterDb = new Writer \Checker \Db (
90+ $ writer ,
91+ $ this ->configLoggingSettings ,
92+ $ this ->logWritersConfig
93+ );
8594 if ($ handlerWriterDb ->isExists ($ errorFile , $ errorLine , $ errorMessage , $ url , $ errorType )) {
8695 return true ;
8796 }
@@ -212,14 +221,13 @@ public function handleErrorException(Throwable $t, RequestInterface $request) :
212221 $ serverUrl = $ extra ['server_url ' ];
213222
214223 try {
215- if (
216- $ this ->isExists (
217- $ collectedExceptionData ['errorFile ' ],
218- $ collectedExceptionData ['errorLine ' ],
219- $ collectedExceptionData ['errorMessage ' ],
220- $ extra ['url ' ],
221- $ collectedExceptionData ['errorType ' ]
222- )
224+ if ($ this ->isExists (
225+ $ collectedExceptionData ['errorFile ' ],
226+ $ collectedExceptionData ['errorLine ' ],
227+ $ collectedExceptionData ['errorMessage ' ],
228+ $ extra ['url ' ],
229+ $ collectedExceptionData ['errorType ' ]
230+ )
223231 ) {
224232 return ;
225233 }
@@ -232,6 +240,11 @@ public function handleErrorException(Throwable $t, RequestInterface $request) :
232240 unset($ extra ['server_url ' ]);
233241 }
234242
235- $ this ->sendMail ($ collectedExceptionData ['priority ' ], $ collectedExceptionData ['errorMessage ' ], $ extra , '[ ' .$ serverUrl .'] ' .$ collectedExceptionData ['errorType ' ].' has thrown ' );
243+ $ this ->sendMail (
244+ $ collectedExceptionData ['priority ' ],
245+ $ collectedExceptionData ['errorMessage ' ],
246+ $ extra ,
247+ '[ ' . $ serverUrl . '] ' . $ collectedExceptionData ['errorType ' ] . ' has thrown '
248+ );
236249 }
237250}
0 commit comments