Skip to content

Instantly share code, notes, and snippets.

@mikemix
Created August 9, 2022 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikemix/c9c1bef2cee14bd9078ad7487f98d4dd to your computer and use it in GitHub Desktop.
Save mikemix/c9c1bef2cee14bd9078ad7487f98d4dd to your computer and use it in GitHub Desktop.
<?php
function mapOrderStatusToLabel(Order $order): string
{
$label = 'unknown';
if ('complete' === $order->getStatus()) {
$label = 'Completed';
}
if ('pending' === $order->getStatus()) {
$label = 'In transport';
}
if ('new' === $order->getStatus()) {
$label = 'New';
}
return $label';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment