@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace ApiClients\Tools\ResourceTestUtilities\Type; |
| 4 | 4 | |
@@ -34,6 +34,9 @@ discard block |
||
| 34 | 34 | $this->rmdir($this->tmpDir); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | + /** |
|
| 38 | + * @param string $dir |
|
| 39 | + */ |
|
| 37 | 40 | protected function rmdir($dir) |
| 38 | 41 | { |
| 39 | 42 | $directory = dir($dir); |
@@ -66,6 +69,10 @@ discard block |
||
| 66 | 69 | return $this->tmpNamespace; |
| 67 | 70 | } |
| 68 | 71 | |
| 72 | + /** |
|
| 73 | + * @param string $class |
|
| 74 | + * @param string $namespace |
|
| 75 | + */ |
|
| 69 | 76 | public function hydrate($class, $json, $namespace) |
| 70 | 77 | { |
| 71 | 78 | return (new Hydrator(Phake::mock(Client::class), [ |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace ApiClients\Tools\ResourceTestUtilities; |
| 5 | 5 | |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | parent::setUp(); |
| 26 | 26 | $crc32 = crc32(get_class($this)); |
| 27 | - $this->tmpDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('act-' . $crc32, true) . DIRECTORY_SEPARATOR; |
|
| 27 | + $this->tmpDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid('act-'.$crc32, true).DIRECTORY_SEPARATOR; |
|
| 28 | 28 | mkdir($this->tmpDir, 0777, true); |
| 29 | 29 | $this->tmpNamespace = sprintf( |
| 30 | 30 | static::DEFAULT_GENERATED_CLASS_NAMESPACE, |
| 31 | - crc32(uniqid((string)$crc32, true)) |
|
| 31 | + crc32(uniqid((string) $crc32, true)) |
|
| 32 | 32 | ); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -46,13 +46,13 @@ discard block |
||
| 46 | 46 | continue; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if (is_dir($dir . $entry)) { |
|
| 50 | - $this->rmdir($dir . $entry . DIRECTORY_SEPARATOR); |
|
| 49 | + if (is_dir($dir.$entry)) { |
|
| 50 | + $this->rmdir($dir.$entry.DIRECTORY_SEPARATOR); |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if (is_file($dir . $entry)) { |
|
| 55 | - unlink($dir . $entry); |
|
| 54 | + if (is_file($dir.$entry)) { |
|
| 55 | + unlink($dir.$entry); |
|
| 56 | 56 | continue; |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace ApiClients\Tools\ResourceTestUtilities; |
| 4 | 4 | |
@@ -27,17 +27,17 @@ discard block |
||
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - $path = __DIR__ . DIRECTORY_SEPARATOR . 'Type' . DIRECTORY_SEPARATOR; |
|
| 30 | + $path = __DIR__.DIRECTORY_SEPARATOR.'Type'.DIRECTORY_SEPARATOR; |
|
| 31 | 31 | $directory = new RecursiveDirectoryIterator($path); |
| 32 | 32 | $directory = new RecursiveIteratorIterator($directory); |
| 33 | 33 | foreach ($directory as $node) { |
| 34 | - $nodePath = $node->getPath() . DIRECTORY_SEPARATOR . $node->getFilename(); |
|
| 34 | + $nodePath = $node->getPath().DIRECTORY_SEPARATOR.$node->getFilename(); |
|
| 35 | 35 | if (!is_file($nodePath)) { |
| 36 | 36 | continue; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $fileName = str_replace('/', '\\', $nodePath); |
| 40 | - $class = __NAMESPACE__ . '\\Type\\' . substr(substr($fileName, strlen($path)), 0, -4); |
|
| 40 | + $class = __NAMESPACE__.'\\Type\\'.substr(substr($fileName, strlen($path)), 0, -4); |
|
| 41 | 41 | if (class_exists($class) && (new ReflectionClass($class))->implementsInterface(Type::class)) { |
| 42 | 42 | $type = new $class; |
| 43 | 43 | self::$types[$type->scalar()] = $type; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | return self::$types[$type]; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - throw new Exception('Type "' . $type . '" not found, use has to check"'); |
|
| 75 | + throw new Exception('Type "'.$type.'" not found, use has to check"'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace ApiClients\Tools\ResourceTestUtilities\Type; |
| 4 | 4 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | final public function __construct() |
| 11 | 11 | { |
| 12 | 12 | if (!defined('static::SCALAR')) { |
| 13 | - throw new \InvalidArgumentException('Missing SCALAR constant on ' . get_class($this)); |
|
| 13 | + throw new \InvalidArgumentException('Missing SCALAR constant on '.get_class($this)); |
|
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace ApiClients\Tools\ResourceTestUtilities\Type; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace ApiClients\Tools\ResourceTestUtilities\Type; |
| 4 | 4 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | public function generate(int $count = 10000): Generator |
| 17 | 17 | { |
| 18 | 18 | for ($i = 0; $i < $count; $i++) { |
| 19 | - yield (string)mt_rand($i, $count * mt_rand($i, $count)); |
|
| 19 | + yield (string) mt_rand($i, $count * mt_rand($i, $count)); |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace ApiClients\Tools\ResourceTestUtilities\Type; |
| 4 | 4 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | public function generate(int $count = 100): Generator |
| 19 | 19 | { |
| 20 | 20 | for ($i = 0; $i < $count; $i++) { |
| 21 | - yield (bool)mt_rand(0, 1); |
|
| 21 | + yield (bool) mt_rand(0, 1); |
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace ApiClients\Tools\ResourceTestUtilities\Type; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace ApiClients\Tools\ResourceTestUtilities\Type; |
| 4 | 4 | |