Passed
Pull Request — master (#15)
by Serhii
06:06
created

ProgressReportable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 4
dl 0
loc 12
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A progressBar() 0 3 2
A withProgressReport() 0 3 1
1
<?php
2
3
namespace Matchish\ScoutElasticSearch;
4
5
use Symfony\Component\Console\Output\NullOutput;
6
use Symfony\Component\Console\Helper\ProgressBar;
7
8
trait ProgressReportable
9
{
10
    private $progressBar;
11
12 10
    public function withProgressReport(ProgressBar $progressBar)
13
    {
14 10
        $this->progressBar = $progressBar;
15 10
    }
16
17 10
    private function progressBar(): ProgressBar
18
    {
19 10
        return $this->progressBar ?: new ProgressBar(new NullOutput());
20
    }
21
}
22