Completed
Push — master ( 026b2f...fbea6a )
by Taosikai
11:48
created

src/Message/Font.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
 * This file is part of the slince/smartqq package.
4
 *
5
 * (c) Slince <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Slince\SmartQQ\Message;
12
13
class Font
14
{
15
    /**
16
     * 名称.
17
     *
18
     * @var string
19
     */
20
    protected $name;
21
22
    /**
23
     * 颜色.
24
     *
25
     * @var string
26
     */
27
    protected $color;
28
29
    /**
30
     * 字号.
31
     *
32
     * @var string
33
     */
34
    protected $size;
35
36
    /**
37
     * 风格,具体不知效果.
38
     *
39
     * @var string
40
     */
41
    protected $style;
42
43
    public function __construct($name, $color, $size, array $style = [])
44
    {
45
        $this->name = $name;
46
        $this->color = $color;
47
        $this->size = $size;
48
        $this->style = $style;
0 ignored issues
show
Documentation Bug introduced by
It seems like $style of type array is incompatible with the declared type string of property $style.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
49
    }
50
51
    /**
52
     * @param string $name
53
     */
54
    public function setName($name)
55
    {
56
        $this->name = $name;
57
    }
58
59
    /**
60
     * @param string $color
61
     */
62
    public function setColor($color)
63
    {
64
        $this->color = $color;
65
    }
66
67
    /**
68
     * @param string $size
69
     */
70
    public function setSize($size)
71
    {
72
        $this->size = $size;
73
    }
74
75
    /**
76
     * @param string $style
77
     */
78
    public function setStyle($style)
79
    {
80
        $this->style = $style;
81
    }
82
83
    /**
84
     * @return string
85
     */
86
    public function getName()
87
    {
88
        return $this->name;
89
    }
90
91
    /**
92
     * @return string
93
     */
94
    public function getColor()
95
    {
96
        return $this->color;
97
    }
98
99
    /**
100
     * @return string
101
     */
102
    public function getSize()
103
    {
104
        return $this->size;
105
    }
106
107
    /**
108
     * @return string
109
     */
110
    public function getStyle()
111
    {
112
        return $this->style;
113
    }
114
115
    /**
116
     * 转换成数组.
117
     *
118
     * @return array
119
     */
120
    public function toArray()
121
    {
122
        return [
123
            'name' => $this->name,
124
            'size' => $this->size,
125
            'style' => $this->style,
126
            'color' => $this->color,
127
        ];
128
    }
129
130
    /**
131
     * 创建一个默认字体.
132
     *
133
     * @return static
134
     */
135
    public static function createDefault()
136
    {
137
        return new static('微软雅黑', '000000', 10, [0, 0, 0]);
138
    }
139
}
140