Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
MaxLength
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 validate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Celemas\Sire\Rule;
6
7use Celemas\Sire\Contract;
8use Celemas\Sire\Validation;
9use Override;
10
11/** @api */
12final class MaxLength implements Contract\Rule
13{
14    public string $message {
15        get => '{label} must be at most {arg1} characters';
16    }
17
18    #[Override]
19    public function validate(Contract\Value $value, string ...$args): Contract\Validation
20    {
21        return Validation::from(strlen($value->value) <= (int) ($args[0] ?? null));
22    }
23}

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.

MaxLength->$message::get
15        get => '{label} must be at most {arg1} characters';
MaxLength->validate
19    public function validate(Contract\Value $value, string ...$args): Contract\Validation
20    {
21        return Validation::from(strlen($value->value) <= (int) ($args[0] ?? null));
22    }