| Conditions | 7 |
| Paths | 26 |
| Total Lines | 29 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public static function closure_dump(\Closure $c) { |
||
| 36 | $str = 'function ('; |
||
| 37 | $r = new \ReflectionFunction($c); |
||
| 38 | $params = array(); |
||
| 39 | foreach($r->getParameters() as $p) { |
||
| 40 | $s = ''; |
||
| 41 | if($p->isArray()) { |
||
| 42 | $s .= 'array '; |
||
| 43 | } else if($p->getClass()) { |
||
| 44 | $s .= $p->getClass()->name . ' '; |
||
| 45 | } |
||
| 46 | if($p->isPassedByReference()){ |
||
| 47 | $s .= '&'; |
||
| 48 | } |
||
| 49 | $s .= '$' . $p->name; |
||
| 50 | if($p->isOptional()) { |
||
| 51 | $s .= ' = ' . \var_export($p->getDefaultValue(), TRUE); |
||
| 52 | } |
||
| 53 | $params []= $s; |
||
| 54 | } |
||
| 55 | $str .= \implode(', ', $params); |
||
| 56 | $str .= '){' . PHP_EOL; |
||
| 57 | $lines = file($r->getFileName()); |
||
| 58 | $sLine=$r->getStartLine();$eLine=$r->getEndLine(); |
||
| 59 | for($l = $sLine; $l < $eLine; $l++) { |
||
| 60 | $str .= $lines[$l]; |
||
| 61 | } |
||
| 62 | return $str; |
||
| 63 | } |
||
| 64 | } |
||
| 65 |