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 ( 84e592...894b2c )
by joseph
127:56 queued 125:09
created

IndexedUniqueIntegerFieldTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Test Coverage

Coverage 58.81%

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 57
ccs 20
cts 34
cp 0.5881
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getIndexedUniqueInteger() 0 3 1
A initIndexedUniqueInteger() 0 3 1
A metaForIndexedUniqueInteger() 0 18 1
A setIndexedUniqueInteger() 0 8 1
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