ProgressReportable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A withProgressReport() 0 3 1
A progressBar() 0 3 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