1 | <?php |
||
14 | class BizRuleModel extends Model |
||
15 | { |
||
16 | /** |
||
17 | * @var string name of the rule |
||
18 | */ |
||
19 | public $name; |
||
20 | |||
21 | /** |
||
22 | * @var int UNIX timestamp representing the rule creation time |
||
23 | */ |
||
24 | public $createdAt; |
||
25 | |||
26 | /** |
||
27 | * @var int UNIX timestamp representing the rule updating time |
||
28 | */ |
||
29 | public $updatedAt; |
||
30 | |||
31 | /** |
||
32 | * @var string Rule className |
||
33 | */ |
||
34 | public $className; |
||
35 | |||
36 | /** |
||
37 | * @var \yii\rbac\ManagerInterface |
||
38 | */ |
||
39 | protected $manager; |
||
40 | |||
41 | /** |
||
42 | * @var Rule |
||
43 | */ |
||
44 | private $_item; |
||
45 | |||
46 | /** |
||
47 | * BizRuleModel constructor. |
||
48 | * |
||
49 | * @param \yii\rbac\Rule $item |
||
50 | * @param array $config |
||
51 | */ |
||
52 | public function __construct($item = null, $config = []) |
||
64 | |||
65 | /** |
||
66 | * @inheritdoc |
||
67 | */ |
||
68 | public function rules(): array |
||
78 | |||
79 | /** |
||
80 | * Validate className |
||
81 | */ |
||
82 | public function classExists() |
||
97 | |||
98 | /** |
||
99 | * @inheritdoc |
||
100 | */ |
||
101 | public function attributeLabels(): array |
||
108 | |||
109 | /** |
||
110 | * Check if record is new |
||
111 | * |
||
112 | * @return bool |
||
113 | */ |
||
114 | public function getIsNewRecord(): bool |
||
118 | |||
119 | /** |
||
120 | * Create object |
||
121 | * |
||
122 | * @param $id |
||
123 | * |
||
124 | * @return BizRuleModel|null |
||
125 | */ |
||
126 | public static function find(int $id) |
||
136 | |||
137 | /** |
||
138 | * Save rule |
||
139 | * |
||
140 | * @return bool |
||
141 | */ |
||
142 | public function save(): bool |
||
168 | |||
169 | /** |
||
170 | * @return null|Rule |
||
171 | */ |
||
172 | public function getItem() |
||
176 | } |
||
177 |
This check looks for type mismatches where the missing type is
false
. This is usually indicative of an error condtion.Consider the follow example
This function either returns a new
DateTime
object or false, if there was an error. This is a typical pattern in PHP programming to show that an error has occurred without raising an exception. The calling code should check for this returnedfalse
before passing on the value to another function or method that may not be able to handle afalse
.