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
Pull Request — master (#221)
by joseph
19:29
created

metaForIndexedUniqueInteger()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 11
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 18
ccs 10
cts 10
cp 1
crap 1
rs 9.9
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\Numeric;
6
7
// phpcs:disable Generic.Files.LineLength.TooLong
8
9
use Doctrine\DBAL\Types\Type;
10
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
11
use Doctrine\ORM\Mapping\Builder\FieldBuilder;
12
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Interfaces\Numeric\IndexedUniqueIntegerFieldInterface;
13
use EdmondsCommerce\DoctrineStaticMeta\MappingHelper;
14
15
// phpcs:enable
16
17
trait IndexedUniqueIntegerFieldTrait
18
{
19
    /**
20
     * @var int
21
     */
22
    private $indexedUniqueInteger;
23
24
    /**
25
     * @SuppressWarnings(PHPMD.StaticAccess)
26
     * @param ClassMetadataBuilder $builder
27
     */
28 3
    public static function metaForIndexedUniqueInteger(ClassMetadataBuilder $builder): void
29
    {
30 3
        $fieldBuilder = new FieldBuilder(
31 3
            $builder,
32
            [
33 3
                'fieldName' => IndexedUniqueIntegerFieldInterface::PROP_INDEXED_UNIQUE_INTEGER,
34
                'type' => Type::INTEGER,
35
            ]
36
        );
37
        $fieldBuilder
38 3
            ->columnName(
39 3
                MappingHelper::getColumnNameForField(
40 3
                    IndexedUniqueIntegerFieldInterface::PROP_INDEXED_UNIQUE_INTEGER
41
                )
42
            )
43 3
            ->nullable(false)
44 3
            ->unique()
45 3
            ->build();
46 3
    }
47
48
    /**
49
     * @return int
50
     */
51 3
    public function getIndexedUniqueInteger(): int
52
    {
53 3
        return $this->indexedUniqueInteger;
54
    }
55
56
    /**
57
     * @param int $indexedUniqueInteger
58
     *
59
     * @return self
60
     */
61 3
    private function setIndexedUniqueInteger(int $indexedUniqueInteger): self
62
    {
63 3
        $this->updatePropertyValue(
0 ignored issues
show
Bug introduced by
It seems like updatePropertyValue() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

63
        $this->/** @scrutinizer ignore-call */ 
64
               updatePropertyValue(
Loading history...
64 3
            IndexedUniqueIntegerFieldInterface::PROP_INDEXED_UNIQUE_INTEGER,
65 3
            $indexedUniqueInteger
66
        );
67
68 3
        return $this;
69
    }
70
71 3
    private function initIndexedUniqueInteger(): void
72
    {
73 3
        $this->indexedUniqueInteger = IndexedUniqueIntegerFieldInterface::DEFAULT_INDEXED_UNIQUE_INTEGER;
74 3
    }
75
}
76