QueryRepository   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 31
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A validateCredentials() 0 4 1
A fetchAllTickets() 0 4 1
A fetchTicketsByStatus() 0 4 1
A fetchParticularTicket() 0 4 1
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