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   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 22.73%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 8
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 78
ccs 5
cts 22
cp 0.2273
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getPixelId() 0 4 1
A setPixelId() 0 4 1
A getEvents() 0 4 1
A setEvents() 0 4 1
A completeRegistration() 0 4 1
A addEvent() 0 4 1
A render() 0 4 1
A renderTemplate() 0 6 1
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