mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 20:20:15 +02:00
Applied fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
3663603b80
commit
fe1f144ec3
@@ -4,7 +4,6 @@ namespace DesignPatterns\Behavioral\Iterator;
|
||||
|
||||
class Book
|
||||
{
|
||||
|
||||
private $author;
|
||||
|
||||
private $title;
|
||||
@@ -27,6 +26,6 @@ class Book
|
||||
|
||||
public function getAuthorAndTitle()
|
||||
{
|
||||
return $this->getTitle() . ' by ' . $this->getAuthor();
|
||||
return $this->getTitle().' by '.$this->getAuthor();
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@ namespace DesignPatterns\Behavioral\Iterator;
|
||||
|
||||
class BookList implements \Countable
|
||||
{
|
||||
|
||||
private $books;
|
||||
|
||||
public function getBook($bookNumberToGet)
|
||||
@@ -13,7 +12,7 @@ class BookList implements \Countable
|
||||
return $this->books[$bookNumberToGet];
|
||||
}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
public function addBook(Book $book)
|
||||
|
@@ -4,7 +4,6 @@ namespace DesignPatterns\Behavioral\Iterator;
|
||||
|
||||
class BookListIterator implements \Iterator
|
||||
{
|
||||
|
||||
/**
|
||||
* @var BookList
|
||||
*/
|
||||
@@ -21,8 +20,10 @@ class BookListIterator implements \Iterator
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current book
|
||||
* Return the current book.
|
||||
*
|
||||
* @link http://php.net/manual/en/iterator.current.php
|
||||
*
|
||||
* @return Book Can return any type.
|
||||
*/
|
||||
public function current()
|
||||
@@ -32,8 +33,10 @@ class BookListIterator implements \Iterator
|
||||
|
||||
/**
|
||||
* (PHP 5 >= 5.0.0)<br/>
|
||||
* Move forward to next element
|
||||
* Move forward to next element.
|
||||
*
|
||||
* @link http://php.net/manual/en/iterator.next.php
|
||||
*
|
||||
* @return void Any returned value is ignored.
|
||||
*/
|
||||
public function next()
|
||||
@@ -43,8 +46,10 @@ class BookListIterator implements \Iterator
|
||||
|
||||
/**
|
||||
* (PHP 5 >= 5.0.0)<br/>
|
||||
* Return the key of the current element
|
||||
* Return the key of the current element.
|
||||
*
|
||||
* @link http://php.net/manual/en/iterator.key.php
|
||||
*
|
||||
* @return mixed scalar on success, or null on failure.
|
||||
*/
|
||||
public function key()
|
||||
@@ -54,10 +59,12 @@ class BookListIterator implements \Iterator
|
||||
|
||||
/**
|
||||
* (PHP 5 >= 5.0.0)<br/>
|
||||
* Checks if current position is valid
|
||||
* Checks if current position is valid.
|
||||
*
|
||||
* @link http://php.net/manual/en/iterator.valid.php
|
||||
* @return boolean The return value will be casted to boolean and then evaluated.
|
||||
* Returns true on success or false on failure.
|
||||
*
|
||||
* @return bool The return value will be casted to boolean and then evaluated.
|
||||
* Returns true on success or false on failure.
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
@@ -66,8 +73,10 @@ class BookListIterator implements \Iterator
|
||||
|
||||
/**
|
||||
* (PHP 5 >= 5.0.0)<br/>
|
||||
* Rewind the Iterator to the first element
|
||||
* Rewind the Iterator to the first element.
|
||||
*
|
||||
* @link http://php.net/manual/en/iterator.rewind.php
|
||||
*
|
||||
* @return void Any returned value is ignored.
|
||||
*/
|
||||
public function rewind()
|
||||
|
@@ -4,7 +4,6 @@ namespace DesignPatterns\Behavioral\Iterator;
|
||||
|
||||
class BookListReverseIterator implements \Iterator
|
||||
{
|
||||
|
||||
/**
|
||||
* @var BookList
|
||||
*/
|
||||
@@ -22,8 +21,10 @@ class BookListReverseIterator implements \Iterator
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current book
|
||||
* Return the current book.
|
||||
*
|
||||
* @link http://php.net/manual/en/iterator.current.php
|
||||
*
|
||||
* @return Book Can return any type.
|
||||
*/
|
||||
public function current()
|
||||
@@ -33,8 +34,10 @@ class BookListReverseIterator implements \Iterator
|
||||
|
||||
/**
|
||||
* (PHP 5 >= 5.0.0)<br/>
|
||||
* Move forward to next element
|
||||
* Move forward to next element.
|
||||
*
|
||||
* @link http://php.net/manual/en/iterator.next.php
|
||||
*
|
||||
* @return void Any returned value is ignored.
|
||||
*/
|
||||
public function next()
|
||||
@@ -44,8 +47,10 @@ class BookListReverseIterator implements \Iterator
|
||||
|
||||
/**
|
||||
* (PHP 5 >= 5.0.0)<br/>
|
||||
* Return the key of the current element
|
||||
* Return the key of the current element.
|
||||
*
|
||||
* @link http://php.net/manual/en/iterator.key.php
|
||||
*
|
||||
* @return mixed scalar on success, or null on failure.
|
||||
*/
|
||||
public function key()
|
||||
@@ -55,10 +60,12 @@ class BookListReverseIterator implements \Iterator
|
||||
|
||||
/**
|
||||
* (PHP 5 >= 5.0.0)<br/>
|
||||
* Checks if current position is valid
|
||||
* Checks if current position is valid.
|
||||
*
|
||||
* @link http://php.net/manual/en/iterator.valid.php
|
||||
* @return boolean The return value will be casted to boolean and then evaluated.
|
||||
* Returns true on success or false on failure.
|
||||
*
|
||||
* @return bool The return value will be casted to boolean and then evaluated.
|
||||
* Returns true on success or false on failure.
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
@@ -67,8 +74,10 @@ class BookListReverseIterator implements \Iterator
|
||||
|
||||
/**
|
||||
* (PHP 5 >= 5.0.0)<br/>
|
||||
* Rewind the Iterator to the first element
|
||||
* Rewind the Iterator to the first element.
|
||||
*
|
||||
* @link http://php.net/manual/en/iterator.rewind.php
|
||||
*
|
||||
* @return void Any returned value is ignored.
|
||||
*/
|
||||
public function rewind()
|
||||
|
@@ -9,7 +9,6 @@ use DesignPatterns\Behavioral\Iterator\BookListReverseIterator;
|
||||
|
||||
class IteratorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var BookList
|
||||
*/
|
||||
@@ -30,8 +29,8 @@ class IteratorTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
'Learning PHP Design Patterns by William Sanders',
|
||||
'Professional Php Design Patterns by Aaron Saray',
|
||||
'Clean Code by Robert C. Martin'
|
||||
)
|
||||
'Clean Code by Robert C. Martin',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -65,7 +64,7 @@ class IteratorTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test BookList Remove
|
||||
* Test BookList Remove.
|
||||
*/
|
||||
public function testBookRemove()
|
||||
{
|
||||
|
Reference in New Issue
Block a user