Beispiel #1
0
 /**
  * Static factory method.
  *
  * @param mixed $options If a number is used, it is the maximum depth.
  */
 public static function D($value, $options = array())
 {
     if (is_numeric($options)) {
         $options = array('depth' => $options);
     } elseif (empty($options)) {
         $options = array();
     }
     $plop = new Dumpling($options);
     return $plop->dump($value);
 }
Beispiel #2
0
    /**
     * @test
     */
    public function should_dump_a_closure()
    {
        if (true && ($fn = function (&$a, $b = 0) {
            // MATH!
            return $a + 1;
        })) {
        }
        $actual = Dumpling::D($fn, 2);
        $expected = <<<EOD
EOD;
        $this->assertEquals('Closure (&$a, $b) { ... }', $actual);
    }