Esempio n. 1
0
 public function testGet()
 {
     foreach ($this->samples as $value) {
         $json = new Json(json_encode($value));
         $this->assertSame($value, $json->get());
         $this->assertSame(json_encode($value), (string) $json);
         $this->assertSame(json_encode($value, JSON_PRETTY_PRINT), $json->getPretty());
     }
 }
Esempio n. 2
0
 public function getResolverBlock()
 {
     // strategy 1. Use resolver block.
     if (preg_match(self::V2_RESOLVER_BLOCK_REGEX, $this->sql, $matches)) {
         try {
             $json = new Json($matches[1]);
             $get = $json->get();
         } catch (BadJsonException $e) {
             throw new BadSqlResolverBlock($this, $matches[0]);
         }
         return $get;
     }
     throw new \Exception("You need a docblock comment for asset '{$this->id}'");
 }