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.

TimerPlugin::registerPublicationStart()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
/*
3
 * This file is part of the trefoil application.
4
 *
5
 * (c) Miguel Angel Gabriel <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Trefoil\Plugins;
12
13
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
14
use Easybook\Events\EasybookEvents;
15
use Easybook\Events\BaseEvent;
16
17
/**
18
 * It registers the start and the end of the book publication
19
 * to measure the elapsed time.
20
 *
21
 * == This sets the right times, taking into account trefoil actions ==
22
 */
23
class TimerPlugin extends BasePlugin implements EventSubscriberInterface
24
{
25 34
    public static function getSubscribedEvents()
26
    {
27
        return array(
28 34
            EasybookEvents::PRE_PUBLISH  => array('registerPublicationStart', +2000), // before everything
29 34
            EasybookEvents::POST_PUBLISH => array('registerPublicationEnd', -2000) // after everything
30 34
        );
31
    }
32
33
    /**
34
     * It registers the timestamp of the book publication start.
35
     *
36
     * @param BaseEvent $event The event object that provides access to the application
37
     */
38
    public function registerPublicationStart(BaseEvent $event)
39
    {
40
        $event->app['app.timer.start'] = microtime(true);
41
    }
42
43
    /**
44
     * It registers the timestamp of the book publication end.
45
     *
46
     * @param BaseEvent $event The event object that provides access to the application
47
     */
48 34
    public function registerPublicationEnd(BaseEvent $event)
49
    {
50 34
        $event->app['app.timer.finish'] = microtime(true);
51 34
    }
52
}
53