示例#1
0
文件: JsonTest.php 项目: ivoba/stop
 public function testGetType()
 {
     $Stop = new \Stop\Dumper\Json($hide = false, $continue = false, $return = true, \Stop\Dumper\AbstractDumper::FORMAT_JSON);
     $output = $Stop->get_type($Stop);
     $this->assertContains('StopType!', $output);
     $this->assertContains('"Class":"Stop\\\\Dumper\\\\Json', $output);
     $this->assertContains('Stop\\\\Dumper\\\\DumperInterface', $output);
     $this->assertContains('Stop\\/Tests\\/JsonTest.php', $output, 'File is found');
     $output = $Stop->get_type(array(1, 2, 3, 4));
     $this->assertContains('StopType!', $output);
     $this->assertContains('"Type":"array"', $output);
     $this->assertContains('"Count":4', $output);
     $output = $Stop->get_type($str = "asdasdasd asdasdasd");
     $this->assertContains('StopType!', $output);
     $this->assertContains('"Type":"string"', $output);
     $this->assertContains('"Length":19', $output);
 }
示例#2
0
文件: Stop.php 项目: ivoba/stop
 /**
  * dump a variable as json
  *
  * @param $var
  * @param bool $continue
  * @param bool $hide
  * @param bool $return
  */
 public static function json($var, $continue = false, $hide = false, $return = false)
 {
     $Stop = new \Stop\Dumper\Json($hide, $continue, $return, Dumper\AbstractDumper::FORMAT_JSON);
     $Stop->var_dump($var);
 }