Test Failed
Push — master ( 131fc3...3e7ec2 )
by Serhii
18:02 queued 12:24
created

ProgressReportable::progressBar()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 2
nc 1
nop 0
crap 6
1
<?php
2
3
namespace Matchish\ScoutElasticSearch;
4
5
use Symfony\Component\Console\Helper\ProgressBar;
6
use Symfony\Component\Console\Output\NullOutput;
7
8
trait ProgressReportable
9
{
10
    /**
11
     * @var ProgressBar|null
12
     */
13
    private $progressBar;
14
15
    public function withProgressReport(ProgressBar $progressBar): void
16
    {
17
        $this->progressBar = $progressBar;
18
    }
19
20
    private function progressBar(): ProgressBar
21
    {
22
        return $this->progressBar ?: new ProgressBar(new NullOutput());
23
    }
24
}
25