mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-07 07:26:32 +02:00
Applied fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
3663603b80
commit
fe1f144ec3
@@ -3,7 +3,7 @@
|
||||
namespace DesignPatterns\Structural\Adapter;
|
||||
|
||||
/**
|
||||
* Book is a concrete and standard paper book
|
||||
* Book is a concrete and standard paper book.
|
||||
*/
|
||||
class Book implements PaperBookInterface
|
||||
{
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace DesignPatterns\Structural\Adapter;
|
||||
|
||||
/**
|
||||
* EBookAdapter is an adapter to fit an e-book like a paper book
|
||||
* EBookAdapter is an adapter to fit an e-book like a paper book.
|
||||
*
|
||||
* This is the adapter here. Notice it implements PaperBookInterface,
|
||||
* therefore you don't have to change the code of the client which using paper book.
|
||||
@@ -16,7 +16,7 @@ class EBookAdapter implements PaperBookInterface
|
||||
protected $eBook;
|
||||
|
||||
/**
|
||||
* Notice the constructor, it "wraps" an electronic book
|
||||
* Notice the constructor, it "wraps" an electronic book.
|
||||
*
|
||||
* @param EBookInterface $ebook
|
||||
*/
|
||||
@@ -26,7 +26,7 @@ class EBookAdapter implements PaperBookInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* This class makes the proper translation from one interface to another
|
||||
* This class makes the proper translation from one interface to another.
|
||||
*/
|
||||
public function open()
|
||||
{
|
||||
@@ -34,7 +34,7 @@ class EBookAdapter implements PaperBookInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* turns pages
|
||||
* turns pages.
|
||||
*/
|
||||
public function turnPage()
|
||||
{
|
||||
|
@@ -3,19 +3,19 @@
|
||||
namespace DesignPatterns\Structural\Adapter;
|
||||
|
||||
/**
|
||||
* EBookInterface is a contract for an electronic book
|
||||
* EBookInterface is a contract for an electronic book.
|
||||
*/
|
||||
interface EBookInterface
|
||||
{
|
||||
/**
|
||||
* go to next page
|
||||
* go to next page.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function pressNext();
|
||||
|
||||
/**
|
||||
* start the book
|
||||
* start the book.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace DesignPatterns\Structural\Adapter;
|
||||
|
||||
/**
|
||||
* Kindle is a concrete electronic book
|
||||
* Kindle is a concrete electronic book.
|
||||
*/
|
||||
class Kindle implements EBookInterface
|
||||
{
|
||||
|
@@ -3,19 +3,19 @@
|
||||
namespace DesignPatterns\Structural\Adapter;
|
||||
|
||||
/**
|
||||
* PaperBookInterface is a contract for a book
|
||||
* PaperBookInterface is a contract for a book.
|
||||
*/
|
||||
interface PaperBookInterface
|
||||
{
|
||||
/**
|
||||
* method to turn pages
|
||||
* method to turn pages.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function turnPage();
|
||||
|
||||
/**
|
||||
* method to open the book
|
||||
* method to open the book.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace DesignPatterns\Structural\Adapter\Tests;
|
||||
|
||||
use DesignPatterns\Structural\Adapter\Book;
|
||||
use DesignPatterns\Structural\Adapter\EBookAdapter;
|
||||
use DesignPatterns\Structural\Adapter\Kindle;
|
||||
use DesignPatterns\Structural\Adapter\PaperBookInterface;
|
||||
use DesignPatterns\Structural\Adapter\Book;
|
||||
|
||||
/**
|
||||
* AdapterTest shows the use of an adapted e-book that behave like a book
|
||||
* You don't have to change the code of your client
|
||||
* You don't have to change the code of your client.
|
||||
*/
|
||||
class AdapterTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@@ -21,13 +21,13 @@ class AdapterTest extends \PHPUnit_Framework_TestCase
|
||||
return array(
|
||||
array(new Book()),
|
||||
// we build a "wrapped" electronic book in the adapter
|
||||
array(new EBookAdapter(new Kindle()))
|
||||
array(new EBookAdapter(new Kindle())),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This client only knows paper book but surprise, surprise, the second book
|
||||
* is in fact an electronic book, but both work the same way
|
||||
* is in fact an electronic book, but both work the same way.
|
||||
*
|
||||
* @param PaperBookInterface $book
|
||||
*
|
||||
|
Reference in New Issue
Block a user