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 ( f98089...b28a0d )
by Mario
36:02
created

InformationCollectionStruct::getFieldsData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Netgen\InformationCollection\API\Value;
6
7
use eZ\Publish\API\Repository\Values\Content\Content;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, Netgen\InformationCollection\API\Value\Content.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
8
use eZ\Publish\API\Repository\Values\ContentType\ContentType;
9
use EzSystems\RepositoryForms\Data\Content\FieldData;
10
11
final class InformationCollectionStruct extends ValueObject
12
{
13
    /**
14
     * The language code of the version.
15
     *
16
     * @var string
17
     */
18
    protected $languageCode;
19
20
    /**
21
     * @var \eZ\Publish\API\Repository\Values\Content\Content
22
     */
23
    protected $content;
24
25
    /**
26
     * @var \eZ\Publish\API\Repository\Values\ContentType\ContentType
27
     */
28
    protected $contentType;
29
30
    /**
31
     * @var \EzSystems\RepositoryForms\Data\Content\FieldData[]
32
     */
33
    protected $fields;
34
35
    public function __construct(Content $content, ContentType $contentType, array $fields, string $languageCode)
36
    {
37
        $this->content = $content;
38
        $this->contentType = $contentType;
39
        $this->languageCode = $languageCode;
40
41
        foreach ($fields as $field) {
42
            $this->addFieldData($field);
43
        }
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getLanguageCode(): string
50
    {
51
        return $this->languageCode;
52
    }
53
54
    /**
55
     * @return \eZ\Publish\API\Repository\Values\Content\Content
56
     */
57
    public function getContent(): Content
58
    {
59
        return $this->content;
60
    }
61
62
    /**
63
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
64
     */
65
    public function getContentType(): ContentType
66
    {
67
        return $this->contentType;
68
    }
69
70
    /**
71
     * @return \EzSystems\RepositoryForms\Data\Content\FieldData[]
72
     */
73
    public function getFieldsData(): array
74
    {
75
        return $this->fields;
76
    }
77
78
    /**
79
     * @return \EzSystems\RepositoryForms\Data\Content\FieldData[]
80
     */
81
    public function getCollectedFields(): array
82
    {
83
       return $this->fields;
84
    }
85
86
    protected function addFieldData(FieldData $fieldData)
87
    {
88
        $this->fields[$fieldData->fieldDefinition->identifier] = $fieldData;
89
    }
90
}
91