| Total Complexity | 12 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 8 | class Multilingual implements Contract |
||
| 9 | { |
||
| 10 | protected $integration; |
||
| 11 | protected $isEnabled = false; |
||
| 12 | |||
| 13 | public function __construct() |
||
| 14 | { |
||
| 15 | $integration = ucfirst(glsr(OptionManager::class)->get('settings.general.multilingual')); |
||
| 16 | $integrationClass = 'GeminiLabs\SiteReviews\Modules\Multilingual\\'.$integration; |
||
| 17 | if (!class_exists($integrationClass)) { |
||
| 18 | glsr_log()->error($integrationClass.' does not exist'); |
||
| 19 | return; |
||
| 20 | } |
||
| 21 | $this->integration = glsr($integrationClass); |
||
| 22 | $this->isEnabled = true; |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * {@inheritdoc} |
||
| 27 | */ |
||
| 28 | public function getPost($postId) |
||
| 29 | { |
||
| 30 | return $this->isEnabled |
||
| 31 | ? $this->integration->getPostIds($postId) |
||
| 32 | : $postId; |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * {@inheritdoc} |
||
| 37 | */ |
||
| 38 | public function getPostIds(array $postIds) |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * {@inheritdoc} |
||
| 47 | */ |
||
| 48 | public function isActive() |
||
| 49 | { |
||
| 50 | return $this->isEnabled |
||
| 51 | ? $this->integration->isActive() |
||
| 52 | : false; |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * {@inheritdoc} |
||
| 57 | */ |
||
| 58 | public function isEnabled() |
||
| 59 | { |
||
| 60 | return $this->isEnabled |
||
| 61 | ? $this->integration->isEnabled() |
||
| 62 | : false; |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * {@inheritdoc} |
||
| 67 | */ |
||
| 68 | public function isSupported() |
||
| 73 | } |
||
| 74 | } |
||
| 75 |