Test Failed
Pull Request — master (#33)
by Serhii
04:22 queued 46s
created

ProgressReportable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

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
    public function withProgressReport(ProgressBar $progressBar)
13
    {
14
        $this->progressBar = $progressBar;
15
    }
16
17
    private function progressBar(): ProgressBar
18
    {
19
        return $this->progressBar ?: new ProgressBar(new NullOutput());
20
    }
21
}
22