• 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/ConfigModel.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\ConfigTrait;
8
use Miaoxing\Plugin\Model\HasAppIdTrait;
9
use Miaoxing\Plugin\Model\ModelTrait;
10
use Miaoxing\Plugin\Model\ReqQueryTrait;
11
use Wei\Model\SoftDeleteTrait;
12

13
/**
14
 * 配置模型
15
 */
16
class ConfigModel extends BaseModel
17
{
18
    use ConfigTrait;
19
    use ConstTrait;
20
    use HasAppIdTrait;
21
    use ModelTrait;
22
    use ReqQueryTrait;
23
    use SoftDeleteTrait;
24

25
    public const TYPE_STRING = 's';
26

27
    public const TYPE_BOOL = 'b';
28

29
    public const TYPE_INT = 'i';
30

31
    public const TYPE_FLOAT = 'f';
32

33
    public const TYPE_NULL = 'n';
34

35
    public const TYPE_ARRAY = 'a';
36

37
    public const TYPE_OBJECT = 'o';
38

39
    public const TYPE_JSON = 'j';
40

41
    public const TYPE_EXPRESS = 'e';
42

43
    protected $virtual = [
44
        'typeName',
45
    ];
46

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

62
    /**
63
     * 类型名称
64
     *
65
     * @return string|null
66
     */
67
    protected function getTypeNameAttribute(): ?string
68
    {
NEW
69
        return $this->typeNames[$this->type] ?? null;
×
70
    }
71
}
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