<?php
namespace Animals;

require_once 'Dog.php';

// Dog and DogWriter are both part of the \Main\Product namespace
// so new "use" statement is required.

// Single Responsibility Principle
// Let the Dog class just look after the attributes of a dog.
// Create a second class DogWriter to print out the dog details
//
class DogWriter
{
	// Attributes
	private $_dog;
	
	// Constructor
	// Type hint, for class methods allow you to specify
	// the class of object that the method requires.
	// WILL NOT WORK for primitive types, only objects
	// and arrays.
	// Also only checked at runtime, so could crash
	// if never tested.
	public function __construct(Dog $dog)
	{
		$this->_dog = $dog;	
	}
	
	// Methods for properties
	// NONE
	
	// Methods
	
	// Method for outputing dog details
	public function Write()
	{
		// Use curly brackets to parse code together
		echo "Dog details: name={$this->_dog->Name}<br/>";
	}
}
?>