/** * Get Json Stub. * * @param Stub $stub * * @return array */ protected function getJsonStub(Stub $stub) { $jsonResponses = []; $jsonPredicates = []; /** @var Response $response */ foreach ($stub->getResponses() as $response) { $jsonResponses[] = $response->getJsonDefinition(); } /** @var Predicate $response */ foreach ($stub->getPredicates() as $predicate) { $jsonPredicates[] = $predicate->getJsonDefinition(); } return ['responses' => $jsonResponses, 'predicates' => $jsonPredicates]; }