EscolaLMS/model-fields

View on GitHub
Merge pull request #36 from EscolaLMS/feature/WELLMS-334 #141
Witold Wiśniewski authored 43f1396a
complete00:00:18
Your first build completed successfully!

Congratulations

Your first build completed successfully!

See the Results

1
git clone
2
codeclimate validate-config
View output
codeclimate validate-config
No errors or warnings found in .codeclimate.json.
3
codeclimate prepare
View output
codeclimate prepare
4
builder pull-engines
View output
determining required images
5
structure
View output
12
Parser process id: 12
codeclimate-parser socket not present
waiting 1s...
6
duplication
View output
12
Parser process id: 12
codeclimate-parser socket not present
waiting 1s...
7
phan
phan engine documentation
8
phpcodesniffer
phpcodesniffer engine documentation
9
phpmd
phpmd engine documentation
10
sonar-php
sonar-php engine documentation
View output
INFO: Java 1.8.0_322 Amazon.com Inc. (64-bit)
INFO: Linux 4.4.0-1128-aws amd64
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/src/app/build/libs/sonarlint-core-2.17.0.899.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/src/app/build/libs/sonarlint-cli-2.1.0.566.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
INFO: Index files
INFO: Invalid character encountered in file '/code/docs/edit.png' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: Invalid character encountered in file '/code/docs/list.png' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: 51 files indexed
INFO: 28 source files to be analyzed
ERROR: Unable to parse file: /code/src/Services/Contracts/ModelFieldsServiceContract.php
ERROR: Parse error at line 20 column 131:

10: 
11: interface ModelFieldsServiceContract
12: {
13: 
14:     public function addOrUpdateMetadataField(string $class_type, string $name, string $type, string $default = '', array $rules = null, int $visibility = 1 << 0, array $extra = null): Metadata;
15: 
16:     public function removeMetaField(string $class_type, string $name): bool;
17: 
18:     public function getFieldsMetadata(string $class_type): Collection;
19: 
20:     public function getFieldsMetadataListPaginated(string $class_type, ?int $perPage = 15, ?OrderDto $orderDto = null): Collection|LengthAwarePaginator;
                                                                                                                                      ^
21: 
22:     public function castField(mixed $value, ?Metadata $field): mixed;
23: 
24:     /**
25:      * @return array<string, string>
26:      */
27:     public function getExtraAttributesValues(Model $model, ?int $visibility = null): array;
28: 
29:     public function getFieldsMetadataRules(string $class_type): array;
30: }

ERROR: Unable to parse file: /code/src/Services/ModelFieldsService.php
ERROR: Parse error at line 79 column 131:

69:                     // If table not exist set in cache value to false
70:                     Cache::put('model_fields_metadata_table_exists', false);
71:                 }
72:                 return collect([]);
73:             });
74:         }
75: 
76:         return collect([]);
77:     }
78: 
79:     public function getFieldsMetadataListPaginated(string $class_type, ?int $perPage = 15, ?OrderDto $orderDto = null): Collection|LengthAwarePaginator
                                                                                                                                      ^
