Test Failed
Push — master ( aff3ac...48396d )
by 世昌
02:34
created

DataObject::checkFieldExist()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace suda\application\database;
3
4
use suda\orm\struct\ArrayDataTrait;
5
use suda\orm\struct\ArrayDataInterface;
6
use suda\orm\struct\TableStructAwareTrait;
7
use suda\orm\struct\TableStructAwareInterface;
8
9
/**
10
 * 数据表抽象对象
11
 *
12
 * 用于提供对数据表的操作
13
 *
14
 */
15
abstract class DataObject implements TableStructAwareInterface, ArrayDataInterface
16
{
17
    use ArrayDataTrait;
18
    use TableStructAwareTrait;
19
20
    /**
21
     * 检查字段是否存在
22
     *
23
     * @param string $name
24
     * @return boolean
25
     */
26
    public function checkFieldExist(string $name)
27
    {
28
        return static::getTableStruct()->getFields()->hasField($name);
29
    }
30
}
31