mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-02-24 09:42:24 +01:00
33 lines
503 B
PHP
33 lines
503 B
PHP
<?php
|
|
|
|
namespace DesignPatterns\Behavioral\Iterator;
|
|
|
|
class Book
|
|
{
|
|
|
|
private $author;
|
|
|
|
private $title;
|
|
|
|
public function __construct($title, $author)
|
|
{
|
|
$this->author = $author;
|
|
$this->title = $title;
|
|
}
|
|
|
|
public function getAuthor()
|
|
{
|
|
return $this->author;
|
|
}
|
|
|
|
public function getTitle()
|
|
{
|
|
return $this->title;
|
|
}
|
|
|
|
public function getAuthorAndTitle()
|
|
{
|
|
return $this->getTitle() . ' by ' . $this->getAuthor();
|
|
}
|
|
}
|