Passed
Pull Request — 2.x (#19)
by Alexander
11:44
created

ChangesCountGenerator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 10
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A generate() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\Schema\Generator\Migrations;
6
7
use Cycle\Migrations\Atomizer\Atomizer;
8
use Cycle\Schema\Generator\Migrations\Changes\Collector;
9
use Cycle\Schema\Generator\Migrations\Changes\CollectorInterface;
10
11
final class ChangesCountGenerator implements NameGeneratorInterface
12
{
13
    public function __construct(
14
        private readonly CollectorInterface $collector = new Collector(),
15
    ) {
16
    }
17
18
    public function generate(Atomizer $atomizer): string
19
    {
20
        return \sprintf('changes_%d', $this->collector->collect($atomizer));
0 ignored issues
show
Bug introduced by
$this->collector->collect($atomizer) of type array is incompatible with the type double|integer|string expected by parameter $values of sprintf(). ( Ignorable by Annotation )

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

20
        return \sprintf('changes_%d', /** @scrutinizer ignore-type */ $this->collector->collect($atomizer));
Loading history...
21
    }
22
}
23