Test Setup Failed
Push — v2 ( 74186a...c94b75 )
by Alexander
06:56
created
src/helpers.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use Flugg\Responder\Contracts\Responder;
4 4
 use Flugg\Responder\Contracts\Transformer;
5 5
 
6
-if (! function_exists('responder')) {
6
+if ( ! function_exists( 'responder' ) ) {
7 7
 
8 8
     /**
9 9
      * A helper method to resolve the responder service out of the service container.
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
      */
13 13
     function responder(): Responder
14 14
     {
15
-        return app(Responder::class);
15
+        return app( Responder::class );
16 16
     }
17 17
 }
18 18
 
19
-if (! function_exists('transform')) {
19
+if ( ! function_exists( 'transform' ) ) {
20 20
 
21 21
     /**
22 22
      * A helper method to transform data without serializing.
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
      * @param  string[]                                                       $without
28 28
      * @return array
29 29
      */
30
-    function transform($data = null, $transformer = null, array $with = [], array $without = []): array
30
+    function transform( $data = null, $transformer = null, array $with = [ ], array $without = [ ] ): array
31 31
     {
32
-        return app(Transformer::class)->transform($data, $transformer, $with, $without);
32
+        return app( Transformer::class )->transform( $data, $transformer, $with, $without );
33 33
     }
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
src/Responder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @param \Flugg\Responder\Http\Responses\ErrorResponseBuilder   $errorResponseBuilder
36 36
      * @param \Flugg\Responder\Http\Responses\SuccessResponseBuilder $successResponseBuilder
37 37
      */
38
-    public function __construct(ErrorResponseBuilder $errorResponseBuilder, SuccessResponseBuilder $successResponseBuilder)
38
+    public function __construct( ErrorResponseBuilder $errorResponseBuilder, SuccessResponseBuilder $successResponseBuilder )
39 39
     {
40 40
         $this->errorResponseBuilder = $errorResponseBuilder;
41 41
         $this->successResponseBuilder = $successResponseBuilder;
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
      * @param  string|null $message
49 49
      * @return \Flugg\Responder\Http\Responses\ErrorResponseBuilder
50 50
      */
51
-    public function error(string $errorCode = null, string $message = null): ErrorResponseBuilder
51
+    public function error( string $errorCode = null, string $message = null ): ErrorResponseBuilder
52 52
     {
53
-        return $this->errorResponseBuilder->error($errorCode, $message);
53
+        return $this->errorResponseBuilder->error( $errorCode, $message );
54 54
     }
55 55
 
56 56
     /**
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
      * @param  string|null                                                    $resourceKey
62 62
      * @return \Flugg\Responder\Http\Responses\SuccessResponseBuilder
63 63
      */
64
-    public function success($data = null, $transformer = null, string $resourceKey = null): SuccessResponseBuilder
64
+    public function success( $data = null, $transformer = null, string $resourceKey = null ): SuccessResponseBuilder
65 65
     {
66
-        return $this->successResponseBuilder->transform($data, $transformer, $resourceKey);
66
+        return $this->successResponseBuilder->transform( $data, $transformer, $resourceKey );
67 67
     }
68 68
 }
69 69
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exceptions/InvalidSerializerException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,6 +19,6 @@
 block discarded – undo
19 19
      */
20 20
     public function __construct()
21 21
     {
22
-        parent::__construct('Given serializer must be an instance of [' . SerializerAbstract::class . '].');
22
+        parent::__construct( 'Given serializer must be an instance of [' . SerializerAbstract::class . '].' );
23 23
     }
24 24
 }
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exceptions/Handler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
      * @param  \Exception               $exception
25 25
      * @return \Symfony\Component\HttpFoundation\Response
26 26
      */
27
-    public function render($request, Exception $exception)
27
+    public function render( $request, Exception $exception )
28 28
     {
29
-        $this->transformException($exception);
29
+        $this->transformException( $exception );
30 30
 
31
-        if ($exception instanceof ApiException) {
32
-            return $this->renderApiError($exception);
31
+        if ( $exception instanceof ApiException ) {
32
+            return $this->renderApiError( $exception );
33 33
         }
34 34
 
35
-        return parent::render($request, $exception);
35
+        return parent::render( $request, $exception );
36 36
     }
37 37
 }
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exceptions/HandlesApiErrors.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
      * @param  \Exception $exception
33 33
      * @return void
34 34
      */
35
-    protected function transformException(Exception $exception)
35
+    protected function transformException( Exception $exception )
36 36
     {
37
-        $this->transformAuthException($exception);
38
-        $this->transformEloquentException($exception);
39
-        $this->transformValidationException($exception);
37
+        $this->transformAuthException( $exception );
38
+        $this->transformEloquentException( $exception );
39
+        $this->transformValidationException( $exception );
40 40
     }
41 41
 
42 42
     /**
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
      * @throws UnauthenticatedException
48 48
      * @throws UnauthorizedException
49 49
      */
50
-    protected function transformAuthException(Exception $exception)
50
+    protected function transformAuthException( Exception $exception )
51 51
     {
52
-        if ($exception instanceof AuthenticationException) {
52
+        if ( $exception instanceof AuthenticationException ) {
53 53
             throw new UnauthenticatedException;
54 54
         }
55 55
 
56
-        if ($exception instanceof AuthorizationException) {
56
+        if ( $exception instanceof AuthorizationException ) {
57 57
             throw new UnauthorizedException;
58 58
         }
59 59
     }
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
      * @throws ResourceNotFoundException
67 67
      * @throws RelationNotFoundException
68 68
      */
69
-    protected function transformEloquentException(Exception $exception)
69
+    protected function transformEloquentException( Exception $exception )
70 70
     {
71
-        if ($exception instanceof ModelNotFoundException) {
71
+        if ( $exception instanceof ModelNotFoundException ) {
72 72
             throw new ResourceNotFoundException;
73 73
         }
74 74
 
75
-        if ($exception instanceof BaseRelationNotFoundException) {
75
+        if ( $exception instanceof BaseRelationNotFoundException ) {
76 76
             throw new RelationNotFoundException;
77 77
         }
78 78
     }
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
      * @return void
85 85
      * @throws ValidationFailedException
86 86
      */
87
-    protected function transformValidationException(Exception $exception)
87
+    protected function transformValidationException( Exception $exception )
88 88
     {
89
-        if ($exception instanceof ValidationException) {
90
-            throw new ValidationFailedException($exception->validator);
89
+        if ( $exception instanceof ValidationException ) {
90
+            throw new ValidationFailedException( $exception->validator );
91 91
         }
92 92
     }
93 93
 
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
      * @param  \Flugg\Responder\Exceptions\Http\ApiException $exception
98 98
      * @return \Illuminate\Http\JsonResponse
99 99
      */
100
-    protected function renderApiError(ApiException $exception): JsonResponse
100
+    protected function renderApiError( ApiException $exception ): JsonResponse
101 101
     {
102
-        return $this->container->make(ErrorResponseBuilder::class)
103
-            ->error($exception->errorCode(), $exception->message())
104
-            ->data($exception->data())
105
-            ->respond($exception->statusCode());
102
+        return $this->container->make( ErrorResponseBuilder::class )
103
+            ->error( $exception->errorCode(), $exception->message() )
104
+            ->data( $exception->data() )
105
+            ->respond( $exception->statusCode() );
106 106
     }
107 107
 }
108 108
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exceptions/Http/ApiException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,9 +47,9 @@
 block discarded – undo
47 47
      *
48 48
      * @param string $message
49 49
      */
50
-    public function __construct(string $message = null)
50
+    public function __construct( string $message = null )
51 51
     {
52
-        parent::__construct($this->status, $this->message ?? $message);
52
+        parent::__construct( $this->status, $this->message ?? $message );
53 53
     }
54 54
 
55 55
     /**
Please login to merge, or discard this patch.
src/Exceptions/Http/ValidationFailedException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      *
41 41
      * @param \Illuminate\Contracts\Validation\Validator $validator
42 42
      */
43
-    public function __construct(Validator $validator)
43
+    public function __construct( Validator $validator )
44 44
     {
45 45
         $this->validator = $validator;
46 46
 
@@ -54,6 +54,6 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function data()
56 56
     {
57
-        return [$this->validator->getMessageBag()->toArray()];
57
+        return [ $this->validator->getMessageBag()->toArray() ];
58 58
     }
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exceptions/InvalidTransformerException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,6 +19,6 @@
 block discarded – undo
19 19
      */
20 20
     public function __construct()
21 21
     {
22
-        parent::__construct('Given transformer must be a callable or an instance of [' . Transformer::class . '].');
22
+        parent::__construct( 'Given transformer must be a callable or an instance of [' . Transformer::class . '].' );
23 23
     }
24 24
 }
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
src/Pagination/PaginatorFactory.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      *
30 30
      * @param array $parameters
31 31
      */
32
-    public function __construct(array $parameters)
32
+    public function __construct( array $parameters )
33 33
     {
34 34
         $this->parameters = $parameters;
35 35
     }
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
      * @param  \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator
41 41
      * @return \League\Fractal\Pagination\PaginatorInterface
42 42
      */
43
-    public function make(LengthAwarePaginator $paginator): PaginatorInterface
43
+    public function make( LengthAwarePaginator $paginator ): PaginatorInterface
44 44
     {
45
-        $paginator->appends($this->parameters);
45
+        $paginator->appends( $this->parameters );
46 46
 
47
-        return new IlluminatePaginatorAdapter($paginator);
47
+        return new IlluminatePaginatorAdapter( $paginator );
48 48
     }
49 49
 
50 50
     /**
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
      * @param  \Flugg\Responder\Pagination\CursorPaginator $paginator
54 54
      * @return \League\Fractal\Pagination\Cursor
55 55
      */
56
-    public function makeCursor(CursorPaginator $paginator): Cursor
56
+    public function makeCursor( CursorPaginator $paginator ): Cursor
57 57
     {
58
-        $paginator->appends($this->parameters);
58
+        $paginator->appends( $this->parameters );
59 59
 
60
-        return new Cursor($paginator->cursor(), $paginator->previous(), $paginator->next(), $paginator->get()->count());
60
+        return new Cursor( $paginator->cursor(), $paginator->previous(), $paginator->next(), $paginator->get()->count() );
61 61
     }
62 62
 }
Please login to merge, or discard this patch.