80:     {
81:         if (!config('model-fields.enabled')) {
82:             return collect([]);
83:         }
84: 
85:         $classTypes = class_parents($class_type) ? array_merge([$class_type], class_parents($class_type)) : [$class_type];
86:         $query = Metadata::query()
87:             ->whereIn('class_type', $classTypes)
88:             ->orderBy($orderDto?->getOrderBy() ?? 'id', $orderDto?->getOrder() ?? 'asc');
89: 

ERROR: Unable to parse file: /code/src/Http/Controllers/ModelFieldsAdminApiController.php
ERROR: Parse error at line 17 column 13:

 7: use EscolaLms\ModelFields\Http\Controllers\Contracts\ModelFieldsAdminApiContract;
 8: use EscolaLms\ModelFields\Http\Requests\MetadataCreateOrUpdateRequest;
 9: use EscolaLms\ModelFields\Http\Requests\MetadataDeleteRequest;
10: use EscolaLms\ModelFields\Http\Requests\MetadataListRequest;
11: use EscolaLms\ModelFields\Http\Resources\MetadataResource;
12: use EscolaLms\ModelFields\Services\Contracts\ModelFieldsServiceContract;
13: use Illuminate\Http\JsonResponse;
14: 
15: class ModelFieldsAdminApiController extends EscolaLmsBaseController implements ModelFieldsAdminApiContract
16: {
17:     private ModelFieldsServiceContract $service;
                ^
18: 
19:     public function __construct(ModelFieldsServiceContract $service)
20:     {
21:         $this->service = $service;
22:     }
23: 
24:     public function list(MetadataListRequest $request): JsonResponse
25:     {
26:         /** @var string $classType */
27:         $classType = $request->get('class_type');

ERROR: Unable to parse file: /code/src/Http/Controllers/ModelFieldsApiController.php
ERROR: Parse error at line 17 column 13:

 7: use Illuminate\Http\JsonResponse;
 8: use EscolaLms\ModelFields\Services\Contracts\ModelFieldsServiceContract;
 9: use EscolaLms\ModelFields\Http\Controllers\Contracts\ModelFieldsApiContract;
10: use EscolaLms\ModelFields\Http\Resources\MetadataResource;
11: use EscolaLms\ModelFields\Http\Requests\MetadataCreateOrUpdateRequest;
12: use EscolaLms\ModelFields\Http\Requests\MetadataDeleteRequest;
13: use EscolaLms\ModelFields\Http\Requests\MetadataListRequest;
14: 
15: class ModelFieldsApiController extends EscolaLmsBaseController implements ModelFieldsApiContract
16: {
17:     private ModelFieldsServiceContract $service;
                ^
18: 
19:     public function __construct(ModelFieldsServiceContract $service)
20:     {
21:         $this->service = $service;
22:     }
23: 
24:     public function list(MetadataListRequest $request): JsonResponse
25:     {
26:         /** @var string|false $classType */
27:         $classType = $request->get('class_type');

ERROR: Unable to parse file: /code/src/ModelFieldsServiceProvider.php
ERROR: Parse error at line 18 column 12:

 8: 
 9: /**
10:  * SWAGGER_VERSION
11:  */
12: 
13: class ModelFieldsServiceProvider extends ServiceProvider
14: {
15:     /**
16:      * @var string[]
17:      */
18:     public array $singletons = [
               ^
19:         ModelFieldsServiceContract::class => ModelFieldsService::class,
20:     ];
21: 
22:     /**
23:      * Bootstrap any application services.
24:      *
25:      * @return void
26:      */
27:     public function boot(): void
28:     {

ERROR: Unable to parse file: /code/src/Models/Model.php
ERROR: Parse error at line 15 column 13:

 5: use Illuminate\Database\Eloquent\Model as BaseModel;
 6: use Illuminate\Database\Eloquent\Relations\MorphMany;
 7: use Illuminate\Support\Collection;
 8: use EscolaLms\ModelFields\Services\Contracts\ModelFieldsServiceContract;
 9: use Illuminate\Support\Facades\App;
10: use EscolaLms\ModelFields\Enum\MetaFieldTypeEnum;
11: use Illuminate\Support\Facades\Cache;
12: 
13: abstract class Model extends BaseModel
14: {
15:     private ModelFieldsServiceContract $service;
                ^
16:     private Collection $extraFields;
17: 
18:     public function __construct(array $attributes = [])
19:     {
20:         $this->service = App::make(ModelFieldsServiceContract::class);
21:         parent::__construct($attributes);
22:     }
23: 
24:     private function getExtraAttributesValues(): array
25:     {

ERROR: Unable to parse file: /code/src/Traits/ModelFields.php
ERROR: Parse error at line 13 column 13:

 3: namespace EscolaLms\ModelFields\Traits;
 4: 
 5: use EscolaLms\ModelFields\Models\Field;
 6: use Illuminate\Support\Collection;
 7: use EscolaLms\ModelFields\Enum\MetaFieldTypeEnum;
 8: use EscolaLms\ModelFields\Facades\ModelFields as ModelFieldsFacade;
 9: use Illuminate\Support\Facades\Cache;
10: 
11: trait ModelFields
12: {
13:     private Collection $extraFields;
                ^
14: 
15:     private function getExtraAttributesValues(): array
16:     {
17:         return ModelFieldsFacade::getExtraAttributesValues($this);
18:     }
19: 
20:     public function attributesToArray()
21:     {
22:         $attributes =  parent::attributesToArray();
23:         $extraAttributes = $this->getExtraAttributesValues();

INFO: 28/28 source files have been analyzed
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.520s
INFO: Final Memory: 12M/95M
INFO: ------------------------------------------------------------------------