Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
FloatRule
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
4
100.00% covered (success)
100.00%
1 / 1
 name
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 testConditions
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
 exceptionMessageOnTestFailure
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 WsdlToPhp\PackageGenerator\File\Validation;
6
7final class FloatRule extends AbstractRule
8{
9    public function name(): string
10    {
11        return 'float';
12    }
13
14    public function testConditions(string $parameterName, $value, bool $itemType = false): string
15    {
16        return sprintf(($itemType ? '' : '!is_null($%1$s) && ').'!(is_float($%1$s) || is_numeric($%1$s))', $parameterName);
17    }
18
19    public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string
20    {
21        return sprintf('sprintf(\'Invalid value %%s, please provide a float value, %%s given\', var_export($%1$s, true), gettype($%1$s))', $parameterName);
22    }
23}