@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @var array |
24 | 24 | */ |
25 | - protected $relations = ['*']; |
|
25 | + protected $relations = [ '*' ]; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Get relations set on the transformer. |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function getRelations():array |
33 | 33 | { |
34 | - $relations = array_unique(array_merge($this->getAvailableIncludes(), $this->relations)); |
|
34 | + $relations = array_unique( array_merge( $this->getAvailableIncludes(), $this->relations ) ); |
|
35 | 35 | |
36 | - return array_filter($relations, function($relation) { |
|
36 | + return array_filter( $relations, function ( $relation ) { |
|
37 | 37 | return $relation !== '*'; |
38 | 38 | }); |
39 | 39 | } |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * @param array|string $relations |
45 | 45 | * @return self |
46 | 46 | */ |
47 | - public function setRelations($relations) |
|
47 | + public function setRelations( $relations ) |
|
48 | 48 | { |
49 | - $this->setAvailableIncludes(array_unique(array_merge($this->availableIncludes, (array) $relations))); |
|
49 | + $this->setAvailableIncludes( array_unique( array_merge( $this->availableIncludes, (array) $relations ) ) ); |
|
50 | 50 | |
51 | 51 | return $this; |
52 | 52 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function allRelationsAllowed():bool |
60 | 60 | { |
61 | - return $this->relations == ['*']; |
|
61 | + return $this->relations == [ '*' ]; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -71,24 +71,24 @@ discard block |
||
71 | 71 | * @return \League\Fractal\Resource\ResourceInterface|bool |
72 | 72 | * @throws \Exception |
73 | 73 | */ |
74 | - protected function callIncludeMethod(Scope $scope, $includeName, $data) |
|
74 | + protected function callIncludeMethod( Scope $scope, $includeName, $data ) |
|
75 | 75 | { |
76 | - if ($includeName === 'pivot') { |
|
77 | - return $this->includePivot($data->$includeName); |
|
76 | + if ( $includeName === 'pivot' ) { |
|
77 | + return $this->includePivot( $data->$includeName ); |
|
78 | 78 | } |
79 | 79 | |
80 | - $params = $scope->getManager()->getIncludeParams($scope->getIdentifier($includeName)); |
|
80 | + $params = $scope->getManager()->getIncludeParams( $scope->getIdentifier( $includeName ) ); |
|
81 | 81 | |
82 | - if (method_exists($this, $includeName)) { |
|
83 | - $include = call_user_func([$this, $includeName], $data, $params); |
|
82 | + if ( method_exists( $this, $includeName ) ) { |
|
83 | + $include = call_user_func( [ $this, $includeName ], $data, $params ); |
|
84 | 84 | |
85 | - if ($include instanceof ResourceAbstract) { |
|
85 | + if ( $include instanceof ResourceAbstract ) { |
|
86 | 86 | return $include; |
87 | 87 | } |
88 | 88 | |
89 | - return app(Responder::class)->transform($include)->getResource(); |
|
89 | + return app( Responder::class )->transform( $include )->getResource(); |
|
90 | 90 | } else { |
91 | - return app(Responder::class)->transform($data->$includeName)->getResource(); |
|
91 | + return app( Responder::class )->transform( $data->$includeName )->getResource(); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | * @param Pivot $pivot |
99 | 99 | * @return \League\Fractal\Resource\ResourceInterface|bool |
100 | 100 | */ |
101 | - protected function includePivot(Pivot $pivot) |
|
101 | + protected function includePivot( Pivot $pivot ) |
|
102 | 102 | { |
103 | - if (! method_exists($this, 'transformPivot')) { |
|
103 | + if ( ! method_exists( $this, 'transformPivot' ) ) { |
|
104 | 104 | return false; |
105 | 105 | } |
106 | 106 | |
107 | - return app(Responder::class)->transform($pivot, function ($pivot) { |
|
108 | - return $this->transformPivot($pivot); |
|
107 | + return app( Responder::class )->transform( $pivot, function ( $pivot ) { |
|
108 | + return $this->transformPivot( $pivot ); |
|
109 | 109 | })->getResource(); |
110 | 110 | } |
111 | 111 | } |
112 | 112 | \ No newline at end of file |