| Total Complexity | 15 |
| Total Lines | 85 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class TypeCertainty |
||
| 12 | { |
||
| 13 | const INDEX_FIRST_ARG = 1; |
||
| 14 | |||
| 15 | const BOOL_VAR_EXPORT_RETURN = true; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param mixed $maybe |
||
| 19 | */ |
||
| 20 | 364 | public static function EnsureArgumentIsArray($maybe, int $argument = null, string $method = __METHOD__) : array |
|
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @param mixed $maybe |
||
| 39 | */ |
||
| 40 | 24 | public static function ForceArgumentAsArray($maybe) : array |
|
| 41 | { |
||
| 42 | 24 | return is_array($maybe) ? $maybe : [$maybe]; |
|
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param mixed $maybe |
||
| 47 | */ |
||
| 48 | 8 | public static function VarExportNonScalars($maybe) : string |
|
| 49 | { |
||
| 50 | 8 | if (is_string($maybe)) { |
|
| 51 | 4 | return $maybe; |
|
| 52 | } |
||
| 53 | |||
| 54 | return |
||
| 55 | 8 | is_scalar($maybe) |
|
| 56 | 8 | ? (string) $maybe |
|
| 57 | 8 | : var_export($maybe, self::BOOL_VAR_EXPORT_RETURN); |
|
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param mixed $maybe |
||
| 62 | */ |
||
| 63 | 18 | public static function EnsureArgumentIsString($maybe) : string |
|
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @param mixed $maybe |
||
| 80 | * |
||
| 81 | * @return object|string |
||
| 82 | */ |
||
| 83 | 24 | public static function EnsureArgumentIsObjectOrString($maybe, int $argument, string $method) |
|
| 98 |