GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

FacebookPixel::completeRegistration()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
declare(strict_types=1);
3
4
namespace ByTIC\FacebookPixel;
5
6
use ByTIC\FacebookPixel\Events\AbstractEvent;
7
8
/**
9
 * Class FacebookPixel
10
 *
11
 * @author Gabriel Solomon <[email protected]>
12
 */
13
class FacebookPixel
14
{
15
16
    /**
17
     * @var int
18
     */
19
    protected $pixelId;
20
21
    /** @var AbstractEvent[] */
22
    private $events = [];
23
24
    /**
25
     * @return int
26
     */
27 1
    public function getPixelId()
28
    {
29 1
        return $this->pixelId;
30
    }
31
32
    /**
33
     * @param int $pixelId
34
     */
35 1
    public function setPixelId($pixelId)
36
    {
37 1
        $this->pixelId = $pixelId;
38 1
    }
39
40
    /**
41
     * @return AbstractEvent[]
42
     */
43
    public function getEvents()
44
    {
45
        return $this->events;
46
    }
47
48
    /**
49
     * @param AbstractEvent[] $events
50
     */
51
    public function setEvents($events)
52
    {
53
        $this->events = $events;
54
    }
55
56
    /**
57
     * Add Complete Registration event
58
     */
59
    public function completeRegistration()
60
    {
61
        $this->addEvent(EventsFactory::create('CompleteRegistration'));
62
    }
63
64
    /**
65
     * @param AbstractEvent $event
66
     */
67
    public function addEvent($event)
68
    {
69
        $this->events[] = $event;
70
    }
71
72
    /**
73
     * @return string
74
     */
75
    public function render()
76
    {
77
        return $this->renderTemplate('basecode') . $this->renderTemplate('events');
78
    }
79
80
    /**
81
     * @param string $name
82
     * @return string
83
     */
84
    protected function renderTemplate($name)
85
    {
86
        ob_start();
87
        include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $name . '.php');
88
        return ob_get_clean();
89
    }
90
}
91