Sanpi\Behatch\Json\Json::getContent PHP Method

getContent() public method

public getContent ( )
    public function getContent()
    {
        return $this->content;
    }

Usage Example

コード例 #1
0
ファイル: JsonSchema.php プロジェクト: GabrielCW/contexts
 public function validate(Json $json, Validator $validator)
 {
     $validator->check($json->getContent(), $this->getContent());
     if (!$validator->isValid()) {
         $msg = "JSON does not validate. Violations:" . PHP_EOL;
         foreach ($validator->getErrors() as $error) {
             $msg .= sprintf("  - [%s] %s" . PHP_EOL, $error['property'], $error['message']);
         }
         throw new \Exception($msg);
     }
     return true;
 }