Passed
Push — master ( 197c27...f2cc15 )
by Paul
22:24 queued 07:48
created

Hooks   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
eloc 9
c 1
b 0
f 1
dl 0
loc 24
ccs 0
cts 10
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A run() 0 9 3
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\GamiPress;
4
5
use GeminiLabs\SiteReviews\Contracts\HooksContract;
6
7
class Hooks implements HooksContract
8
{
9
    /**
10
     * @var Controller
11
     */
12
    public $controller;
13
14
    public function __construct()
15
    {
16
        $this->controller = glsr(Controller::class);
17
    }
18
19
    /**
20
     * @return void
21
     */
22
    public function run()
23
    {
24
        if (glsr()->addon('site-reviews-gamipress') || !defined('GAMIPRESS_VER')) {
25
            return;
26
        }
27
        add_filter('gamipress_activity_trigger_label', [$this->controller, 'filterActivityTriggerLabel'], 10, 3);
28
        add_filter('gamipress_activity_triggers', [$this->controller, 'filterActivityTriggers']);
29
        add_filter('user_has_access_to_achievement', [$this->controller, 'filterUserHasAccessToAchievement'], 10, 4);
30
        add_action('site-reviews/review/created', [$this->controller, 'onReviewCreated'], 20);
31
    }
32
}
33