Skip to content

Commit c134661

Browse files
committed
Apply fixes from StyleCI
[ci skip] [skip ci]
1 parent ed6d53d commit c134661

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

src/app/Library/CrudPanel/Traits/ColumnsProtectedMethods.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ protected function makeSureColumnHasEntity($column)
196196
// check model method for possibility of beeing a relationship
197197
$column['entity'] = $this->checkMethodPropertiesForRelationship($this->model, $possibleMethodName) ? $column['name'] : false;
198198

199-
if($column['entity']) {
200-
199+
if ($column['entity']) {
201200
$parts = explode('.', $column['entity']);
202201

203202
$attribute_in_relation = false;
@@ -219,6 +218,7 @@ protected function makeSureColumnHasEntity($column)
219218
$column['attribute'] = $column['attribute'] ?? end($parts);
220219
}
221220
}
221+
222222
return $column;
223223
}
224224
}

src/app/Library/CrudPanel/Traits/Relationships.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -313,22 +313,19 @@ private static function getPivotFieldStructure($field)
313313
/**
314314
* Checks the properties of the provided method to better verify if it could be a relation.
315315
* Case the method is not public, is not a relation.
316-
* Case the return type is Attribute, or extends Attribute is not a relation method.
316+
* Case the return type is Attribute, or extends Attribute is not a relation method.
317317
* If the return type extends the Relation class is for sure a relation
318318
* Otherwise we just assume it's a relation.
319-
*
319+
*
320320
* DEV NOTE: In future versions we will return `false` when no return type is set and make the return type mandatory for relationships.
321-
* This function should be refactored to only check if $returnType is a subclass of Illuminate\Database\Eloquent\Relations\Relation.
322-
*
321+
* This function should be refactored to only check if $returnType is a subclass of Illuminate\Database\Eloquent\Relations\Relation.
322+
*
323323
* @param $model
324324
* @param $method
325-
*
326325
* @return bool|string
327-
*
328326
*/
329-
private function checkMethodPropertiesForRelationship($model, $method)
327+
private function checkMethodPropertiesForRelationship($model, $method)
330328
{
331-
332329
$methodReflection = new \ReflectionMethod($model, $method);
333330

334331
// relationship methods function does not have parameters
@@ -337,22 +334,23 @@ private function checkMethodPropertiesForRelationship($model, $method)
337334
}
338335

339336
// relationships are always public methods.
340-
if (!$methodReflection->isPublic()) {
337+
if (! $methodReflection->isPublic()) {
341338
return false;
342339
}
343340

344341
$returnType = $methodReflection->getReturnType();
345342

346-
if($returnType){
343+
if ($returnType) {
347344
$returnType = $returnType->getName();
348-
if(is_a((new $returnType), 'Illuminate\Database\Eloquent\Casts\Attribute')) {
345+
if (is_a((new $returnType), 'Illuminate\Database\Eloquent\Casts\Attribute')) {
349346
return false;
350347
}
351348

352-
if(is_a((new $returnType), 'Illuminate\Database\Eloquent\Relations\Relation')) {
349+
if (is_a((new $returnType), 'Illuminate\Database\Eloquent\Relations\Relation')) {
353350
return $method;
354351
}
355352
}
353+
356354
return $method;
357355
}
358356
}

0 commit comments

Comments
 (0)