CustomerClosureField::getTableName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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