<?php

class Library
{
    private $items = [];

    public function addInventory(IItem $item)
    {
        $this->items[] = $item;
    }
}
interface IItem
{
    public function getTitle();
}
class Hardback implements IItem
{
    private $title = null;
    private $author = null;
    public function __construct($title, $author)
    {
    	$this->title = $title;
    	$this->author = $author;
    	echo "New Title added for Hardback\r\n";
    }
    public function getTitle()
    {
    	return $thi->title;
    }
    
}


class Softback implements IItem
{
    
    private $title = null;
    private $author = null;
    public function __construct($title, $author)
    {
    	$this->title = $title;
    	$this->author = $author;
    	echo "New Title added for Softback\r\n";
    }
    public function getTitle()
    {
    	return $thi->title;
    }
}

class Movie implements IItem
{
	private $title = null;
    private $length = null;
    
    public function __construct($title, $length)
    {
    	$this->title = $title;
    	$this->lenght = $length;
    	echo "New Movie Title added\r\n";
    }
    public function getTitle()
    {
    	return $thi->title;
    }
	
}

$library = new Library();
$inventoryItems = [
	new Hardback('Wind in the Willows (hb)', "Someone"),
	new Softback('Wind in the Willows (sb)', "Someone"),
	new Softback('Things that go bump (sb)', "Someone else"),
	new Movie('Max Payne', "120 min"),
	];

foreach ($inventoryItems as $material) {
  $library->addInventory($material);
}
