private function serializeIfNeeded($response) { if ($this->shouldSerialize(1)) { return serialize($response); } return $response; }