DelayClient   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 49
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A getValue() 0 4 1
A export() 0 4 1
1
<?php
2
/**
3
 * vipnytt/RobotsTxtParser
4
 *
5
 * @link https://github.com/VIPnytt/RobotsTxtParser
6
 * @license https://github.com/VIPnytt/RobotsTxtParser/blob/master/LICENSE The MIT License (MIT)
7
 */
8
9
namespace vipnytt\RobotsTxtParser\Client\Directives;
10
11
/**
12
 * Class DelayClient
13
 *
14
 * @see https://github.com/VIPnytt/RobotsTxtParser/blob/master/docs/methods/DelayClient.md for documentation
15
 * @package vipnytt\RobotsTxtParser\Client\Directives
16
 */
17
class DelayClient extends DelayCore
18
{
19
    /**
20
     * Value
21
     * @var float|int
22
     */
23
    private $value;
24
25
    /**
26
     * Export value
27
     * @var float|int
28
     */
29
    private $exportValue;
30
31
    /**
32
     * DelayClient constructor.
33
     *
34
     * @param string $baseUri
35
     * @param string $product
36
     * @param float|int $value
37
     * @param float|int $fallbackValue
38
     */
39
    public function __construct($baseUri, $product, $value, $fallbackValue = 0)
40
    {
41
        parent::__construct($baseUri, $product);
42
        $this->exportValue = $value;
43
        $this->value = $value > 0 ? $value : $fallbackValue;
44
    }
45
46
    /**
47
     * Get value
48
     *
49
     * @return float|int
50
     */
51
    public function getValue()
52
    {
53
        return $this->value;
54
    }
55
56
    /**
57
     * Export
58
     *
59
     * @return float|int
60
     */
61
    public function export()
62
    {
63
        return $this->exportValue;
64
    }
65
}
66