public function visitBook(Book $book) { $price = $book->getPrice(); // implement $5 discount if ($price > 20) { $price -= 5; } return $price; }