ProgressBarRenderer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 15
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getProgressHtml() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * File: ProgressBarRenderer.php
7
 *
8
 * @author Maciej Sławik <[email protected]>
9
 * @copyright Copyright (C) 2019 Lizard Media (http://lizardmedia.pl)
10
 */
11
12
namespace LizardMedia\VarnishWarmer\Model\ProgressHandler;
13
14
use LizardMedia\VarnishWarmer\Api\ProgressHandler\ProgressBarRendererInterface;
15
use LizardMedia\VarnishWarmer\Api\ProgressHandler\ProgressDataInterface;
16
17
/**
18
 * Class ProgressBarRenderer
19
 * @package LizardMedia\VarnishWarmer\Model\ProgressHandler
20
 */
21
class ProgressBarRenderer implements ProgressBarRendererInterface
22
{
23
    /**
24
     * @param ProgressDataInterface $progressData
25
     * @return string
26
     */
27
    public function getProgressHtml(ProgressDataInterface $progressData): string
28
    {
29
        return $progressData->getCurrent()
30
            ? "{$progressData->getProcessType()} progress: "
31
                . "<progress max=\"{$progressData->getTotal()}\" value=\"{$progressData->getCurrent()}\"></progress> "
32
                . "({$progressData->getCurrent()}/{$progressData->getTotal()})"
33
            : '';
34
    }
35
}
36