Merge pull request #221 from krizalys/fix-style

Fixed style
This commit is contained in:
Dominik Liebler
2016-06-16 15:06:14 +02:00
committed by GitHub
8 changed files with 12 additions and 20 deletions

View File

@@ -11,8 +11,6 @@ class BookList implements \Countable
if (isset($this->books[$bookNumberToGet])) { if (isset($this->books[$bookNumberToGet])) {
return $this->books[$bookNumberToGet]; return $this->books[$bookNumberToGet];
} }
return;
} }
public function addBook(Book $book) public function addBook(Book $book)

View File

@@ -2,9 +2,6 @@
namespace DesignPatterns\Behavioral\TemplateMethod; namespace DesignPatterns\Behavioral\TemplateMethod;
/**
*
*/
abstract class Journey abstract class Journey
{ {
/** /**

View File

@@ -2,9 +2,6 @@
namespace DesignPatterns\Creational\Builder; namespace DesignPatterns\Creational\Builder;
/**
*
*/
interface BuilderInterface interface BuilderInterface
{ {
/** /**

View File

@@ -34,7 +34,7 @@ class FacadeTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @param Computer $facade * @param Computer $facade
* @param OsInterface $os * @param OsInterface $os
* @dataProvider getComputer * @dataProvider getComputer
*/ */

View File

@@ -11,6 +11,7 @@ class CharacterFlyweight implements FlyweightInterface
/** /**
* Any state stored by the concrete flyweight must be independent of its context. * Any state stored by the concrete flyweight must be independent of its context.
* For flyweights representing characters, this is usually the corresponding character code. * For flyweights representing characters, this is usually the corresponding character code.
*
* @var string * @var string
*/ */
private $name; private $name;
@@ -25,7 +26,7 @@ class CharacterFlyweight implements FlyweightInterface
/** /**
* Clients supply the context-dependent information that the flyweight needs to draw itself * Clients supply the context-dependent information that the flyweight needs to draw itself
* For flyweights representing characters, extrinsic state usually contains e.g. the font * For flyweights representing characters, extrinsic state usually contains e.g. the font.
* *
* @param string $font * @param string $font
*/ */

View File

@@ -2,8 +2,6 @@
namespace DesignPatterns\Structural\Flyweight; namespace DesignPatterns\Structural\Flyweight;
use DesignPatterns\Structural\Flyweight\CharacterFlyweight;
/** /**
* A factory manages shared flyweights. Clients shouldn't instaniate them directly, * A factory manages shared flyweights. Clients shouldn't instaniate them directly,
* but let the factory take care of returning existing objects or creating new ones. * but let the factory take care of returning existing objects or creating new ones.
@@ -11,16 +9,17 @@ use DesignPatterns\Structural\Flyweight\CharacterFlyweight;
class FlyweightFactory class FlyweightFactory
{ {
/** /**
* Associative store for flyweight objects * Associative store for flyweight objects.
* *
* @var Array * @var array
*/ */
private $pool = array(); private $pool = array();
/** /**
* Magic getter * Magic getter.
* *
* @param string $name * @param string $name
*
* @return Flyweight * @return Flyweight
*/ */
public function __get($name) public function __get($name)
@@ -28,7 +27,7 @@ class FlyweightFactory
if (!array_key_exists($name, $this->pool)) { if (!array_key_exists($name, $this->pool)) {
$this->pool[$name] = new CharacterFlyweight($name); $this->pool[$name] = new CharacterFlyweight($name);
} }
return $this->pool[$name]; return $this->pool[$name];
} }

View File

@@ -3,7 +3,7 @@
namespace DesignPatterns\Structural\Flyweight; namespace DesignPatterns\Structural\Flyweight;
/** /**
* An interface through which flyweights can receive and act on extrinsic state * An interface through which flyweights can receive and act on extrinsic state.
*/ */
interface FlyweightInterface interface FlyweightInterface
{ {

View File

@@ -6,12 +6,12 @@ use DesignPatterns\Structural\Flyweight\FlyweightFactory;
/** /**
* FlyweightTest demonstrates how a client would use the flyweight structure * FlyweightTest demonstrates how a client would use the flyweight structure
* You don't have to change the code of your client * You don't have to change the code of your client.
*/ */
class FlyweightTest extends \PHPUnit_Framework_TestCase class FlyweightTest extends \PHPUnit_Framework_TestCase
{ {
private $characters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', private $characters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', );
private $fonts = array('Arial', 'Times New Roman', 'Verdana', 'Helvetica'); private $fonts = array('Arial', 'Times New Roman', 'Verdana', 'Helvetica');
// This is about the number of characters in a book of average length // This is about the number of characters in a book of average length
@@ -31,6 +31,6 @@ class FlyweightTest extends \PHPUnit_Framework_TestCase
// Flyweight pattern ensures that instances are shared // Flyweight pattern ensures that instances are shared
// instead of having hundreds of thousands of individual objects // instead of having hundreds of thousands of individual objects
$this->assertLessThanOrEqual($factory->totalNumber(), sizeof($this->characters)); $this->assertLessThanOrEqual($factory->totalNumber(), count($this->characters));
} }
} }