| Conditions | 5 |
| Paths | 12 |
| Total Lines | 34 |
| Code Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 18 | public static function dump( $var, $output = true ) { |
||
| 19 | |||
| 20 | $dumpers = [ |
||
| 21 | 'is_null' => 'dumpNull', |
||
| 22 | 'is_bool' => 'dumpBoolean', |
||
| 23 | 'is_integer' => 'dumpInteger', |
||
| 24 | 'is_float' => 'dumpFloat', |
||
| 25 | 'is_string' => 'dumpString', |
||
| 26 | 'is_array' => 'dumpArray', |
||
| 27 | 'is_object' => 'dumpObject', |
||
| 28 | 'is_resource' => 'dumpResource', |
||
| 29 | ]; |
||
| 30 | |||
| 31 | $item = false; |
||
| 32 | |||
| 33 | foreach( $dumpers as $test => $dumper ) { |
||
| 34 | if( $test($var) ) { |
||
| 35 | $item = static::$dumper($var); |
||
| 36 | break; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | if( !$item ) { |
||
| 41 | ob_start(); |
||
| 42 | var_dump($var); |
||
| 43 | $item = ob_get_clean(); |
||
| 44 | } |
||
| 45 | |||
| 46 | if( $output ) |
||
| 47 | static::output($item); |
||
| 48 | |||
| 49 | return $item; |
||
| 50 | |||
| 51 | } |
||
| 52 | |||
| 59 | // EOF |