@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function __construct($user) |
| 64 | 64 | { |
| 65 | 65 | $this->user = $user; |
| 66 | - parent::__construct([]); |
|
| 66 | + parent::__construct([ ]); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | public function toArray($request) |
| 77 | 77 | { |
| 78 | - return []; |
|
| 78 | + return [ ]; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public function transformUser(MachineTestModel $machine) |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | class UserIncludedMachineTestTransformer extends MachineTestTransformer |
| 88 | 88 | { |
| 89 | - public $include = ['user']; |
|
| 89 | + public $include = [ 'user' ]; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | class UserTestTransformer extends Transformer |
| 93 | 93 | { |
| 94 | 94 | public function toArray($request) |
| 95 | 95 | { |
| 96 | - return []; |
|
| 96 | + return [ ]; |
|
| 97 | 97 | } |
| 98 | 98 | } |
@@ -30,28 +30,28 @@ |
||
| 30 | 30 | { |
| 31 | 31 | use IncludesRelations, HandlesLimit; |
| 32 | 32 | |
| 33 | - public $include = []; |
|
| 33 | + public $include = [ ]; |
|
| 34 | 34 | |
| 35 | - public $available = []; |
|
| 35 | + public $available = [ ]; |
|
| 36 | 36 | |
| 37 | 37 | public $limit = -1; |
| 38 | 38 | |
| 39 | - public function __construct($resource, $relations = []) |
|
| 39 | + public function __construct($resource, $relations = [ ]) |
|
| 40 | 40 | { |
| 41 | 41 | if (!($resource instanceof Model)) { |
| 42 | 42 | throw new Exception('Object passed to the transformer resource method is not a eloquent model', 500); |
| 43 | 43 | } |
| 44 | 44 | $this->resource = $resource; |
| 45 | - $relations = is_array($relations) ? $relations : []; |
|
| 45 | + $relations = is_array($relations) ? $relations : [ ]; |
|
| 46 | 46 | parent::__construct(self::loadRelations($resource, $relations)); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public static function resource($model, array $relations = []): self |
|
| 49 | + public static function resource($model, array $relations = [ ]): self |
|
| 50 | 50 | { |
| 51 | 51 | return new static($model, $relations); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public static function collection($resource, array $relations = []) |
|
| 54 | + public static function collection($resource, array $relations = [ ]) |
|
| 55 | 55 | { |
| 56 | 56 | if (!($resource instanceof Collection)) { |
| 57 | 57 | throw new Exception('Object passed to the transformer collection method is not a collection', 500); |
@@ -58,32 +58,32 @@ |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | if ($unwrap) { |
| 61 | - return json_decode($content, true)['data'] ?? json_decode($content, true); |
|
| 61 | + return json_decode($content, true)[ 'data' ] ?? json_decode($content, true); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | return json_decode($content, true); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - protected function http(string $method, string $route, array $payload = []) |
|
| 67 | + protected function http(string $method, string $route, array $payload = [ ]) |
|
| 68 | 68 | { |
| 69 | 69 | return $this->sendRequest($method, $route, $payload, true); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - private function sendRequest(string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 72 | + private function sendRequest(string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 73 | 73 | { |
| 74 | 74 | return $this->json($method, env('API_URL').$route, $payload, $authenticated ? [ |
| 75 | 75 | 'Authorization' => 'Bearer '.$this->getAuth0Service()->getTestUserToken()->id_token, |
| 76 | - ] : []); |
|
| 76 | + ] : [ ]); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - protected function sendRequestWithToken($token, string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 79 | + protected function sendRequestWithToken($token, string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 80 | 80 | { |
| 81 | 81 | return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
| 82 | 82 | 'Authorization' => 'Bearer '.$token, |
| 83 | - ] : []); |
|
| 83 | + ] : [ ]); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - protected function httpNoAuth(string $method, string $route, array $payload = []) |
|
| 86 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ]) |
|
| 87 | 87 | { |
| 88 | 88 | return $this->sendRequest($method, $route, $payload, false); |
| 89 | 89 | } |
@@ -30,10 +30,10 @@ |
||
| 30 | 30 | protected $middlewareGroups = [ |
| 31 | 31 | 'web' => [ |
| 32 | 32 | //\Foundation\Middleware\EncryptCookies::class, |
| 33 | - //\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, |
|
| 34 | - //\Illuminate\Session\Middleware\StartSession::class, |
|
| 35 | - //\Illuminate\View\Middleware\ShareErrorsFromSession::class, |
|
| 36 | - //\Foundation\Middleware\VerifyCsrfToken::class, |
|
| 33 | + //\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, |
|
| 34 | + //\Illuminate\Session\Middleware\StartSession::class, |
|
| 35 | + //\Illuminate\View\Middleware\ShareErrorsFromSession::class, |
|
| 36 | + //\Foundation\Middleware\VerifyCsrfToken::class, |
|
| 37 | 37 | //\Illuminate\Routing\Middleware\SubstituteBindings::class, |
| 38 | 38 | ], |
| 39 | 39 | |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | $this->assertEquals($user->toArray(), $user::cache()->findBy('identity_id', $user->identity_id, false)->toArray()); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function testCacheSpeed(){ |
|
| 21 | - $model = Account::create(["testthisshit"=>5]); |
|
| 22 | - \Cache::put('testmodel',$model); |
|
| 20 | + public function testCacheSpeed() { |
|
| 21 | + $model = Account::create([ "testthisshit"=>5 ]); |
|
| 22 | + \Cache::put('testmodel', $model); |
|
| 23 | 23 | |
| 24 | 24 | $time_db_start = microtime(true); |
| 25 | - for($i=0; $i<1000;$i++){ |
|
| 25 | + for ($i = 0; $i < 1000; $i++) { |
|
| 26 | 26 | Account::find($model->id); |
| 27 | 27 | } |
| 28 | 28 | $time_db_end = microtime(true); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $time_cache_start = microtime(true); |
| 33 | 33 | |
| 34 | - for($i=0; $i<1000;$i++){ |
|
| 34 | + for ($i = 0; $i < 1000; $i++) { |
|
| 35 | 35 | \Cache::get('testmodel'); |
| 36 | 36 | } |
| 37 | 37 | $time_cache_end = microtime(true); |