Skip to content

Commit 9ef1f8b

Browse files
author
Dominik Liebler
authored
Merge pull request DesignPatternsPHP#221 from krizalys/fix-style
Fixed style
2 parents 76db181 + c8e0c74 commit 9ef1f8b

File tree

8 files changed

+12
-20
lines changed

8 files changed

+12
-20
lines changed

Behavioral/Iterator/BookList.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ public function getBook($bookNumberToGet)
1111
if (isset($this->books[$bookNumberToGet])) {
1212
return $this->books[$bookNumberToGet];
1313
}
14-
15-
return;
1614
}
1715

1816
public function addBook(Book $book)

Behavioral/TemplateMethod/Journey.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
namespace DesignPatterns\Behavioral\TemplateMethod;
44

5-
/**
6-
*
7-
*/
85
abstract class Journey
96
{
107
/**

Creational/Builder/BuilderInterface.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
namespace DesignPatterns\Creational\Builder;
44

5-
/**
6-
*
7-
*/
85
interface BuilderInterface
96
{
107
/**

Structural/Facade/Tests/FacadeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function getComputer()
3434
}
3535

3636
/**
37-
* @param Computer $facade
37+
* @param Computer $facade
3838
* @param OsInterface $os
3939
* @dataProvider getComputer
4040
*/

Structural/Flyweight/CharacterFlyweight.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class CharacterFlyweight implements FlyweightInterface
1111
/**
1212
* Any state stored by the concrete flyweight must be independent of its context.
1313
* For flyweights representing characters, this is usually the corresponding character code.
14+
*
1415
* @var string
1516
*/
1617
private $name;
@@ -25,7 +26,7 @@ public function __construct($name)
2526

2627
/**
2728
* Clients supply the context-dependent information that the flyweight needs to draw itself
28-
* For flyweights representing characters, extrinsic state usually contains e.g. the font
29+
* For flyweights representing characters, extrinsic state usually contains e.g. the font.
2930
*
3031
* @param string $font
3132
*/

Structural/Flyweight/FlyweightFactory.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,32 @@
22

33
namespace DesignPatterns\Structural\Flyweight;
44

5-
use DesignPatterns\Structural\Flyweight\CharacterFlyweight;
6-
75
/**
86
* A factory manages shared flyweights. Clients shouldn't instaniate them directly,
97
* but let the factory take care of returning existing objects or creating new ones.
108
*/
119
class FlyweightFactory
1210
{
1311
/**
14-
* Associative store for flyweight objects
12+
* Associative store for flyweight objects.
1513
*
16-
* @var Array
14+
* @var array
1715
*/
1816
private $pool = array();
1917

2018
/**
21-
* Magic getter
19+
* Magic getter.
2220
*
2321
* @param string $name
22+
*
2423
* @return Flyweight
2524
*/
2625
public function __get($name)
2726
{
2827
if (!array_key_exists($name, $this->pool)) {
2928
$this->pool[$name] = new CharacterFlyweight($name);
3029
}
31-
30+
3231
return $this->pool[$name];
3332
}
3433

Structural/Flyweight/FlyweightInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace DesignPatterns\Structural\Flyweight;
44

55
/**
6-
* An interface through which flyweights can receive and act on extrinsic state
6+
* An interface through which flyweights can receive and act on extrinsic state.
77
*/
88
interface FlyweightInterface
99
{

Structural/Flyweight/Tests/FlyweightTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
/**
88
* FlyweightTest demonstrates how a client would use the flyweight structure
9-
* You don't have to change the code of your client
9+
* You don't have to change the code of your client.
1010
*/
1111
class FlyweightTest extends \PHPUnit_Framework_TestCase
1212
{
1313
private $characters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
14-
'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
14+
'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', );
1515
private $fonts = array('Arial', 'Times New Roman', 'Verdana', 'Helvetica');
1616

1717
// This is about the number of characters in a book of average length
@@ -31,6 +31,6 @@ public function testFlyweight()
3131

3232
// Flyweight pattern ensures that instances are shared
3333
// instead of having hundreds of thousands of individual objects
34-
$this->assertLessThanOrEqual($factory->totalNumber(), sizeof($this->characters));
34+
$this->assertLessThanOrEqual($factory->totalNumber(), count($this->characters));
3535
}
3636
}

0 commit comments

Comments
 (0)