A blind person could have formatted that code better.
On top of that, there are several other problems:
sometimes the samples have a PHP closing tag (?>)... which is totally pointless and increases the risk of bugs with trailing space
dependencies are loaded in the end of the samples... it is common practice to have require "<the autoloader>"; at the beginning
Exceptions are handled badly, by printing the exception message only - totally missing the stacktrace, which is sometimes even more important than just the message. Additionally, I don't know why it needs to handle exceptions in the first place - unhandled exceptions are always printed out.
The samples are using a mixture of old non-namespaced classes, and newer ones...please decide and keep it consistent.
But the formatting is the biggest problem.. I'm already having a hard time jumping between browser tabs trying to figure out things from references, guides, stackoverflow and so on. Having to go through unreadable code on top feels unnecessary.
Let's take a look at this one: https://github.com/googleworkspace/php-samples/blob/main/sheets/snippets/src/SpreadsheetBatchUpdate.php
A blind person could have formatted that code better.
On top of that, there are several other problems:
?>
)... which is totally pointless and increases the risk of bugs with trailing spacerequire "<the autoloader>";
at the beginningBut the formatting is the biggest problem.. I'm already having a hard time jumping between browser tabs trying to figure out things from references, guides, stackoverflow and so on. Having to go through unreadable code on top feels unnecessary.