forked from bmitch/churn-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMinScoreToShow.php
More file actions
40 lines (32 loc) · 827 Bytes
/
MinScoreToShow.php
File metadata and controls
40 lines (32 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
declare(strict_types=1);
namespace Churn\Configuration\Validator;
use Churn\Configuration\EditableConfig;
use Webmozart\Assert\Assert;
/**
* @internal
*/
final class MinScoreToShow extends BaseValidator
{
/**
* Class constructor.
*/
public function __construct()
{
parent::__construct('minScoreToShow');
}
/**
* @param EditableConfig $config The configuration object.
* @param mixed $value The value to validate.
*/
#[\Override]
protected function validateValue(EditableConfig $config, $value): void
{
if (null === $value) {
$config->setMinScoreToShow(null);
return;
}
Assert::numeric($value, 'Minimum score to show should be a number');
$config->setMinScoreToShow((float) $value);
}
}