Issues (2551)

src/Impl/Batch/BatchStatisticsEntity.php (2 issues)

1
<?php
2
3
namespace Jabe\Impl\Batch;
4
5
use Jabe\Batch\BatchStatisticsInterface;
6
7
class BatchStatisticsEntity extends BatchEntity implements BatchStatisticsInterface
8
{
9
    protected $remainingJobs;
10
    protected $failedJobs;
11
12
    public function getRemainingJobs(): int
13
    {
14
        return $this->remainingJobs . getJobsToCreate();
0 ignored issues
show
The function getJobsToCreate was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

14
        return $this->remainingJobs . /** @scrutinizer ignore-call */ getJobsToCreate();
Loading history...
Bug Best Practice introduced by
The expression return $this->remainingJobs . getJobsToCreate() returns the type string which is incompatible with the type-hinted return integer.
Loading history...
15
    }
16
17
    public function setRemainingJobs(int $remainingJobs): void
18
    {
19
        $this->remainingJobs = $remainingJobs;
20
    }
21
22
    public function getCompletedJobs(): int
23
    {
24
        return $this->totalJobs - $this->getRemainingJobs();
25
    }
26
27
    public function getFailedJobs(): int
28
    {
29
        return $this->failedJobs;
30
    }
31
32
    public function setFailedJobs(int $failedJobs): void
33
    {
34
        $this->failedJobs = $failedJobs;
35
    }
36
37
    public function getJobsToCreate(): int
38
    {
39
        return $this->totalJobs - $this->jobsCreated;
40
    }
41
42
    public function __toString()
43
    {
44
        return "BatchStatisticsEntity{" .
45
            "batchHandler=" . $this->batchJobHandler .
46
            ", id='" . $this->id . '\'' .
47
            ", type='" . $this->type . '\'' .
48
            ", size=" . $this->totalJobs .
49
            ", jobCreated=" . $this->jobsCreated .
50
            ", remainingJobs=" . $this->remainingJobs .
51
            ", failedJobs=" . $this->failedJobs .
52
            ", batchJobsPerSeed=" . $this->batchJobsPerSeed .
53
            ", invocationsPerBatchJob=" . $this->invocationsPerBatchJob .
54
            ", seedJobDefinitionId='" . $this->seedJobDefinitionId . '\'' .
55
            ", monitorJobDefinitionId='" . $this->seedJobDefinitionId . '\'' .
56
            ", batchJobDefinitionId='" . $this->batchJobDefinitionId . '\'' .
57
            ", configurationId='" . $this->configuration->getByteArrayId() . '\'' .
58
            '}';
59
    }
60
}
61