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

ProgressReportable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

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\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