-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
32 lines (26 loc) · 822 Bytes
/
Copy pathindex.php
File metadata and controls
32 lines (26 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
require_once "Book.php";
require_once "Library.php";
$library = new Library();
$author = $library->addAuthor('Jack London');
$author->addBook("Martin Eden", 55);
$author->addBook("The Game", 35);
$library->addBookForAuthor('Jack London', new Book("A Son of the Sun", 25));
$author2 = $library->addAuthor('Mark Twain');
$author2->addBook('The Adventures of Tom Sawyer', 65);
$author2->addBook('Luck', 12);
$book = $library->search('Martin Eden'); // This must return instance of the book
$author = $book->getAuthor(); // This must return instance of the Author class
echo $author->getName(); // This must print "Jack London"
$library->print();
/*
Jack London
--------------------
Martin Eden - 55
The Game - 35
A Son of the Sun - 25
Mark Twain
--------------------
The Adventures of Tom Sawyer - 65
Luck - 12
*/