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.

ManageCronTask::createCronTask()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 14
rs 9.4286
cc 1
eloc 11
nc 1
nop 6
1
<?php
2
3
/**
4
 * Copyright (c) 2014,TMSolution <[email protected]>
5
 * All rights reserved.
6
 *
7
 * For the full copyright and license information, please view
8
 * the file LICENSE.md that was distributed with this source code.
9
 */
10
11
namespace TMSolution\CronBundle\Service;
12
13
use TMSolution\CronBundle\Entity\CronTask;
14
use Doctrine\ORM\EntityManager;
15
16
/**
17
 * @author Łukasz Wawrzyniak <[email protected]>
18
 * 
19
 */
20
class ManageCronTask
21
{
22
23
    const EXEC_CLI = 1;
24
    const EXEC_SYMFONYCLI = 2;
25
    const EXEC_REST = 3;
26
    const EXEC_SYMFONYSERVICE = 4;
27
28
    protected $em;
29
30
    public function __construct(EntityManager $entityManager)
31
    {
32
        $this->em = $entityManager;
33
    }
34
35
    public function createCronTask($name, array $commands, $execType, \DateTime $firstRun, $interval = 0, $repeatable = 0)
36
    {
37
        $cronTask = new CronTask();
38
        $cronTask->setName($name);
39
        $cronTask->setCommands($commands);
40
        $cronTask->setExecType($execType);
41
        $cronTask->setFirstRun($firstRun);
42
        $cronTask->setInterval($interval);
43
        $cronTask->setRepeatable($repeatable);
0 ignored issues
show
Documentation introduced by
$repeatable is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
44
        $this->em->persist($cronTask);
45
        $this->em->flush();
46
47
        return $cronTask;
48
    }
49
50
}
51