Skip to content

Commit

Permalink
fix: Include '<?php' in PHP response code sample
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-balitskyi committed Nov 12, 2024
1 parent 37c894e commit bf24ac1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/code-sample/php.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ export const createPhpResponse = (
throw new Error(`Missing ${responseKey} for '${title}'`)
}

return Array.isArray(responseValue)
const formattedResponse = Array.isArray(responseValue)
? formatPhpArrayResponse(responseValue, title)
: formatPhpResponse(responseValue)

return `<?php\n${formattedResponse}`
}

const formatPhpArrayResponse = (
Expand Down

0 comments on commit bf24ac1

Please sign in to comment.