Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | public static function forSrc($src) |
||
10 | { |
||
11 | if (is_string($src)) { |
||
12 | $srcName = $src; |
||
13 | } elseif (is_object($src)) { |
||
14 | $srcName = get_class($src) . ' instance'; |
||
15 | } else { |
||
16 | $srcName = gettype($src); |
||
17 | } |
||
18 | return new static( |
||
19 | 'Invalid data source, EloquentDataProvider constructor should be used with' |
||
20 | . ' Illuminate\Database\Eloquent\Builder instance' |
||
21 | . ' or Illuminate\Database\Query\Builder instance' |
||
22 | . ' or class name of target Eloquent model' |
||
23 | . "($srcName given)." |
||
24 | ); |
||
25 | } |
||
26 | } |
||
27 |