Test Failed
Push — develop ( c0d6f9...325b33 )
by Paul
08:37
created

BricksSiteReview   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 11
c 1
b 0
f 0
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A shortcode() 0 3 1
A render() 0 15 3
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\Bricks;
4
5
use GeminiLabs\SiteReviews\Contracts\ShortcodeContract;
6
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewShortcode;
7
8
class BricksSiteReview extends BricksElement
9
{
10
    public function render()
11
    {
12
        if (empty($this->settings['post_id'])) {
13
            $this->render_element_placeholder([
14
                'title' => esc_html_x('Please select a Review.', 'admin-text', 'site-reviews'),
15
            ]);
16
            return;
17
        }
18
        if (!$this->elShortcode->hasVisibleFields($this->settings)) {
19
            $this->render_element_placeholder([
20
                'title' => esc_html_x('You have hidden all of the fields.', 'admin-text', 'site-reviews'),
21
            ]);
22
            return;
23
        }
24
        parent::render();
25
    }
26
27
    public static function shortcode(): ShortcodeContract
28
    {
29
        return glsr(SiteReviewShortcode::class);
30
    }
31
}
32