mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-19 05:01:15 +02:00
Behavioral\Iterator restructured
This commit is contained in:
32
Behavioral/Iterator/Book.php
Normal file
32
Behavioral/Iterator/Book.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user