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.

Merchant::getTransactionRepository()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Awin\ReportTask\Bundle\ReportBundle\Model;
4
5
use Awin\ReportTask\Bundle\ReportBundle\Exception\TransactionRepositoryNotFoundException;
6
7
/**
8
 * The merchant model class, which is for the merchant data management
9
 *
10
 * @date       24/06/2017
11
 * @time       13:15
12
 * @author     Peng Yue <[email protected]>
13
 * @copyright  2004-2017 Peng Yue
14
 */
15
16
class Merchant
17
{
18
    /**
19
     * Set the transaction repository
20
     *
21
     * @var TransactionTable
22
     */
23
    private $transactionRepository;
24
25 5
    public function setTransactionRepository(TransactionTable $transactionTable)
26
    {
27 5
        $this->transactionRepository = $transactionTable;
28
29 5
        return $this;
30
    }
31
32
    /**
33
     * Get the transaction repository
34
     *
35
     * @return TransactionTable
36
     */
37 6
    public function getTransactionRepository()
38
    {
39 6
        return $this->transactionRepository;
40
    }
41
42
    /**
43
     * Get the transactions by merchant id
44
     *
45
     * @param int $merchantId
46
     *
47
     * @return array
48
     */
49 5
    public function getTransactionsByMerchantId($merchantId)
50
    {
51 5
        if (!$this->getTransactionRepository() instanceof TransactionTable) {
0 ignored issues
show
introduced by
$this->getTransactionRepository() is always a sub-type of Awin\ReportTask\Bundle\R...\Model\TransactionTable.
Loading history...
52 2
            throw new TransactionRepositoryNotFoundException();
53
        }
54
55 3
        return array_filter(
56 3
            $this->getTransactionRepository()->getTransactions(),
57 3
            function ($e) use ($merchantId) {
58 3
                return (int)$e[0] === (int)$merchantId;
59 3
            }
60
        );
61
    }
62
}