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.
Test Failed
Push — master ( 659f53...df9043 )
by Peng
03:26
created

PhoneNumberController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 48
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A generateReport() 0 20 1
1
<?php
2
3
namespace Awin\ReportTask\Bundle\ReportBundle\Controller\v1;
4
5
use Awin\ReportTask\Bundle\ReportBundle\Model\Merchant;
6
use Awin\ReportTask\Bundle\ReportBundle\Model\TransactionCsvStorage;
7
use Awin\ReportTask\Bundle\ReportBundle\Model\TransactionTable;
8
use Awin\ReportTask\Bundle\ReportBundle\Service\Observer\ReportObserver;
9
use Awin\ReportTask\Bundle\ReportBundle\Service\PhoneNumber;
0 ignored issues
show
Bug introduced by
The type Awin\ReportTask\Bundle\R...dle\Service\PhoneNumber was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Symfony\Component\HttpFoundation\Request;
11
use Symfony\Component\HttpFoundation\JsonResponse;
12
use FOS\RestBundle\Controller\FOSRestController;
13
use FOS\RestBundle\Controller\Annotations as Rest;
14
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
15
16
class PhoneNumberController extends FOSRestController
17
{
18
    /**
19
     * @ApiDoc(
20
     *  resource=false,
21
     *  description="The endpoint to generate merchant report",
22
     *  headers={
23
     *         {
24
     *             "name"="Access-Token",
25
     *             "description"="Domain ID or token"
26
     *         }
27
     *     },
28
     *     statusCodes={
29
     *          200="Returned when validation is successful",
30
     *          403="Returned when request is not authorised",
31
     *          500={
32
     *           "Returned when the number validation fails",
33
     *           "Returned when input param lead to the validation failure"
34
     *         }
35
     *     },
36
     *     parameters={
37
     *         {"name"="merchant_id", "dataType"="int", "required"=false, "description"="the merchant_id for generate report"},
38
     *         {"name"="date", "dataType"="string", "required"=false, "description"="the date for generate report"}
39
     *     }
40
     *  )
41
     *
42
     * @return JsonResponse
43
     */
44
    public function generateReport(Request $request)
45
    {
46
        $merchantId = $request->get('merchant_id');
47
        $date       = $request->get('date');
48
49
        $reportService              = $this->getContainer()->get('app.report_service');
0 ignored issues
show
Bug introduced by
The method getContainer() does not exist on Awin\ReportTask\Bundle\R...1\PhoneNumberController. ( Ignorable by Annotation )

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

49
        $reportService              = $this->/** @scrutinizer ignore-call */ getContainer()->get('app.report_service');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
50
        $reportService->attach(new ReportObserver());
51
        $currencyService            = $this->getContainer()->get('app.currency_service');
52
        $merchantTransactionService = $this->getContainer()->get('app.merchant_transaction_service');
53
        $merchantTransactionService->setTransactionRepository(new TransactionTable('var/storage/data.csv'));
54
        $merchantTransactionService->setMerchantRepository(new Merchant());
55
        $storage                    = new TransactionCsvStorage('var/storage/data.csv');
56
57
        $reportService->generate($merchantTransactionService, $currencyService, $storage, $merchantId, $date);
58
59
        $response = new JsonResponse([
60
            'success' => true,
61
        ]);
62
63
        return $response;
64
    }
65
}