CustomerClosureField   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 12
dl 0
loc 22
rs 10
c 2
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fields() 0 7 2
A getTableName() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord;
6
7
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord;
8
9
/**
10
 * Class CustomerClosureField.
11
 */
12
final class CustomerClosureField extends ActiveRecord
13
{
14
    protected int $id;
15
    protected string $email;
16
    protected string|null $name = null;
17
    protected string|null $address = null;
18
    protected int|null $status = 0;
19
    protected bool|string|null $bool_status = false;
20
    protected int|null $profile_id = null;
21
22
    public function getTableName(): string
23
    {
24
        return 'customer';
25
    }
26
27
    public function fields(): array
28
    {
29
        $fields = parent::fields();
30
31
        $fields['status'] = static fn(self $customer) => $customer->status === 1 ? 'active' : 'inactive';
32
33
        return $fields;
34
    }
35
}
36