CurrencyResource::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
nc 1
nop 1
dl 0
loc 14
rs 9.8666
c 1
b 0
f 0
1
<?php
2
3
namespace SaasReady\Http\Responses;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
0 ignored issues
show
Bug introduced by
The type Illuminate\Http\Resources\Json\JsonResource was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use SaasReady\Models\Currency;
0 ignored issues
show
Bug introduced by
The type SaasReady\Models\Currency was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
/**
9
 * @mixin Currency
10
 */
11
class CurrencyResource extends JsonResource
12
{
13
    public function toArray($request): array
14
    {
15
        return [
16
            'uuid' => $this->uuid,
17
            'code' => $this->code,
18
            'symbol' => $this->symbol,
19
            'name' => $this->name,
20
            'decimal_separator' => $this->decimal_separator,
21
            'thousands_separator' => $this->thousands_separator,
22
            'space_after_symbol' => $this->space_after_symbol,
23
            'is_active' => (bool) $this->activated_at,
24
            'created_at' => $this->created_at?->toDateTimeString(),
25
            'updated_at' => $this->updated_at?->toDateTimeString(),
26
            'activated_at' => $this->activated_at?->toDateTimeString(),
27
        ];
28
    }
29
}
30