88use rex_addon ;
99use rex_exception ;
1010use rex_instance_pool_trait ;
11- use rex_socket_exception ;
1211use rex_sql ;
12+ use rex_sql_exception ;
1313use voku \helper \HtmlDomParser ;
1414
1515final class Index
@@ -40,7 +40,7 @@ public static function get(int $id): ?self
4040 $ sql ->setWhere ('id = ? ' , [$ id ]);
4141 $ sql ->select ();
4242
43- if (null === $ sql ->getRows ()) {
43+ if ($ sql ->getRows () === null ) {
4444 return null ;
4545 }
4646
@@ -74,7 +74,7 @@ public function setValue(string $key, mixed $value): self
7474
7575 public function getValue (string $ key ): mixed
7676 {
77- if (' id ' === $ key ) {
77+ if ($ key === ' id ' ) {
7878 return $ this ->id ;
7979 }
8080
@@ -98,15 +98,15 @@ private static function fromSqlData(array $data): self
9898 }
9999
100100 /**
101- * @throws \ rex_sql_exception
101+ * @throws rex_sql_exception
102102 */
103103 public static function createSnapshot (Url $ url ): bool
104104 {
105105 $ url ->setLastScan ();
106106 $ response = $ url ->getContent ();
107107 $ content = $ response ->getBody ();
108108
109- if (' HTML ' === $ url ->getType ()) {
109+ if ($ url ->getType () === ' HTML ' ) {
110110 $ content = preg_replace ('/<script\b[^>]*>(.*?)<\/script>/is ' , '' , $ content );
111111 $ content = preg_replace ('/<style\b[^>]*>(.*?)<\/style>/is ' , '' , $ content );
112112 $ content = preg_replace ('/<noscript\b[^>]*>(.*?)<\/noscript>/is ' , '' , $ content );
@@ -147,7 +147,7 @@ public static function cleanUpSnapshots(): void
147147 $ addon = rex_addon::get ('diff_detect ' );
148148 $ cleanup_interval = $ addon ->getConfig ('cleanup_interval ' );
149149
150- if (null === $ cleanup_interval || 0 === $ cleanup_interval ) {
150+ if ($ cleanup_interval === null || $ cleanup_interval === 0 ) {
151151 return ;
152152 }
153153
@@ -160,10 +160,9 @@ public static function cleanUpSnapshots(): void
160160 'interval ' => $ cleanup_interval ,
161161 ]);
162162 $ sql ->delete ();
163- if (null !== $ sql ->getError ()) {
163+ if ($ sql ->getError () !== null ) {
164164 throw new rex_exception ($ sql ->getError ());
165165 }
166-
167166 }
168167
169168 public function setUrl (Url $ url ): self
@@ -180,7 +179,7 @@ public function getUrl(): ?Url
180179
181180 public function getContent (): string
182181 {
183- if (' RSS ' === $ this ->url ?->getType()) {
182+ if ($ this ->url ?->getType() === ' RSS ' ) {
184183 return $ this ->getValue ('content ' );
185184 }
186185
0 commit comments