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.
Completed
Push — master ( b5dfb6...a568a9 )
by Mario
40:05
created

FormBuilder::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Netgen\InformationCollection\Form\Builder;
4
5
use eZ\Publish\API\Repository\ContentService;
6
use eZ\Publish\API\Repository\ContentTypeService;
7
use eZ\Publish\API\Repository\Values\Content\Content;
8
use eZ\Publish\API\Repository\Values\Content\Location;
9
use Netgen\InformationCollection\Integration\RepositoryForms\InformationCollectionMapper;
10
use Netgen\InformationCollection\Integration\RepositoryForms\InformationCollectionType;
11
use Symfony\Component\Form\FormBuilderInterface;
12
use Symfony\Component\Form\FormFactoryInterface;
13
use Symfony\Component\Form\FormInterface;
14
use Symfony\Component\Routing\RouterInterface;
15
use Netgen\InformationCollection\API\Form\DynamicFormBuilderInterface;
16
17
class FormBuilder implements DynamicFormBuilderInterface
18
{
19
    /**
20
     * @var FormFactoryInterface
21
     */
22
    protected $formFactory;
23
24
    /**
25
     * @var bool
26
     */
27
    protected $useCsrf;
28
29
    /**
30
     * @var ContentTypeService
31
     */
32
    protected $contentTypeService;
33
34
    /**
35
     * @var RouterInterface
36
     */
37
    protected $router;
38
39
    /**
40
     * FormBuilder constructor.
41
     *
42
     * @param FormFactoryInterface $formFactory
43
     * @param ContentTypeService $contentTypeService
44
     * @param RouterInterface $router
0 ignored issues
show
Bug introduced by
There is no parameter named $router. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
45
     * @param bool $useCsrf
0 ignored issues
show
Bug introduced by
There is no parameter named $useCsrf. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
46
     */
47
    public function __construct(FormFactoryInterface $formFactory, ContentTypeService $contentTypeService)
48
    {
49
        $this->formFactory = $formFactory;
50
        $this->contentTypeService = $contentTypeService;
51
    }
52
53
    public function createFormWithAjax(Content $content): FormBuilderInterface
54
    {
55
        throw new \RuntimeException('This method is not implemented.');
56
    }
57
58
    public function createForm(Content $content): FormInterface
59
    {
60
        $contentType = $this->contentTypeService->loadContentType($content->contentInfo->contentTypeId);
61
62
        $informationCollectionMapper = new InformationCollectionMapper();
63
64
        $data = $informationCollectionMapper->mapToFormData($content, [
65
            'languageCode' => $content->contentInfo->mainLanguageCode,
66
            'contentType' => $contentType,
67
        ]);
68
69
        $builder = $this->formFactory->create(InformationCollectionType::class, $data, [
70
            'languageCode' => $content->contentInfo->mainLanguageCode,
71
            'mainLanguageCode' => $content->contentInfo->mainLanguageCode,
72
        ]);
73
74
        return $builder;
75
    }
76
}
77