@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | protected function setUp() |
| 27 | 27 | { |
| 28 | 28 | parent::setUp(); |
| 29 | - $this->destDirectory = sys_get_temp_dir() . '/gplay-screenshots'; |
|
| 29 | + $this->destDirectory = sys_get_temp_dir().'/gplay-screenshots'; |
|
| 30 | 30 | $cache = new ArrayCache(); |
| 31 | 31 | $this->gplay = new GPlayApps(); |
| 32 | 32 | $this->gplay->setCache($cache); |
@@ -57,17 +57,17 @@ discard block |
||
| 57 | 57 | $icon = $detailApp->getIcon(); |
| 58 | 58 | |
| 59 | 59 | $icon->setSize(128); |
| 60 | - $imageInfo = $icon->saveAs($this->destDirectory . '/icon_small.png'); |
|
| 60 | + $imageInfo = $icon->saveAs($this->destDirectory.'/icon_small.png'); |
|
| 61 | 61 | $this->assertInstanceOf(ImageInfo::class, $imageInfo); |
| 62 | 62 | $this->assertContains(128, [$imageInfo->getWidth(), $imageInfo->getHeight()]); |
| 63 | 63 | |
| 64 | 64 | $icon->setSize(256); |
| 65 | - $imageInfo = $icon->saveAs($this->destDirectory . '/icon_medium.png'); |
|
| 65 | + $imageInfo = $icon->saveAs($this->destDirectory.'/icon_medium.png'); |
|
| 66 | 66 | $this->assertInstanceOf(ImageInfo::class, $imageInfo); |
| 67 | 67 | $this->assertContains(256, [$imageInfo->getWidth(), $imageInfo->getHeight()]); |
| 68 | 68 | |
| 69 | 69 | $icon->setSize(512); |
| 70 | - $imageInfo = $icon->saveAs($this->destDirectory . '/icon_large.png'); |
|
| 70 | + $imageInfo = $icon->saveAs($this->destDirectory.'/icon_large.png'); |
|
| 71 | 71 | $this->assertInstanceOf(ImageInfo::class, $imageInfo); |
| 72 | 72 | $this->assertContains(512, [$imageInfo->getWidth(), $imageInfo->getHeight()]); |
| 73 | 73 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $detailApp = $this->gplay->getApp('com.rovio.angrybirdsfriends'); |
| 81 | 81 | $screenshots = $detailApp->getScreenshots(); |
| 82 | - array_walk($screenshots, static function (GoogleImage $image) { |
|
| 82 | + array_walk($screenshots, static function(GoogleImage $image) { |
|
| 83 | 83 | $image->setSize(512); |
| 84 | 84 | }); |
| 85 | 85 | |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | $imageInfos = $this->gplay->saveGoogleImages( |
| 89 | 89 | $screenshots, |
| 90 | - static function (GoogleImage $image) use ($destDir) { |
|
| 90 | + static function(GoogleImage $image) use ($destDir) { |
|
| 91 | 91 | $hashUrl = $image->getHashUrl('md5', 2); |
| 92 | - return $destDir . DIRECTORY_SEPARATOR . $hashUrl . '.png'; |
|
| 92 | + return $destDir.DIRECTORY_SEPARATOR.$hashUrl.'.png'; |
|
| 93 | 93 | } |
| 94 | 94 | ); |
| 95 | 95 | $this->assertIsArray($imageInfos); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $this->expectExceptionMessage('404 Not Found'); |
| 107 | 107 | |
| 108 | 108 | $invalidImage = new GoogleImage('https://lh3.googleusercontent.com/DKoidc0T3T1KvYC2stChcX9zwmjKj1pgmg3hXzGBDQXM8RG_7JjgiuS0CLOh8DUa000'); |
| 109 | - $invalidImage->saveAs($this->destDirectory . '/images.png'); |
|
| 109 | + $invalidImage->saveAs($this->destDirectory.'/images.png'); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function testSaveInvalidImages(): void |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $invalidImage3 = new GoogleImage('https://lh3.googleusercontent.com/DKoidc0T3T1KvYC2stChcX9zwmjKj1pgmg3hXzGBDQXM8RG_7JjgiuS0CLOh8DUa003'); |
| 119 | 119 | |
| 120 | 120 | $images = [$invalidImage, $invalidImage2, $invalidImage3]; |
| 121 | - array_walk($images, static function (GoogleImage $image) { |
|
| 121 | + array_walk($images, static function(GoogleImage $image) { |
|
| 122 | 122 | $image->setSize(512); |
| 123 | 123 | }); |
| 124 | 124 | |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $this->gplay->saveGoogleImages( |
| 128 | 128 | $images, |
| 129 | - static function (GoogleImage $image) use ($destDir) { |
|
| 129 | + static function(GoogleImage $image) use ($destDir) { |
|
| 130 | 130 | $hashUrl = $image->getHashUrl('crc32'); |
| 131 | - return $destDir . DIRECTORY_SEPARATOR . $hashUrl . '.png'; |
|
| 131 | + return $destDir.DIRECTORY_SEPARATOR.$hashUrl.'.png'; |
|
| 132 | 132 | } |
| 133 | 133 | ); |
| 134 | 134 | } |
@@ -264,10 +264,10 @@ |
||
| 264 | 264 | |
| 265 | 265 | $this->assertSame( |
| 266 | 266 | $appDetail->getHistogramRating()->__toString(), |
| 267 | - "⭐⭐⭐⭐⭐ {$appDetail->getHistogramRating()->getFiveStars()}\n" . |
|
| 268 | - "⭐⭐⭐⭐ {$appDetail->getHistogramRating()->getFourStars()}\n" . |
|
| 269 | - "⭐⭐⭐ {$appDetail->getHistogramRating()->getThreeStars()}\n" . |
|
| 270 | - "⭐⭐ {$appDetail->getHistogramRating()->getTwoStars()}\n" . |
|
| 267 | + "⭐⭐⭐⭐⭐ {$appDetail->getHistogramRating()->getFiveStars()}\n". |
|
| 268 | + "⭐⭐⭐⭐ {$appDetail->getHistogramRating()->getFourStars()}\n". |
|
| 269 | + "⭐⭐⭐ {$appDetail->getHistogramRating()->getThreeStars()}\n". |
|
| 270 | + "⭐⭐ {$appDetail->getHistogramRating()->getTwoStars()}\n". |
|
| 271 | 271 | "⭐ {$appDetail->getHistogramRating()->getOneStar()}" |
| 272 | 272 | ); |
| 273 | 273 | |
@@ -122,10 +122,10 @@ discard block |
||
| 122 | 122 | public function testSettersAndGetters(): void |
| 123 | 123 | { |
| 124 | 124 | $baseUrl = 'https://lh3.googleusercontent.com/lwNbmbYSbFOQmVVVlMRHow9rpIcgAMnqfXRTQ6NUfvjJb6ZSXn_a7vouRuc7avmArmA'; |
| 125 | - $imageUrl = $baseUrl . '=w515-h290'; |
|
| 125 | + $imageUrl = $baseUrl.'=w515-h290'; |
|
| 126 | 126 | |
| 127 | 127 | $googleImage = new GoogleImage($imageUrl); |
| 128 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=w515-h290'); |
|
| 128 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=w515-h290'); |
|
| 129 | 129 | |
| 130 | 130 | $this->assertNull($googleImage->getSize()); |
| 131 | 131 | $this->assertSame($googleImage->getWidth(), 515); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $this->assertFalse($googleImage->isSquareCrop()); |
| 136 | 136 | $this->assertFalse($googleImage->isVerticalFlip()); |
| 137 | 137 | $this->assertFalse($googleImage->isHorizontalFlip()); |
| 138 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=w515-h290'); |
|
| 138 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=w515-h290'); |
|
| 139 | 139 | |
| 140 | 140 | $googleImage->setSize(300); |
| 141 | 141 | $this->assertSame($googleImage->getSize(), 300); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $this->assertFalse($googleImage->isSquareCrop()); |
| 147 | 147 | $this->assertFalse($googleImage->isVerticalFlip()); |
| 148 | 148 | $this->assertFalse($googleImage->isHorizontalFlip()); |
| 149 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=s300'); |
|
| 149 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=s300'); |
|
| 150 | 150 | |
| 151 | 151 | $googleImage->useOriginalSize(); |
| 152 | 152 | $this->assertSame($googleImage->getSize(), 0); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $this->assertFalse($googleImage->isSquareCrop()); |
| 158 | 158 | $this->assertFalse($googleImage->isVerticalFlip()); |
| 159 | 159 | $this->assertFalse($googleImage->isHorizontalFlip()); |
| 160 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=s0'); |
|
| 160 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=s0'); |
|
| 161 | 161 | |
| 162 | 162 | $googleImage->setWidth(500); |
| 163 | 163 | $this->assertNull($googleImage->getSize()); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $this->assertFalse($googleImage->isSquareCrop()); |
| 169 | 169 | $this->assertFalse($googleImage->isVerticalFlip()); |
| 170 | 170 | $this->assertFalse($googleImage->isHorizontalFlip()); |
| 171 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=w500'); |
|
| 171 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=w500'); |
|
| 172 | 172 | |
| 173 | 173 | $googleImage->setHeight(400); |
| 174 | 174 | $this->assertNull($googleImage->getSize()); |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $this->assertFalse($googleImage->isSquareCrop()); |
| 180 | 180 | $this->assertFalse($googleImage->isVerticalFlip()); |
| 181 | 181 | $this->assertFalse($googleImage->isHorizontalFlip()); |
| 182 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=w500-h400'); |
|
| 182 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=w500-h400'); |
|
| 183 | 183 | |
| 184 | 184 | $googleImage->setBorder(10); |
| 185 | 185 | $this->assertNull($googleImage->getSize()); |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $this->assertFalse($googleImage->isSquareCrop()); |
| 191 | 191 | $this->assertFalse($googleImage->isVerticalFlip()); |
| 192 | 192 | $this->assertFalse($googleImage->isHorizontalFlip()); |
| 193 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=w500-h400-b10'); |
|
| 193 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=w500-h400-b10'); |
|
| 194 | 194 | |
| 195 | 195 | $googleImage->setSmartCrop(true); |
| 196 | 196 | $this->assertNull($googleImage->getSize()); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $this->assertFalse($googleImage->isSquareCrop()); |
| 202 | 202 | $this->assertFalse($googleImage->isVerticalFlip()); |
| 203 | 203 | $this->assertFalse($googleImage->isHorizontalFlip()); |
| 204 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=w500-h400-p-b10'); |
|
| 204 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=w500-h400-p-b10'); |
|
| 205 | 205 | |
| 206 | 206 | $googleImage->setSquareCrop(true); |
| 207 | 207 | $this->assertNull($googleImage->getSize()); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $this->assertTrue($googleImage->isSquareCrop()); |
| 213 | 213 | $this->assertFalse($googleImage->isVerticalFlip()); |
| 214 | 214 | $this->assertFalse($googleImage->isHorizontalFlip()); |
| 215 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=w500-h400-c-b10'); |
|
| 215 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=w500-h400-c-b10'); |
|
| 216 | 216 | |
| 217 | 217 | $googleImage->setVerticalFlip(true); |
| 218 | 218 | $this->assertNull($googleImage->getSize()); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $this->assertTrue($googleImage->isSquareCrop()); |
| 224 | 224 | $this->assertTrue($googleImage->isVerticalFlip()); |
| 225 | 225 | $this->assertFalse($googleImage->isHorizontalFlip()); |
| 226 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=w500-h400-c-b10-fv'); |
|
| 226 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=w500-h400-c-b10-fv'); |
|
| 227 | 227 | |
| 228 | 228 | $googleImage->setHorizontalFlip(true); |
| 229 | 229 | $this->assertNull($googleImage->getSize()); |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $this->assertTrue($googleImage->isSquareCrop()); |
| 235 | 235 | $this->assertTrue($googleImage->isVerticalFlip()); |
| 236 | 236 | $this->assertTrue($googleImage->isHorizontalFlip()); |
| 237 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=w500-h400-c-b10-fv-fh'); |
|
| 237 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=w500-h400-c-b10-fv-fh'); |
|
| 238 | 238 | |
| 239 | 239 | $googleImage->setSize(300); |
| 240 | 240 | $this->assertSame($googleImage->getSize(), 300); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $this->assertTrue($googleImage->isSquareCrop()); |
| 246 | 246 | $this->assertTrue($googleImage->isVerticalFlip()); |
| 247 | 247 | $this->assertTrue($googleImage->isHorizontalFlip()); |
| 248 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=s300-c-b10-fv-fh'); |
|
| 248 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=s300-c-b10-fv-fh'); |
|
| 249 | 249 | |
| 250 | 250 | $googleImage->setHeight(600); |
| 251 | 251 | $this->assertNull($googleImage->getSize()); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $this->assertTrue($googleImage->isSquareCrop()); |
| 257 | 257 | $this->assertTrue($googleImage->isVerticalFlip()); |
| 258 | 258 | $this->assertTrue($googleImage->isHorizontalFlip()); |
| 259 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=h600-c-b10-fv-fh'); |
|
| 259 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=h600-c-b10-fv-fh'); |
|
| 260 | 260 | |
| 261 | 261 | $googleImage->setSmartCrop(true); |
| 262 | 262 | $this->assertNull($googleImage->getSize()); |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $this->assertFalse($googleImage->isSquareCrop()); |
| 268 | 268 | $this->assertTrue($googleImage->isVerticalFlip()); |
| 269 | 269 | $this->assertTrue($googleImage->isHorizontalFlip()); |
| 270 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=h600-b10-fv-fh'); |
|
| 270 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=h600-b10-fv-fh'); |
|
| 271 | 271 | |
| 272 | 272 | $googleImage->setWidth(300); |
| 273 | 273 | $this->assertNull($googleImage->getSize()); |
@@ -278,10 +278,10 @@ discard block |
||
| 278 | 278 | $this->assertFalse($googleImage->isSquareCrop()); |
| 279 | 279 | $this->assertTrue($googleImage->isVerticalFlip()); |
| 280 | 280 | $this->assertTrue($googleImage->isHorizontalFlip()); |
| 281 | - $this->assertSame($googleImage->getUrl(), $baseUrl . '=w300-h600-p-b10-fv-fh'); |
|
| 281 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'=w300-h600-p-b10-fv-fh'); |
|
| 282 | 282 | |
| 283 | 283 | // test toString() |
| 284 | - $this->assertEquals($googleImage, $baseUrl . '=w300-h600-p-b10-fv-fh'); |
|
| 284 | + $this->assertEquals($googleImage, $baseUrl.'=w300-h600-p-b10-fv-fh'); |
|
| 285 | 285 | $this->assertEquals($googleImage, $googleImage->__toString()); |
| 286 | 286 | $this->assertEquals($googleImage, $googleImage->getUrl()); |
| 287 | 287 | |
@@ -305,11 +305,11 @@ discard block |
||
| 305 | 305 | $imageUrl = 'https://lh3.googleusercontent.com/lwNbmbYSbFOQmVVVlMRHow9rpIcgAMnqfXRTQ6NUfvjJb6ZSXn_a7vouRuc7avmArmA'; |
| 306 | 306 | |
| 307 | 307 | $size = 300; |
| 308 | - $googleImage = new GoogleImage($imageUrl . '=w2247-h1264-p', false); |
|
| 308 | + $googleImage = new GoogleImage($imageUrl.'=w2247-h1264-p', false); |
|
| 309 | 309 | $googleImage->setSize($size); |
| 310 | 310 | $url = $googleImage->getUrl(); |
| 311 | 311 | |
| 312 | - $this->assertSame($url, $imageUrl . '=s' . $size); |
|
| 312 | + $this->assertSame($url, $imageUrl.'=s'.$size); |
|
| 313 | 313 | |
| 314 | 314 | $imageInfo = @getimagesize($url); |
| 315 | 315 | $this->assertNotFalse($imageInfo); |
@@ -324,16 +324,16 @@ discard block |
||
| 324 | 324 | $imageUrl = 'https://lh3.googleusercontent.com/lwNbmbYSbFOQmVVVlMRHow9rpIcgAMnqfXRTQ6NUfvjJb6ZSXn_a7vouRuc7avmArmA'; |
| 325 | 325 | |
| 326 | 326 | $size = 300; |
| 327 | - $googleImage = new GoogleImage($imageUrl . '=w2247-h1264', false); |
|
| 327 | + $googleImage = new GoogleImage($imageUrl.'=w2247-h1264', false); |
|
| 328 | 328 | $url = $googleImage |
| 329 | 329 | ->setSize($size) |
| 330 | 330 | ->setSmartCrop(true) |
| 331 | 331 | ->getUrl(); |
| 332 | 332 | |
| 333 | - $this->assertSame($url, $imageUrl . '=s' . $size . '-p'); |
|
| 333 | + $this->assertSame($url, $imageUrl.'=s'.$size.'-p'); |
|
| 334 | 334 | |
| 335 | 335 | $imageInfo = @getimagesize($url); |
| 336 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $url); |
|
| 336 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$url); |
|
| 337 | 337 | |
| 338 | 338 | $this->assertSame($imageInfo[0], $size); |
| 339 | 339 | $this->assertSame($imageInfo[1], $size); |
@@ -346,16 +346,16 @@ discard block |
||
| 346 | 346 | $imageUrl = 'https://lh3.googleusercontent.com/lwNbmbYSbFOQmVVVlMRHow9rpIcgAMnqfXRTQ6NUfvjJb6ZSXn_a7vouRuc7avmArmA'; |
| 347 | 347 | |
| 348 | 348 | $size = 300; |
| 349 | - $googleImage = new GoogleImage($imageUrl . '=w2247-h1264', false); |
|
| 349 | + $googleImage = new GoogleImage($imageUrl.'=w2247-h1264', false); |
|
| 350 | 350 | $url = $googleImage |
| 351 | 351 | ->setSize($size) |
| 352 | 352 | ->setSquareCrop(true) |
| 353 | 353 | ->getUrl(); |
| 354 | 354 | |
| 355 | - $this->assertSame($url, $imageUrl . '=s' . $size . '-c'); |
|
| 355 | + $this->assertSame($url, $imageUrl.'=s'.$size.'-c'); |
|
| 356 | 356 | |
| 357 | 357 | $imageInfo = @getimagesize($url); |
| 358 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $url); |
|
| 358 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$url); |
|
| 359 | 359 | |
| 360 | 360 | $this->assertSame($imageInfo[0], $size); |
| 361 | 361 | $this->assertSame($imageInfo[1], $size); |
@@ -368,15 +368,15 @@ discard block |
||
| 368 | 368 | $imageUrl = 'https://lh3.googleusercontent.com/lwNbmbYSbFOQmVVVlMRHow9rpIcgAMnqfXRTQ6NUfvjJb6ZSXn_a7vouRuc7avmArmA'; |
| 369 | 369 | |
| 370 | 370 | $size = 300; |
| 371 | - $googleImage = new GoogleImage($imageUrl . '=w2247-h1264', false); |
|
| 371 | + $googleImage = new GoogleImage($imageUrl.'=w2247-h1264', false); |
|
| 372 | 372 | $url = $googleImage |
| 373 | 373 | ->setWidth($size) |
| 374 | 374 | ->getUrl(); |
| 375 | 375 | |
| 376 | - $this->assertSame($url, $imageUrl . '=w' . $size); |
|
| 376 | + $this->assertSame($url, $imageUrl.'=w'.$size); |
|
| 377 | 377 | |
| 378 | 378 | $imageInfo = @getimagesize($url); |
| 379 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $url); |
|
| 379 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$url); |
|
| 380 | 380 | |
| 381 | 381 | $this->assertSame($imageInfo[0], $size); |
| 382 | 382 | $this->assertNotSame($imageInfo[1], $size); |
@@ -389,16 +389,16 @@ discard block |
||
| 389 | 389 | $imageUrl = 'https://lh3.googleusercontent.com/lwNbmbYSbFOQmVVVlMRHow9rpIcgAMnqfXRTQ6NUfvjJb6ZSXn_a7vouRuc7avmArmA'; |
| 390 | 390 | |
| 391 | 391 | $size = 300; |
| 392 | - $googleImage = new GoogleImage($imageUrl . '=w2247-h1264', false); |
|
| 392 | + $googleImage = new GoogleImage($imageUrl.'=w2247-h1264', false); |
|
| 393 | 393 | $url = $googleImage |
| 394 | 394 | ->setWidth($size) |
| 395 | 395 | ->setSquareCrop(true) |
| 396 | 396 | ->getUrl(); |
| 397 | 397 | |
| 398 | - $this->assertSame($url, $imageUrl . '=w' . $size . '-c'); |
|
| 398 | + $this->assertSame($url, $imageUrl.'=w'.$size.'-c'); |
|
| 399 | 399 | |
| 400 | 400 | $imageInfo = @getimagesize($url); |
| 401 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $url); |
|
| 401 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$url); |
|
| 402 | 402 | |
| 403 | 403 | $this->assertSame($imageInfo[0], $size); |
| 404 | 404 | $this->assertSame($imageInfo[1], $size); |
@@ -411,15 +411,15 @@ discard block |
||
| 411 | 411 | $imageUrl = 'https://lh3.googleusercontent.com/lwNbmbYSbFOQmVVVlMRHow9rpIcgAMnqfXRTQ6NUfvjJb6ZSXn_a7vouRuc7avmArmA'; |
| 412 | 412 | |
| 413 | 413 | $size = 300; |
| 414 | - $googleImage = new GoogleImage($imageUrl . '=w2247-h1264', false); |
|
| 414 | + $googleImage = new GoogleImage($imageUrl.'=w2247-h1264', false); |
|
| 415 | 415 | $url = $googleImage |
| 416 | 416 | ->setHeight($size) |
| 417 | 417 | ->getUrl(); |
| 418 | 418 | |
| 419 | - $this->assertSame($url, $imageUrl . '=h' . $size); |
|
| 419 | + $this->assertSame($url, $imageUrl.'=h'.$size); |
|
| 420 | 420 | |
| 421 | 421 | $imageInfo = @getimagesize($url); |
| 422 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $url); |
|
| 422 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$url); |
|
| 423 | 423 | |
| 424 | 424 | $this->assertNotSame($imageInfo[0], $size); |
| 425 | 425 | $this->assertSame($imageInfo[1], $size); |
@@ -432,16 +432,16 @@ discard block |
||
| 432 | 432 | $imageUrl = 'https://lh3.googleusercontent.com/lwNbmbYSbFOQmVVVlMRHow9rpIcgAMnqfXRTQ6NUfvjJb6ZSXn_a7vouRuc7avmArmA'; |
| 433 | 433 | |
| 434 | 434 | $size = 300; |
| 435 | - $googleImage = new GoogleImage($imageUrl . '=w2247-h1264', false); |
|
| 435 | + $googleImage = new GoogleImage($imageUrl.'=w2247-h1264', false); |
|
| 436 | 436 | $url = $googleImage |
| 437 | 437 | ->setHeight($size) |
| 438 | 438 | ->setSquareCrop(true) |
| 439 | 439 | ->getUrl(); |
| 440 | 440 | |
| 441 | - $this->assertSame($url, $imageUrl . '=h' . $size . '-c'); |
|
| 441 | + $this->assertSame($url, $imageUrl.'=h'.$size.'-c'); |
|
| 442 | 442 | |
| 443 | 443 | $imageInfo = @getimagesize($url); |
| 444 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $url); |
|
| 444 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$url); |
|
| 445 | 445 | |
| 446 | 446 | $this->assertSame($imageInfo[0], $size); |
| 447 | 447 | $this->assertSame($imageInfo[1], $size); |
@@ -455,23 +455,23 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | $width = 300; |
| 457 | 457 | $height = 333; |
| 458 | - $googleImage = new GoogleImage($imageUrl . '=w2247-h1264', false); |
|
| 458 | + $googleImage = new GoogleImage($imageUrl.'=w2247-h1264', false); |
|
| 459 | 459 | $url = $googleImage |
| 460 | 460 | ->setWidth($width) |
| 461 | 461 | ->setHeight($height) |
| 462 | 462 | ->getUrl(); |
| 463 | 463 | |
| 464 | - $this->assertSame($url, $imageUrl . '=w' . $width . '-h' . $height); |
|
| 464 | + $this->assertSame($url, $imageUrl.'=w'.$width.'-h'.$height); |
|
| 465 | 465 | |
| 466 | 466 | $imageInfo = @getimagesize($url); |
| 467 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $url); |
|
| 467 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$url); |
|
| 468 | 468 | |
| 469 | 469 | if ($imageInfo[0] === $width) { |
| 470 | 470 | $this->assertNotSame($imageInfo[1], $height); |
| 471 | 471 | } elseif ($imageInfo[1] === $height) { |
| 472 | 472 | $this->assertNotSame($imageInfo[0], $width); |
| 473 | 473 | } else { |
| 474 | - $this->fail('Error image ' . $url . '. Expected ' . $width . 'x' . $height . '. Actual: ' . $imageInfo[0] . 'x' . $imageInfo[1]); |
|
| 474 | + $this->fail('Error image '.$url.'. Expected '.$width.'x'.$height.'. Actual: '.$imageInfo[0].'x'.$imageInfo[1]); |
|
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | 477 | |
@@ -483,17 +483,17 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | $width = 240; |
| 485 | 485 | $height = 320; |
| 486 | - $googleImage = new GoogleImage($imageUrl . '=s180', false); |
|
| 486 | + $googleImage = new GoogleImage($imageUrl.'=s180', false); |
|
| 487 | 487 | $url = $googleImage |
| 488 | 488 | ->setWidth($width) |
| 489 | 489 | ->setHeight($height) |
| 490 | 490 | ->setSmartCrop(true) |
| 491 | 491 | ->getUrl(); |
| 492 | 492 | |
| 493 | - $this->assertSame($url, $imageUrl . '=w' . $width . '-h' . $height . '-p'); |
|
| 493 | + $this->assertSame($url, $imageUrl.'=w'.$width.'-h'.$height.'-p'); |
|
| 494 | 494 | |
| 495 | 495 | $imageInfo = @getimagesize($url); |
| 496 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $url); |
|
| 496 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$url); |
|
| 497 | 497 | |
| 498 | 498 | $this->assertSame($imageInfo[0], $width); |
| 499 | 499 | $this->assertSame($imageInfo[1], $height); |
@@ -507,17 +507,17 @@ discard block |
||
| 507 | 507 | |
| 508 | 508 | $width = 200; |
| 509 | 509 | $height = 300; |
| 510 | - $googleImage = new GoogleImage($imageUrl . '=w515-h290', false); |
|
| 510 | + $googleImage = new GoogleImage($imageUrl.'=w515-h290', false); |
|
| 511 | 511 | $url = $googleImage |
| 512 | 512 | ->setWidth($width) |
| 513 | 513 | ->setHeight($height) |
| 514 | 514 | ->setSquareCrop(true) |
| 515 | 515 | ->getUrl(); |
| 516 | 516 | |
| 517 | - $this->assertSame($url, $imageUrl . '=w' . $width . '-h' . $height . '-c'); |
|
| 517 | + $this->assertSame($url, $imageUrl.'=w'.$width.'-h'.$height.'-c'); |
|
| 518 | 518 | |
| 519 | 519 | $imageInfo = @getimagesize($url); |
| 520 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $url); |
|
| 520 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$url); |
|
| 521 | 521 | |
| 522 | 522 | $this->assertSame($imageInfo[0], $width); |
| 523 | 523 | $this->assertSame($imageInfo[1], $height); |
@@ -526,64 +526,64 @@ discard block |
||
| 526 | 526 | public function testUrlVariant(): void |
| 527 | 527 | { |
| 528 | 528 | $baseUrl = 'https://lh3.googleusercontent.com/-khz-7NpZXic/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3reKXLHM7Pk6A7iXGRNBP8HxB0Xs1Q/'; |
| 529 | - $imageUrl = $baseUrl . 'w48-h48-n-mo/photo.jpg'; |
|
| 529 | + $imageUrl = $baseUrl.'w48-h48-n-mo/photo.jpg'; |
|
| 530 | 530 | |
| 531 | 531 | $googleImage = new GoogleImage($imageUrl); |
| 532 | - $this->assertSame($googleImage->getUrl(), $baseUrl . 'w48-h48/'); |
|
| 532 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'w48-h48/'); |
|
| 533 | 533 | $googleImage->reset(); |
| 534 | 534 | |
| 535 | 535 | $this->assertSame($googleImage->getUrl(), $baseUrl); |
| 536 | 536 | $imageInfo = @getimagesize($googleImage->getUrl()); |
| 537 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $googleImage->getUrl()); |
|
| 537 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$googleImage->getUrl()); |
|
| 538 | 538 | $this->assertSame($imageInfo[0], 512); |
| 539 | 539 | $this->assertSame($imageInfo[1], 512); |
| 540 | 540 | |
| 541 | 541 | $googleImage->setSize(300); |
| 542 | - $this->assertSame($googleImage->getUrl(), $baseUrl . 's300/'); |
|
| 542 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'s300/'); |
|
| 543 | 543 | $imageInfo = @getimagesize($googleImage->getUrl()); |
| 544 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $googleImage->getUrl()); |
|
| 544 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$googleImage->getUrl()); |
|
| 545 | 545 | $this->assertSame($imageInfo[0], 300); |
| 546 | 546 | $this->assertSame($imageInfo[1], 300); |
| 547 | 547 | |
| 548 | 548 | $googleImage->setWidth(300); |
| 549 | - $this->assertSame($googleImage->getUrl(), $baseUrl . 'w300/'); |
|
| 549 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'w300/'); |
|
| 550 | 550 | $imageInfo = @getimagesize($googleImage->getUrl()); |
| 551 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $googleImage->getUrl()); |
|
| 551 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$googleImage->getUrl()); |
|
| 552 | 552 | $this->assertSame($imageInfo[0], 300); |
| 553 | 553 | $this->assertSame($imageInfo[1], 300); |
| 554 | 554 | |
| 555 | 555 | $googleImage->setHeight(300); |
| 556 | - $this->assertSame($googleImage->getUrl(), $baseUrl . 'w300-h300/'); |
|
| 556 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'w300-h300/'); |
|
| 557 | 557 | $imageInfo = @getimagesize($googleImage->getUrl()); |
| 558 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $googleImage->getUrl()); |
|
| 558 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$googleImage->getUrl()); |
|
| 559 | 559 | $this->assertSame($imageInfo[0], 300); |
| 560 | 560 | $this->assertSame($imageInfo[1], 300); |
| 561 | 561 | |
| 562 | 562 | $googleImage->setHeight(100); |
| 563 | - $this->assertSame($googleImage->getUrl(), $baseUrl . 'w300-h100/'); |
|
| 563 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'w300-h100/'); |
|
| 564 | 564 | $imageInfo = @getimagesize($googleImage->getUrl()); |
| 565 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $googleImage->getUrl()); |
|
| 565 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$googleImage->getUrl()); |
|
| 566 | 566 | $this->assertSame($imageInfo[0], 300); |
| 567 | 567 | $this->assertSame($imageInfo[1], 100); |
| 568 | 568 | |
| 569 | 569 | $googleImage->setSquareCrop(true); |
| 570 | - $this->assertSame($googleImage->getUrl(), $baseUrl . 'w300-h100-c/'); |
|
| 570 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'w300-h100-c/'); |
|
| 571 | 571 | $imageInfo = @getimagesize($googleImage->getUrl()); |
| 572 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $googleImage->getUrl()); |
|
| 572 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$googleImage->getUrl()); |
|
| 573 | 573 | $this->assertSame($imageInfo[0], 100); |
| 574 | 574 | $this->assertSame($imageInfo[1], 100); |
| 575 | 575 | |
| 576 | 576 | $googleImage->setSmartCrop(true); |
| 577 | - $this->assertSame($googleImage->getUrl(), $baseUrl . 'w300-h100-p/'); |
|
| 577 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'w300-h100-p/'); |
|
| 578 | 578 | $imageInfo = @getimagesize($googleImage->getUrl()); |
| 579 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $googleImage->getUrl()); |
|
| 579 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$googleImage->getUrl()); |
|
| 580 | 580 | $this->assertSame($imageInfo[0], 300); |
| 581 | 581 | $this->assertSame($imageInfo[1], 100); |
| 582 | 582 | |
| 583 | 583 | $googleImage->setWidth(null); |
| 584 | - $this->assertSame($googleImage->getUrl(), $baseUrl . 'h100/'); |
|
| 584 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'h100/'); |
|
| 585 | 585 | $imageInfo = @getimagesize($googleImage->getUrl()); |
| 586 | - $this->assertNotFalse($imageInfo, 'Error fetch image to ' . $googleImage->getUrl()); |
|
| 586 | + $this->assertNotFalse($imageInfo, 'Error fetch image to '.$googleImage->getUrl()); |
|
| 587 | 587 | $this->assertSame($imageInfo[0], 100); |
| 588 | 588 | $this->assertSame($imageInfo[1], 100); |
| 589 | 589 | |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | $googleImage->setBorder(10); |
| 592 | 592 | $googleImage->setVerticalFlip(true); |
| 593 | 593 | $googleImage->setHorizontalFlip(true); |
| 594 | - $this->assertSame($googleImage->getUrl(), $baseUrl . 'h100/'); |
|
| 594 | + $this->assertSame($googleImage->getUrl(), $baseUrl.'h100/'); |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | public function testHashUrl(): void |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $this->assertEquals( |
| 24 | 24 | $dateTime->format('Y.m.d'), |
| 25 | 25 | $actualDate, |
| 26 | - 'Error php ext intl formatted date. Locale ' . $locale . '. Released date ' . $releaseDate |
|
| 26 | + 'Error php ext intl formatted date. Locale '.$locale.'. Released date '.$releaseDate |
|
| 27 | 27 | ); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $this->assertEquals( |
| 33 | 33 | $dateTime->format('Y.m.d'), |
| 34 | 34 | $actualDate, |
| 35 | - 'Error php implementation formatted date. Locale ' . $locale . '. Released date ' . $releaseDate |
|
| 35 | + 'Error php implementation formatted date. Locale '.$locale.'. Released date '.$releaseDate |
|
| 36 | 36 | ); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $this->assertEquals( |
| 20 | 20 | LocaleHelper::findPreferredLanguage($sourceLocale, $translateLangName), |
| 21 | 21 | $destLocale, |
| 22 | - 'Error ' . $sourceLocale . ' -> ' . $destLocale |
|
| 22 | + 'Error '.$sourceLocale.' -> '.$destLocale |
|
| 23 | 23 | ); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $this->assertNotEquals( |
| 54 | 54 | LocaleHelper::findPreferredLanguage($sourceLocale, $translateLangName), |
| 55 | 55 | $destLocale, |
| 56 | - $sourceLocale . ' -> ' . $destLocale |
|
| 56 | + $sourceLocale.' -> '.$destLocale |
|
| 57 | 57 | ); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $client = new HttpClient([], 0); |
| 41 | 41 | $httpCode = 500; |
| 42 | - $url = 'https://httpbin.org/status/' . $httpCode; |
|
| 42 | + $url = 'https://httpbin.org/status/'.$httpCode; |
|
| 43 | 43 | try { |
| 44 | 44 | $client->request('GET', $url); |
| 45 | 45 | } catch (GuzzleException $e) { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $client = new HttpClient(); |
| 65 | 65 | $client->request('GET', 'https://httpbin.org/status/200', [ |
| 66 | - HttpClient::OPTION_HANDLER_RESPONSE => static function ($response) { |
|
| 66 | + HttpClient::OPTION_HANDLER_RESPONSE => static function($response) { |
|
| 67 | 67 | return $response; |
| 68 | 68 | }, |
| 69 | 69 | ]); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $client = new HttpClient([], $retryLimit); |
| 78 | 78 | try { |
| 79 | 79 | $client->request('GET', 'https://httpbin.org/status/500', [ |
| 80 | - RequestOptions::ON_STATS => static function (TransferStats $stats) use (&$count) { |
|
| 80 | + RequestOptions::ON_STATS => static function(TransferStats $stats) use (&$count) { |
|
| 81 | 81 | $response = $stats->getResponse(); |
| 82 | 82 | self::assertNotNull($response); |
| 83 | 83 | self::assertEquals($response->getStatusCode(), 500); |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | try { |
| 99 | 99 | $client->request('GET', 'https://httpbin.org/delay/3', [ |
| 100 | 100 | RequestOptions::TIMEOUT => 1, |
| 101 | - RequestOptions::ON_STATS => static function () use (&$count) { |
|
| 101 | + RequestOptions::ON_STATS => static function() use (&$count) { |
|
| 102 | 102 | $count++; |
| 103 | 103 | }, |
| 104 | 104 | ]); |
| 105 | - $this->fail('an exception was expected ' . ConnectException::class); |
|
| 105 | + $this->fail('an exception was expected '.ConnectException::class); |
|
| 106 | 106 | } catch (GuzzleException $e) { |
| 107 | 107 | $this->assertInstanceOf(ConnectException::class, $e); |
| 108 | 108 | } |
@@ -37,10 +37,10 @@ discard block |
||
| 37 | 37 | $urlComponents = parse_url($url); |
| 38 | 38 | $query = parse_query($urlComponents['query']); |
| 39 | 39 | $appId = $query[GPlayApps::REQ_PARAM_APP_ID]; |
| 40 | - $url = $urlComponents['scheme'] . '://' |
|
| 40 | + $url = $urlComponents['scheme'].'://' |
|
| 41 | 41 | . $urlComponents['host'] |
| 42 | 42 | . $urlComponents['path'] |
| 43 | - . '?' . http_build_query([GPlayApps::REQ_PARAM_APP_ID => $appId]); |
|
| 43 | + . '?'.http_build_query([GPlayApps::REQ_PARAM_APP_ID => $appId]); |
|
| 44 | 44 | $locale = $query[GPlayApps::REQ_PARAM_LOCALE] ?? GPlayApps::DEFAULT_LOCALE; |
| 45 | 45 | |
| 46 | 46 | $scriptData = ScraperUtil::extractScriptData($response->getBody()->getContents()); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $descriptionHTML = $scriptDataInfo[0][10][0][1]; |
| 83 | 83 | $description = ScraperUtil::html2text($descriptionHTML); |
| 84 | 84 | |
| 85 | - $developerPage = GPlayApps::GOOGLE_PLAY_URL . $scriptDataInfo[0][12][5][5][4][2]; |
|
| 85 | + $developerPage = GPlayApps::GOOGLE_PLAY_URL.$scriptDataInfo[0][12][5][5][4][2]; |
|
| 86 | 86 | $developerId = parse_query(parse_url($developerPage, PHP_URL_QUERY))['id']; |
| 87 | 87 | $developerName = $scriptDataInfo[0][12][5][1]; |
| 88 | 88 | $developerEmail = $scriptDataInfo[0][12][5][2][0]; |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | ScraperUtil::html2text($scriptDataInfo[0][10][1][1]); |
| 99 | 99 | |
| 100 | 100 | $installs = $scriptDataInfo[0][12][9][2] ?? 0; |
| 101 | - $score = (float)($scriptDataRating[0][6][0][1] ?? 0); |
|
| 102 | - $numberVoters = (int)($scriptDataRating[0][6][2][1] ?? 0); |
|
| 103 | - $reviewsCount = (int)($scriptDataRating[0][6][3][1] ?? 0); |
|
| 101 | + $score = (float) ($scriptDataRating[0][6][0][1] ?? 0); |
|
| 102 | + $numberVoters = (int) ($scriptDataRating[0][6][2][1] ?? 0); |
|
| 103 | + $reviewsCount = (int) ($scriptDataRating[0][6][3][1] ?? 0); |
|
| 104 | 104 | $histogram = $scriptDataRating[0][6][1] ?? null; |
| 105 | 105 | |
| 106 | 106 | $histogramRating = new HistogramRating( |
@@ -112,12 +112,11 @@ discard block |
||
| 112 | 112 | ); |
| 113 | 113 | |
| 114 | 114 | $price = isset($scriptDataPrice[0][2][0][0][0][1][0][0]) ? |
| 115 | - (float)($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : |
|
| 116 | - 0; |
|
| 115 | + (float) ($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : 0; |
|
| 117 | 116 | $currency = $scriptDataPrice[0][2][0][0][0][1][0][1]; |
| 118 | 117 | $priceText = $scriptDataPrice[0][2][0][0][0][1][0][2] ?: 'Free'; |
| 119 | 118 | $offersIAPCost = $scriptDataInfo[0][12][12][0] ?? null; |
| 120 | - $adSupported = (bool)$scriptDataInfo[0][12][14][0]; |
|
| 119 | + $adSupported = (bool) $scriptDataInfo[0][12][14][0]; |
|
| 121 | 120 | |
| 122 | 121 | [$size, $appVersion, $androidVersion] = $scriptDataVersion; |
| 123 | 122 | if (LocaleHelper::isDependOnDevice($locale, $size)) { |
@@ -143,8 +142,8 @@ discard block |
||
| 143 | 142 | $scriptDataInfo[0][12][13][1][0] !== null && |
| 144 | 143 | $scriptDataInfo[0][12][13][1][2] !== null |
| 145 | 144 | ) { |
| 146 | - $familyGenreId = (string)$scriptDataInfo[0][12][13][1][2]; |
|
| 147 | - $familyGenreName = (string)$scriptDataInfo[0][12][13][1][0]; |
|
| 145 | + $familyGenreId = (string) $scriptDataInfo[0][12][13][1][2]; |
|
| 146 | + $familyGenreName = (string) $scriptDataInfo[0][12][13][1][0]; |
|
| 148 | 147 | } |
| 149 | 148 | |
| 150 | 149 | $icon = empty($scriptDataInfo[0][12][1][3][2]) ? |
@@ -155,7 +154,7 @@ discard block |
||
| 155 | 154 | null : |
| 156 | 155 | new GoogleImage($scriptDataInfo[0][12][2][3][2]); |
| 157 | 156 | |
| 158 | - $screenshots = !empty($scriptDataInfo[0][12][0]) ? array_map(static function (array $v) { |
|
| 157 | + $screenshots = !empty($scriptDataInfo[0][12][0]) ? array_map(static function(array $v) { |
|
| 159 | 158 | return new GoogleImage($v[3][2]); |
| 160 | 159 | }, $scriptDataInfo[0][12][0]) : []; |
| 161 | 160 | |
@@ -166,8 +165,8 @@ discard block |
||
| 166 | 165 | $scriptDataInfo[0][12][3][0][3][2] !== null && |
| 167 | 166 | $scriptDataInfo[0][12][3][1][3][2] !== null |
| 168 | 167 | ) { |
| 169 | - $videoThumb = (string)$scriptDataInfo[0][12][3][1][3][2]; |
|
| 170 | - $videoUrl = (string)$scriptDataInfo[0][12][3][0][3][2]; |
|
| 168 | + $videoThumb = (string) $scriptDataInfo[0][12][3][1][3][2]; |
|
| 169 | + $videoUrl = (string) $scriptDataInfo[0][12][3][0][3][2]; |
|
| 171 | 170 | } |
| 172 | 171 | |
| 173 | 172 | $contentRating = $scriptDataInfo[0][12][4][0]; |
@@ -177,7 +176,7 @@ discard block |
||
| 177 | 176 | } |
| 178 | 177 | try { |
| 179 | 178 | $updated = !empty($scriptDataInfo[0][12][8][0]) ? |
| 180 | - new \DateTimeImmutable('@' . $scriptDataInfo[0][12][8][0]) |
|
| 179 | + new \DateTimeImmutable('@'.$scriptDataInfo[0][12][8][0]) |
|
| 181 | 180 | : null; |
| 182 | 181 | } catch (\Exception $e) { |
| 183 | 182 | $updated = null; |
@@ -224,13 +223,11 @@ discard block |
||
| 224 | 223 | )) |
| 225 | 224 | ->setCategoryFamily( |
| 226 | 225 | $familyGenreId !== null && $familyGenreName !== null ? |
| 227 | - new Category($familyGenreId, $familyGenreName) : |
|
| 228 | - null |
|
| 226 | + new Category($familyGenreId, $familyGenreName) : null |
|
| 229 | 227 | ) |
| 230 | 228 | ->setVideo( |
| 231 | 229 | $videoThumb !== null && $videoUrl !== null ? |
| 232 | - new Video($videoThumb, $videoUrl) : |
|
| 233 | - null |
|
| 230 | + new Video($videoThumb, $videoUrl) : null |
|
| 234 | 231 | ) |
| 235 | 232 | ->setRecentChanges($recentChanges) |
| 236 | 233 | ->setEditorsChoice($editorsChoice) |
@@ -277,26 +274,26 @@ discard block |
||
| 277 | 274 | for ($i = 0; $i < $count; $i++) { |
| 278 | 275 | $reviewData = $scriptDataReviews[0][$i]; |
| 279 | 276 | $reviewId = $reviewData[0]; |
| 280 | - $reviewUrl = $appUrl . '&reviewId=' . urlencode($reviewId); |
|
| 277 | + $reviewUrl = $appUrl.'&reviewId='.urlencode($reviewId); |
|
| 281 | 278 | $userName = $reviewData[1][0]; |
| 282 | 279 | $avatar = new GoogleImage($reviewData[1][1][3][2]); |
| 283 | 280 | $date = null; |
| 284 | 281 | if (isset($reviewData[5][0])) { |
| 285 | 282 | try { |
| 286 | - $date = new \DateTimeImmutable('@' . $reviewData[5][0]); |
|
| 283 | + $date = new \DateTimeImmutable('@'.$reviewData[5][0]); |
|
| 287 | 284 | } catch (\Exception $e) { |
| 288 | 285 | $date = null; |
| 289 | 286 | } |
| 290 | 287 | } |
| 291 | 288 | $score = $reviewData[2] ?? 0; |
| 292 | - $text = (string)($reviewData[4] ?? ''); |
|
| 289 | + $text = (string) ($reviewData[4] ?? ''); |
|
| 293 | 290 | $likeCount = $reviewData[6]; |
| 294 | 291 | |
| 295 | 292 | $reply = null; |
| 296 | 293 | if (isset($reviewData[7][1])) { |
| 297 | 294 | $replyText = $reviewData[7][1]; |
| 298 | 295 | try { |
| 299 | - $replyDate = new \DateTimeImmutable('@' . $reviewData[7][2][0]); |
|
| 296 | + $replyDate = new \DateTimeImmutable('@'.$reviewData[7][2][0]); |
|
| 300 | 297 | $reply = new ReplyReview( |
| 301 | 298 | $replyDate, |
| 302 | 299 | $replyText |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $doc = new \DOMDocument(); |
| 31 | 31 | $internalErrors = libxml_use_internal_errors(true); |
| 32 | - if (!$doc->loadHTML('<?xml encoding="utf-8" ?>' . $html)) { |
|
| 32 | + if (!$doc->loadHTML('<?xml encoding="utf-8" ?>'.$html)) { |
|
| 33 | 33 | throw new \RuntimeException('error load html'); |
| 34 | 34 | } |
| 35 | 35 | libxml_use_internal_errors($internalErrors); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | if ($reviewUrlNode === null) { |
| 59 | 59 | continue; |
| 60 | 60 | } |
| 61 | - $reviewUrl = GPlayApps::GOOGLE_PLAY_URL . $reviewUrlNode->item(0)->textContent; |
|
| 61 | + $reviewUrl = GPlayApps::GOOGLE_PLAY_URL.$reviewUrlNode->item(0)->textContent; |
|
| 62 | 62 | } |
| 63 | 63 | // user name |
| 64 | 64 | { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | if ($ratingStyleAttr !== null) { |
| 99 | 99 | $ratingStyle = $ratingStyleAttr->textContent; |
| 100 | 100 | if (preg_match('/([\d]+)%/', $ratingStyle, $match)) { |
| 101 | - $score = (int)($match[1] * 0.05); // percent * 5 star |
|
| 101 | + $score = (int) ($match[1] * 0.05); // percent * 5 star |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -71,13 +71,13 @@ |
||
| 71 | 71 | 'soc-platform' => 1, |
| 72 | 72 | 'soc-device' => 1, |
| 73 | 73 | ]; |
| 74 | - $playStoreUiUrl = GPlayApps::GOOGLE_PLAY_URL . '/_/PlayStoreUi/data/batchexecute?' . http_build_query($params); |
|
| 74 | + $playStoreUiUrl = GPlayApps::GOOGLE_PLAY_URL.'/_/PlayStoreUi/data/batchexecute?'.http_build_query($params); |
|
| 75 | 75 | |
| 76 | 76 | $savedApps = [$apps]; |
| 77 | 77 | while ($countApps < $this->limit && $scraper->hasNextToken()) { |
| 78 | 78 | $limit = min(100, $this->limit - $countApps); |
| 79 | 79 | $body = [ |
| 80 | - 'f.req' => '[[["' . self::RPC_ID . '","[[null,[[10,[10,' . $limit . ']],true,null,[1]],null,\\"' . $scraper->getToken() . '\\"]]",null,"generic"]]]', |
|
| 80 | + 'f.req' => '[[["'.self::RPC_ID.'","[[null,[[10,[10,'.$limit.']],true,null,[1]],null,\\"'.$scraper->getToken().'\\"]]",null,"generic"]]]', |
|
| 81 | 81 | ]; |
| 82 | 82 | |
| 83 | 83 | /** |