QueryRepository::validateCredentials()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace AppBuilder\Application\Module\Jira;
6
7
class QueryRepository
8
{
9
    private const VALIDATE_CREDENTIALS_QUERY    = 'createdDate > now()';
10
    private const FETCH_ALL_TICKETS_QUERY       = 'status in '
11
        . "('Work finished', 'Work in progress') "
12
        . "OR (status = Done AND status changed AFTER startOfDay('-24h')) "
13
        . 'ORDER BY key ASC';
14
15
    private const FETCH_TICKETS_BY_STATUS_QUERY = 'status = "%s"';
16
    private const FETCH_PARTICULAR_TICKET       = 'key = %s';
17
18
    public function validateCredentials() : string
19
    {
20
        return static::VALIDATE_CREDENTIALS_QUERY;
21
    }
22
23
    public function fetchAllTickets() : string
24
    {
25
        return static::FETCH_ALL_TICKETS_QUERY;
26
    }
27
28
    public function fetchTicketsByStatus(string $status) : string
29
    {
30
        return sprintf(static::FETCH_TICKETS_BY_STATUS_QUERY, $status);
31
    }
32
33
    public function fetchParticularTicket(string $key) : string
34
    {
35
        return sprintf(static::FETCH_PARTICULAR_TICKET, $key);
36
    }
37
}
38