• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

miaoxing / plugin / 8753851500

14 Apr 2024 08:13AM UTC coverage: 44.148%. Remained the same
8753851500

push

github

twinh
fix(config): 类型为 null 时获取名称错误

0 of 2 new or added lines in 2 files covered. (0.0%)

1256 of 2845 relevant lines covered (44.15%)

7.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Service/GlobalConfigModel.php
1
<?php
2

3
namespace Miaoxing\Plugin\Service;
4

5
use Miaoxing\Plugin\BaseModel;
6
use Miaoxing\Plugin\ConstTrait;
7
use Miaoxing\Plugin\Metadata\GlobalConfigTrait;
8
use Miaoxing\Plugin\Model\ModelTrait;
9
use Miaoxing\Plugin\Model\ReqQueryTrait;
10
use Wei\Model\SoftDeleteTrait;
11

12
class GlobalConfigModel extends BaseModel
13
{
14
    use ConstTrait;
15
    use GlobalConfigTrait;
16
    use ModelTrait;
17
    use ReqQueryTrait;
18
    use SoftDeleteTrait;
19

20
    public const TYPE_STRING = 's';
21

22
    public const TYPE_BOOL = 'b';
23

24
    public const TYPE_INT = 'i';
25

26
    public const TYPE_FLOAT = 'f';
27

28
    public const TYPE_NULL = 'n';
29

30
    public const TYPE_ARRAY = 'a';
31

32
    public const TYPE_OBJECT = 'o';
33

34
    public const TYPE_JSON = 'j';
35

36
    public const TYPE_EXPRESS = 'e';
37

38
    protected $virtual = [
39
        'typeName',
40
    ];
41

42
    /**
43
     * @var array
44
     */
45
    protected $typeNames = [
46
        self::TYPE_STRING => '字符串',
47
        self::TYPE_BOOL => '布尔值',
48
        self::TYPE_INT => '整数',
49
        self::TYPE_FLOAT => '小数',
50
        self::TYPE_NULL => 'NULL',
51
        self::TYPE_ARRAY => '数组',
52
        self::TYPE_JSON => 'JSON',
53
        self::TYPE_OBJECT => '对象',
54
        self::TYPE_EXPRESS => '表达式',
55
    ];
56

57
    /**
58
     * 类型名称
59
     *
60
     * @return string|null
61
     */
62
    protected function getTypeNameAttribute(): ?string
63
    {
NEW
64
        return $this->typeNames[$this->type] ?? null;
×
65
    }
66
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc