Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
83.33% covered (warning)
83.33%
5 / 6
50.00% covered (danger)
50.00%
2 / 4
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
Minimum
100.00% covered (success)
100.00%
1 / 1
83.33% covered (warning)
83.33%
5 / 6
50.00% covered (danger)
50.00%
2 / 4
100.00% covered (success)
100.00%
1 / 1
2.50
100.00% covered (success)
100.00%
1 / 1
 validate
100.00% covered (success)
100.00%
1 / 1
83.33% covered (warning)
83.33%
5 / 6
50.00% covered (danger)
50.00%
2 / 4
100.00% covered (success)
100.00%
1 / 1
2.50
1<?php
2
3declare(strict_types=1);
4
5namespace Celema\Sire\Rule;
6
7use Celema\Sire\Contract;
8use Celema\Sire\Validation;
9use Override;
10
11/** @api */
12final class Minimum implements Contract\Rule, Contract\NamedArguments
13{
14    public string $message {
15        get => '{label} must be at least {min}';
16    }
17
18    public array $arguments {
19        get => ['min'];
20    }
21
22    #[Override]
23    public function validate(Contract\Value $value, string ...$args): Contract\Validation
24    {
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
26    }
27}

Paths

Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once. Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

Minimum->$arguments::get
19        get => ['min'];
Minimum->$message::get
15        get => '{label} must be at least {min}';
Minimum->validate
23    public function validate(Contract\Value $value, string ...$args): Contract\Validation
24    {
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
26    }
23    public function validate(Contract\Value $value, string ...$args): Contract\Validation
24    {
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
26    }
23    public function validate(Contract\Value $value, string ...$args): Contract\Validation
24    {
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
26    }
23    public function validate(Contract\Value $value, string ...$args): Contract\Validation
24    {
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
 
25        return Validation::from(is_numeric($value->value) && (float) $value->value >= (float) ($args[0] ?? null));
26    }