Conditions | 1 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
12 | public function render(array $attributes): string |
||
13 | { |
||
14 | $attributes['class'] = $attributes['className']; |
||
15 | if ('edit' === filter_input(INPUT_GET, 'context')) { |
||
16 | $attributes = $this->normalize($attributes); |
||
17 | if (0 !== Cast::toInt($attributes['post_id']) && !Review::isReview($attributes['post_id'])) { |
||
18 | return $this->buildEmptyBlock( |
||
19 | _x('Enter a valid Review Post ID to display a review.', 'admin-text', 'site-reviews') |
||
20 | ); |
||
21 | } |
||
22 | if (!$this->hasVisibleFields($attributes)) { |
||
23 | return $this->buildEmptyBlock( |
||
24 | _x('You have hidden all of the fields for this block.', 'admin-text', 'site-reviews') |
||
25 | ); |
||
26 | } |
||
27 | } |
||
28 | return $this->shortcode()->buildBlock($attributes); |
||
29 | } |
||
30 | |||
36 |