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.

ReportObserver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 27
ccs 12
cts 12
cp 1
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A listenReportGeneration() 0 17 3
1
<?php
2
3
namespace Awin\ReportTask\Bundle\ReportBundle\Service\Observer;
4
5
use Awin\ReportTask\Bundle\ReportBundle\Service\CurrencyServiceInterface;
6
7
/**
8
 * Get the exchange rate from currency service and and do the currency exchange calculation
9
 *
10
 * @date       24/06/2017
11
 * @time       17:56
12
 * @author     Peng Yue <[email protected]>
13
 * @copyright  2004-2017 Peng Yue
14
 */
15
16
class ReportObserver implements ReportObserverInterface
17
{
18
    /**
19
     * Listen to the report generation and apply the changes to data
20
     *
21
     * @param array                     $data
22
     * @param CurrencyServiceInterface  $currencyService
23
     *
24
     * @return array
25
     */
26 2
    public function listenReportGeneration(array $data, CurrencyServiceInterface $currencyService)
27
    {
28 2
        $results = [];
29 2
        foreach ($data as $item) {
30 2
            $temp = [];
31 2
            foreach ($currencyService->getCurrencies() as $currency => $symbol) {
32
                $convertAmount = $currencyService
33 2
                    ->getCurrencyConverter()
34 2
                    ->setOriginalCurrency($currencyService->symbolToCurrency($item[3]))
0 ignored issues
show
Bug introduced by
The method symbolToCurrency() does not exist on Awin\ReportTask\Bundle\R...urrencyServiceInterface. Since it exists in all sub-types, consider adding an abstract or default implementation to Awin\ReportTask\Bundle\R...urrencyServiceInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
                    ->setOriginalCurrency($currencyService->/** @scrutinizer ignore-call */ symbolToCurrency($item[3]))
Loading history...
35 2
                    ->setTargetCurrency($currency)
36 2
                    ->convert($item[4]);
37 2
                $temp[] = sprintf('%s%.2F', $symbol, $convertAmount);
38
            }
39 2
            $results[] = array_merge($item, $temp);
40
        }
41
42 2
        return $results;
43
    }
44
}