Issues (215)

Exceptions/Validation/BelowMinimumException.php (7 issues)

1
<?php
2
3
namespace GloBee\PaymentApi\Exceptions\Validation;
4
5
class BelowMinimumException extends ValidationException
6
{
7
    private $minimum;
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
8
9
    /**
10
     * BelowMinimumException constructor.
11
     *
12
     * @param string $field
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
13
     * @param mixed  $value
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
14
     * @param int    $minimum
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Expected "integer" but found "int" for parameter type
Loading history...
15
     */
16 3
    public function __construct($field, $value, $minimum)
0 ignored issues
show
Type hint "string" missing for $field
Loading history...
Type hint "int" missing for $minimum
Loading history...
17
    {
18 3
        $this->minimum = $minimum;
19 3
        $message = sprintf('The %s must be at least %.2f', $field, $minimum);
20
        $error = [
21 3
            'type' => 'below_minimum',
22 3
            'extra' => [$minimum],
23 3
            'field' => $field,
24 3
            'message' => $message,
25
        ];
26 3
        parent::__construct([$error], $message);
27 3
    }
28
29
    /**
30
     * @return mixed
31
     */
32 1
    public function getMinimum()
33
    {
34 1
        return $this->minimum;
35
    }
36
}
37