| @@ 25-38 (lines=14) @@ | ||
| 22 | * @return CrudTable |
|
| 23 | * @throws InvalidArgumentException |
|
| 24 | */ |
|
| 25 | public static function table($crudable) |
|
| 26 | { |
|
| 27 | if (is_string($crudable)) |
|
| 28 | { |
|
| 29 | return new CrudTable(new $crudable); |
|
| 30 | } |
|
| 31 | ||
| 32 | if (is_object($crudable) && array_key_exists(Crudable::class, class_uses($crudable))) |
|
| 33 | { |
|
| 34 | return new CrudTable($crudable); |
|
| 35 | } |
|
| 36 | ||
| 37 | throw new InvalidArgumentException("Argument must be Crudable."); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @param string|Crudable $crudable |
|
| @@ 45-57 (lines=13) @@ | ||
| 42 | * @return CrudEntry |
|
| 43 | * @throws InvalidArgumentException |
|
| 44 | */ |
|
| 45 | public static function entry($crudable) |
|
| 46 | { |
|
| 47 | if (is_string($crudable)) |
|
| 48 | { |
|
| 49 | return new CrudEntry(new $crudable); |
|
| 50 | } |
|
| 51 | else if (is_object($crudable) && array_key_exists(Crudable::class, class_uses($crudable))) |
|
| 52 | { |
|
| 53 | return new CrudEntry($crudable); |
|
| 54 | } |
|
| 55 | ||
| 56 | throw new InvalidArgumentException("Argument must be Crudable."); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||