Issues (7)

src/ProcessFactory.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Semaphoro;
4
5
6
class ProcessFactory
7
{
8
    /**
9
     * @param string $rangeName
10
     * @param bool $isReprocess
11
     * @return ProcessInterface
12
     */
13 4
    public function createFromKey(string $rangeName, bool $isReprocess = false): ProcessInterface
14
    {
15 4
        list($firstNumber, $lastNumber) = $this->extractNumbers($rangeName);
16
17 4
        return new Process($firstNumber, $lastNumber, $isReprocess);
0 ignored issues
show
$lastNumber of type string is incompatible with the type integer expected by parameter $end of Semaphoro\Process::__construct(). ( Ignorable by Annotation )

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

17
        return new Process($firstNumber, /** @scrutinizer ignore-type */ $lastNumber, $isReprocess);
Loading history...
$firstNumber of type string is incompatible with the type integer expected by parameter $start of Semaphoro\Process::__construct(). ( Ignorable by Annotation )

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

17
        return new Process(/** @scrutinizer ignore-type */ $firstNumber, $lastNumber, $isReprocess);
Loading history...
18
    }
19
20
    /**
21
     * @param $rangeNameWithoutPrefix
22
     * @return array
23
     */
24 4
    private function extractNumbers($rangeNameWithoutPrefix): array
25
    {
26 4
        return explode('_', $rangeNameWithoutPrefix);
27
    }
28
29
    /**
30
     * @param ProcessInterface $process
31
     * @return string
32
     */
33 3
    public function getProcessKey(ProcessInterface $process): string
34
    {
35 3
        return sprintf('%s_%s', $process->getStart(), $process->getEnd());
36
    }
37
}
38