Skip to content

Commit 4fa55ab

Browse files
binarykgithub-actions[bot]
authored andcommitted
Fix styling
1 parent 9f78e8f commit 4fa55ab

File tree

12 files changed

+46
-124
lines changed

12 files changed

+46
-124
lines changed

src/Eager/Related.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
class Related implements JsonSerializable
2020
{
21-
use Make;
2221
use HasColumns;
22+
use Make;
2323

2424
private string $relation;
2525

src/Eager/RelatedCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function unserialized(RestifyRequest $request, Repository $repository)
178178
public function markQuerySerialized(RestifyRequest $request, Repository $repository): self
179179
{
180180
return $this->each(function (Related $related) {
181-
// dd($related->getValue());
181+
// dd($related->getValue());
182182
$related->relatedQuery?->serialized();
183183

184184
return $related;

src/Fields/EagerField.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@ class EagerField extends Field
1818

1919
/**
2020
* Name of the relationship.
21-
*
22-
* @var string
2321
*/
2422
public string $relation;
2523

2624
/**
2725
* The class name of the related repository.
28-
*
29-
* @var string
3026
*/
3127
public string $repositoryClass;
3228

@@ -55,7 +51,6 @@ public function __construct($attribute, string $parentRepository = null)
5551
/**
5652
* Determine if the field should be displayed for the given request.
5753
*
58-
* @param Request $request
5954
* @return bool
6055
*/
6156
public function authorize(Request $request)

src/LaravelRestifyServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function packageRegistered(): void
5656

5757
// Register the main class to use with the facade
5858
$this->app->singleton('laravel-restify', function () {
59-
return new Restify();
59+
return new Restify;
6060
});
6161
}
6262

src/Repositories/Repository.php

Lines changed: 14 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -39,93 +39,73 @@
3939
/**
4040
* @property string $type
4141
*/
42-
class Repository implements RestifySearchable, JsonSerializable
42+
class Repository implements JsonSerializable, RestifySearchable
4343
{
44-
use InteractWithSearch;
45-
use ValidatingTrait;
46-
use PerformsQueries;
4744
use ConditionallyLoadsAttributes;
4845
use DelegatesToResource;
49-
use ResolvesActions;
50-
use ResolvesGetters;
51-
use RepositoryEvents;
52-
use WithRoutePrefix;
53-
use InteractWithFields;
54-
use InteractsWithModel;
55-
use InteractsWithAttachers;
5646
use HasColumns;
47+
use InteractsWithAttachers;
48+
use InteractsWithModel;
49+
use InteractWithFields;
50+
use InteractWithSearch;
5751
use Mockable;
52+
use PerformsQueries;
53+
use RepositoryEvents;
54+
use ResolvesActions;
55+
use ResolvesGetters;
5856
use Testing;
57+
use ValidatingTrait;
58+
use WithRoutePrefix;
5959

6060
/**
6161
* This is named `resource` because of the forwarding properties from DelegatesToResource trait.
62-
*
63-
* @var Model
6462
*/
6563
public Model $resource;
6664

6765
/**
6866
* The list of relations available for the show or index.
6967
*
7068
* e.g. ?related=users
71-
*
72-
* @var array
7369
*/
7470
public static array $related;
7571

7672
/**
7773
* The relationships that should be eager loaded when performing an index query.
78-
*
79-
* @var array
8074
*/
8175
public static array $with = [];
8276

8377
/**
8478
* The list of searchable fields.
85-
*
86-
* @var array
8779
*/
8880
public static array $search;
8981

9082
/**
9183
* The list of matchable fields.
92-
*
93-
* @var array
9484
*/
9585
public static array $match;
9686

9787
/**
9888
* The list of fields to be sortable.
99-
*
100-
* @var array
10189
*/
10290
public static array $sort;
10391

10492
/**
10593
* Attribute that should be used for displaying single model.
106-
*
107-
* @var string
10894
*/
10995
public static string $title = 'id';
11096

11197
/**
11298
* Attribute that should be used for displaying the `id` in the json:format.
113-
*
114-
* @var string
11599
*/
116100
public static string $id = 'id';
117101

118102
/**
119103
* Indicates if the repository should be globally searchable.
120-
*
121-
* @var bool
122104
*/
123105
public static bool $globallySearchable = true;
124106

125107
/**
126108
* The number of results to display in the global search.
127-
*
128-
* @var int
129109
*/
130110
public static int $globalSearchResults = 5;
131111

@@ -136,52 +116,38 @@ class Repository implements RestifySearchable, JsonSerializable
136116

137117
/**
138118
* The list of middlewares for the current repository.
139-
*
140-
* @var array
141119
*/
142120
public static array $middleware = [];
143121

144122
/**
145123
* The list of attach callable's.
146-
*
147-
* @var array
148124
*/
149125
public static array $attachers = [];
150126

151127
/**
152128
* The list of detach callable's.
153-
*
154-
* @var array
155129
*/
156130
public static array $detachers = [];
157131

158132
/**
159133
* Specify whether the repository could be accessed public.
160-
*
161-
* @var bool|array
162134
*/
163135
public static bool|array $public = false;
164136

165137
/**
166138
* Indicates if the repository is serializing for an eager relationship.
167139
*
168140
* The $eagerState will reference to the parent that renders this via related.
169-
*
170-
* @var null|string
171141
*/
172-
private null|string $eagerState = null;
142+
private ?string $eagerState = null;
173143

174144
/**
175145
* Extra fields attached to the repository. Useful when display pivot fields.
176-
*
177-
* @var array
178146
*/
179147
public array $extraFields = [];
180148

181149
/**
182150
* A collection of pivots for the nested relationships.
183-
*
184-
* @var PivotsCollection
185151
*/
186152
private PivotsCollection $pivots;
187153

@@ -194,8 +160,6 @@ public function __construct()
194160

195161
/**
196162
* Get the URI key for the repository.
197-
*
198-
* @return string
199163
*/
200164
public static function uriKey(): string
201165
{
@@ -230,8 +194,6 @@ public static function label()
230194

231195
/**
232196
* Get the value that should be displayed to represent the repository.
233-
*
234-
* @return string
235197
*/
236198
public function title(): string
237199
{
@@ -240,8 +202,6 @@ public function title(): string
240202

241203
/**
242204
* Get the search result subtitle for the repository.
243-
*
244-
* @return string|null
245205
*/
246206
public function subtitle(): ?string
247207
{
@@ -323,9 +283,6 @@ public function withResource($resource): self
323283

324284
/**
325285
* Resolve repository with given model.
326-
*
327-
* @param Model $model
328-
* @return Repository
329286
*/
330287
public static function resolveWith(Model $model): Repository
331288
{
@@ -351,8 +308,6 @@ public static function __callStatic($method, $parameters)
351308
/**
352309
* Forward calls to the model (getKey() for example).
353310
*
354-
* @param $method
355-
* @param $parameters
356311
* @return mixed
357312
*/
358313
public function __call($method, $parameters)
@@ -369,11 +324,9 @@ public function __call($method, $parameters)
369324
*
370325
* However all options could be customized by passing an $options argument
371326
*
372-
* @param Router $router
373-
* @param array $attributes
374327
* @param bool $wrap Choose the routes defined in the @routes method, should be wrapped in a group with attributes by default.
375-
* If true then all routes will be grouped in a configuration attributes passed by restify, otherwise
376-
* you should take care of that, by adding $router->group($attributes) in the @routes method
328+
* If true then all routes will be grouped in a configuration attributes passed by restify, otherwise
329+
* you should take care of that, by adding $router->group($attributes) in the @routes method
377330
*/
378331
public static function routes(Router $router, array $attributes, $wrap = true)
379332
{
@@ -388,7 +341,6 @@ public static function routes(Router $router, array $attributes, $wrap = true)
388341
* Resolve all model fields through showCallback methods and exclude from the final response if
389342
* that is required by method
390343
*
391-
* @param $request
392344
* @return array
393345
*/
394346
public function resolveShowAttributes(RestifyRequest $request)
@@ -524,7 +476,6 @@ public function resolveIndexPivots(RestifyRequest $request): array
524476
* Return a list with relationship for the current model.
525477
*
526478
* @param RestifyRequest $request
527-
* @return array
528479
*/
529480
public function resolveRelationships($request): array
530481
{
@@ -550,7 +501,6 @@ public function resolveRelationships($request): array
550501
/**
551502
* Returns the format of the metadata for individual item in the index response.
552503
*
553-
* @param $request
554504
* @return array
555505
*/
556506
public function resolveIndexMeta($request)
@@ -569,7 +519,6 @@ public function resolveIndexMeta($request)
569519
/**
570520
* Return a list with relationship for the current model.
571521
*
572-
* @param $request
573522
* @return array
574523
*/
575524
public function resolveIndexRelationships($request)
@@ -968,7 +917,6 @@ public function allowToDestroy(RestifyRequest $request)
968917
}
969918

970919
/**
971-
* @param $request
972920
* @return $this
973921
*
974922
* @throws \Illuminate\Auth\Access\AuthorizationException
@@ -1076,9 +1024,6 @@ private function modelAttributes(Request $request = null): Collection
10761024
/**
10771025
* Fill each field separately.
10781026
*
1079-
* @param RestifyRequest $request
1080-
* @param Model $model
1081-
* @param Collection $fields
10821027
* @return Collection
10831028
*/
10841029
protected static function fillFields(RestifyRequest $request, Model $model, Collection $fields)

src/Restify.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ class Restify
4545

4646
/**
4747
* Get the repository class name for a given key.
48-
*
49-
* @param string $key
50-
* @return string|null
5148
*/
5249
public static function repositoryClassForKey(string $key): ?string
5350
{
@@ -58,9 +55,6 @@ public static function repositoryClassForKey(string $key): ?string
5855

5956
/**
6057
* Get the repository class for the prefix.
61-
*
62-
* @param string $prefix
63-
* @return string|null
6458
*/
6559
public static function repositoryClassForPrefix(string $prefix): ?string
6660
{
@@ -76,10 +70,7 @@ public static function repositoryClassForPrefix(string $prefix): ?string
7670
/**
7771
* Return the repository instance for a given key.
7872
*
79-
* @param string $key
8073
* @throw RepositoryNotFoundException
81-
*
82-
* @return Repository
8374
*/
8475
public static function repository(string $key): Repository
8576
{
@@ -128,7 +119,6 @@ public static function repositoryForTable($table)
128119
/**
129120
* Register the given repositories.
130121
*
131-
* @param array $repositories
132122
* @return static
133123
*/
134124
public static function repositories(array $repositories)
@@ -141,14 +131,12 @@ public static function repositories(array $repositories)
141131
(new BootRepository($repository))->boot();
142132
});
143133

144-
return new static();
134+
return new static;
145135
}
146136

147137
/**
148138
* Register all of the repository classes in the given directory.
149139
*
150-
* @param string $directory
151-
* @return void
152140
*
153141
* @throws ReflectionException
154142
*/
@@ -162,7 +150,7 @@ public static function repositoriesFrom(string $directory): void
162150
return;
163151
}
164152

165-
foreach ((new Finder())->in($directory)->files() as $repository) {
153+
foreach ((new Finder)->in($directory)->files() as $repository) {
166154
$repository = $namespace.str_replace(
167155
['/', '.php'],
168156
['\\', ''],

0 commit comments

Comments
 (0)