Completed
Pull Request — master (#47)
by Freek
04:15
created

InvalidFractalHelperArgument   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A secondArgumentMissing() 0 4 1
A tooManyArguments() 0 6 1
A invalidTransformer() 0 4 1
1
<?php
2
3
namespace Spatie\Fractal\Exceptions;
4
5
use InvalidArgumentException;
6
7
class InvalidFractalHelperArgument extends InvalidArgumentException
8
{
9
    public static function secondArgumentMissing()
10
    {
11
        return new static('The second argument should be a callable or extend `League\\Fractal\\TransformerAbstract`');
12
    }
13
14
    public static function tooManyArguments(array $arguments)
15
    {
16
        $argumentCount = count($arguments);
17
18
        return new static("You passed {$argumentCount} to `fractal()`. The maximum amount of arguments is 3.");
19
    }
20
21
    public static function invalidTransformer()
22
    {
23
        return new static('The second argument should be a callable or extend `League\\Fractal\\TransformerAbstract`');
24
    }
25
}
26