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.

Notification::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\PhpUnitWatcher;
4
5
use Joli\JoliNotif\Notification as JoliNotification;
6
use Joli\JoliNotif\NotifierFactory;
7
8
class Notification
9
{
10
    /** @var \Joli\JoliNotif\Notification */
11
    protected $joliNotification;
12
13
    public static function create()
14
    {
15
        $joliNotification = (new JoliNotification)
16
            ->setTitle('PHPUnit Watcher')
17
            ->setIcon(__DIR__.'/../images/notificationIcon.png');
18
19
        return new static($joliNotification);
20
    }
21
22
    protected function __construct(JoliNotification $joliNotification)
23
    {
24
        $this->joliNotification = $joliNotification;
25
    }
26
27
    public function passingTests()
28
    {
29
        $this->joliNotification->setBody('✅ Tests passed!');
30
31
        $this->send();
32
    }
33
34
    public function failingTests()
35
    {
36
        $this->joliNotification->setBody('❌ Tests failed!');
37
38
        $this->send();
39
    }
40
41
    protected function send()
42
    {
43
        return NotifierFactory::create()->send($this->joliNotification);
44
    }
45
}
46