Skip to content

Instantly share code, notes, and snippets.

@toleabivol
Created February 17, 2018 08:40
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 toleabivol/7017c266003a6cd96ecf5f194549193c to your computer and use it in GitHub Desktop.
Save toleabivol/7017c266003a6cd96ecf5f194549193c to your computer and use it in GitHub Desktop.
try catch
try {
file_put_contents( 'orderProcessLog', @file_get_contents( 'orderProcessLog' ) . implode( "\n", $lineWithoutDebugInfo ?? [ $result ] ) );
if ( $order->isValid() ) {
file_put_contents( 'result', @file_get_contents( 'result' ) . $order->getOrderId() . '-' . implode( ',', $order->getItems() ) . '-' . $order->getDeliveryDetails() . '-' . ( $order->isManual() ? 1 : 0 ) . '-' . $order->getTotalAmount() . '-' . $order->getName() . "\n" );
}
} catch ( \Exception $e ) {
echo "Error writing to file. Please check permissions.";
echo "Error Message:" . $e->getMessage();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment