| Conditions | 3 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 10 | public function execute() |
||
| 11 | { |
||
| 12 | if (! $this->model->id) { |
||
| 13 | $result = wp_insert_post($this->model->post->to_array(), true); |
||
|
|
|||
| 14 | } else { |
||
| 15 | $result = wp_update_post($this->model->post, true); |
||
| 16 | } |
||
| 17 | |||
| 18 | if (is_wp_error($result)) { |
||
| 19 | throw new WP_ErrorException($result); |
||
| 20 | } |
||
| 21 | |||
| 22 | $this->model->setId($result) |
||
| 23 | ->refresh(); |
||
| 24 | } |
||
| 25 | } |
||
| 26 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.