Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active Dec 9, 2020
Embed
What would you like to do?
<?
final class Book {
private $cachedBooks;
public function getBooksFromDatabaseByTitle(string $title) {
if (isset($cachedBooks[$title])) {
return $cachedBooks[$title];
} else {
return $this->doGetBooksFromDatabaseByTitle($title);
}
}
private function doGetBooksFromDatabaseByTitle(string $title) {
globalDatabase()->selectFrom('Books', 'WHERE TITLE = ' . $title);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment