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 ( e4e275...7e47ac )
by joseph
07:04 queued 07:01
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.0876

Importance

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

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