11<?php
2+
23declare (strict_types=1 );
34
45/**
1213 * @link https://cakephp.org CakePHP(tm) Project
1314 * @license https://www.opensource.org/licenses/mit-license.php MIT License
1415 */
16+
1517namespace DebugKit \Model \Table ;
1618
1719use Cake \Core \Configure ;
3335 * @method \DebugKit\Model\Entity\Request[] patchEntities($entities, array $data, array $options = [])
3436 * @method \DebugKit\Model\Entity\Request findOrCreate($search, callable $callback = null, array $options = [])
3537 */
36- class RequestsTable extends Table
37- {
38+ class RequestsTable extends Table {
3839 use LazyTableTrait;
3940 use SqlTraceTrait;
4041
@@ -44,8 +45,7 @@ class RequestsTable extends Table
4445 * @param array $config Config data.
4546 * @return void
4647 */
47- public function initialize (array $ config ): void
48- {
48+ public function initialize (array $ config ): void {
4949 $ this ->hasMany ('DebugKit.Panels ' , [
5050 'sort ' => ['Panels.title ' => 'ASC ' ],
5151 ]);
@@ -62,8 +62,7 @@ public function initialize(array $config): void
6262 *
6363 * @return string
6464 */
65- public static function defaultConnectionName (): string
66- {
65+ public static function defaultConnectionName (): string {
6766 return 'debug_kit ' ;
6867 }
6968
@@ -73,8 +72,7 @@ public static function defaultConnectionName(): string
7372 * @param \Cake\ORM\Query\SelectQuery $query The query
7473 * @return \Cake\ORM\Query\SelectQuery The query.
7574 */
76- public function findRecent (SelectQuery $ query ): SelectQuery
77- {
75+ public function findRecent (SelectQuery $ query ): SelectQuery {
7876 return $ query ->orderBy (['Requests.requested_at ' => 'DESC ' ])
7977 ->limit (10 );
8078 }
@@ -84,8 +82,7 @@ public function findRecent(SelectQuery $query): SelectQuery
8482 *
8583 * @return bool
8684 */
87- protected function shouldGc (): bool
88- {
85+ protected function shouldGc (): bool {
8986 return rand (1 , 10 ) === 10 ;
9087 }
9188
@@ -94,8 +91,7 @@ protected function shouldGc(): bool
9491 *
9592 * @return bool
9693 */
97- protected function shouldGcVacuum (): bool
98- {
94+ protected function shouldGcVacuum (): bool {
9995 return rand (1 , 10 ) === 10 ;
10096 }
10197
@@ -108,8 +104,7 @@ protected function shouldGcVacuum(): bool
108104 *
109105 * @return void
110106 */
111- public function gc (): void
112- {
107+ public function gc (): void {
113108 if (!$ this ->shouldGc ()) {
114109 return ;
115110 }
@@ -157,9 +152,9 @@ public function gc(): void
157152 try {
158153 $ conn ->execute ('VACUUM; ' );
159154 } catch (PDOException ) {
160- if ( is_file ( TMP . ' debug_kit.sqlite ' )) {
161- unlink (TMP . 'debug_kit.sqlite ' );
162- }
155+ // phpcs:disable
156+ @ unlink (TMP . 'debug_kit.sqlite ' );
157+ // phpcs:enable
163158 }
164159 }
165160 } catch (PDOException $ e ) {
0 commit comments