Passed
Pull Request — master (#273)
by
unknown
02:46
created

CustomerForArrayable::getTableName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord;
4
5
use Yiisoft\ActiveRecord\ActiveRecord;
6
7
/**
8
 * Class CustomerClosureField.
9
 *
10
 * @property int $id
11
 * @property string $name
12
 * @property string $email
13
 * @property string $address
14
 * @property int $status
15
 */
16
class CustomerForArrayable extends ActiveRecord
17
{
18
    public function getTableName(): string
19
    {
20
        return 'customer';
21
    }
22
23
    public function toArray(array $fields = [], array $expand = [], bool $recursive = true): array
24
    {
25
        $data = parent::toArray($fields, $expand, $recursive);
26
27
        $data['status'] = $this->status == 1 ? 'active' : 'inactive';
28
29
        return $data;
30
    }
31
}