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

Hooks::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
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