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.
Completed
Push — master ( 4c557d...bf89ff )
by Alex
02:54
created

findScheduledJobToReschedule()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 32
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 32
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 16
nc 1
nop 4
1
<?php
2
/**
3
 * This file is part of the Global Trading Technologies Ltd workflow-extension-bundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * (c) fduch <[email protected]>
9
 * @date 01.08.16
10
 */
11
12
namespace Gtt\Bundle\WorkflowExtensionsBundle\Entity\Repository;
13
14
use Doctrine\ORM\EntityRepository;
15
use Gtt\Bundle\WorkflowExtensionsBundle\Entity\ScheduledJob;
16
use JMS\JobQueueBundle\Entity\Job;
17
18
/**
19
 * ScheduledJobRepository
20
 */
21
class ScheduledJobRepository extends EntityRepository
22
{
23
    /**
24
     * Finds ScheduledJob by subject identity and workflow transition that can be rescheduled (is able to be started now)
25
     *
26
     * @param string $workflowName   workflow name
27
     * @param string $transitionName transition name
28
     * @param string $subjectClass   subject class
29
     * @param string $subjectId      subject id
30
     *
31
     * @return ScheduledJob|null
32
     */
33
    public function findScheduledJobToReschedule($workflowName, $transitionName, $subjectClass, $subjectId)
34
    {
35
        // fetching scheduled job that was not started before - it can be rescheduled
36
        $queryString = <<<'QUERY'
37
            SELECT sj FROM WorkflowExtensionsBundle:ScheduledJob sj
38
            JOIN sj.job j
39
            WHERE
40
                sj.workflow = :workflow AND
41
                sj.transition = :transition AND
42
                sj.subjectClass = :subjectClass AND
43
                sj.subjectId = :subjectId AND
44
                j.state in (:stateNew, :statePending)
45
QUERY;
46
47
        $scheduledJobToReschedule =
48
        $this->_em
49
            ->createQuery($queryString)
50
            ->setParameters([
51
                'workflow'     => $workflowName,
52
                'transition'   => $transitionName,
53
                'subjectClass' => $subjectClass,
54
                'subjectId'    => $subjectId,
55
                'stateNew'     => Job::STATE_NEW,
56
                'statePending' => Job::STATE_PENDING
57
            ])
58
            // since there is unique index on transition, workflow, subjectClass, subjectId fields we can select here
59
            // 0 or 1 job entity
60
            ->getOneOrNullResult()
61
        ;
62
63
        return $scheduledJobToReschedule;
64
    }
65
}