ProgressReportable::progressBar()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 2
nc 1
nop 0
crap 2
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 13
    public function withProgressReport(ProgressBar $progressBar): void
16
    {
17 13
        $this->progressBar = $progressBar;
18 13
    }
19
20 13
    private function progressBar(): ProgressBar
21
    {
22 13
        return $this->progressBar ?: new ProgressBar(new NullOutput());
23
    }
24
}
25