Completed
Push — master ( 8f9ab3...35f646 )
by Jinyun
02:26
created
src/Behavioral/Strategy/IdentifyComparator.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 
5 5
 namespace DesignPattern\Behavioral\Strategy;
6 6
 
7
-class IdentifyComparator implements ComparatorInterface
8
-{
7
+class IdentifyComparator implements ComparatorInterface
8
+{
9 9
     /**
10 10
      * Compare the two given id values.
11 11
      *
Please login to merge, or discard this patch.
src/Behavioral/Strategy/Collection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      */
35 35
     public function sort(): array
36 36
     {
37
-        if (! $this->comparator) {
37
+        if ( ! $this->comparator) {
38 38
             throw new \LogicException('Comparator is not set.');
39 39
         }
40 40
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 
5 5
 namespace DesignPattern\Behavioral\Strategy;
6 6
 
7
-class Collection
8
-{
7
+class Collection
8
+{
9 9
     /**
10 10
      * @var array
11 11
      */
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
      *
22 22
      * @param array $elements
23 23
      */
24
-    public function __construct(array $elements = [])
25
-    {
24
+    public function __construct(array $elements = [])
25
+    {
26 26
         $this->elements = $elements;
27 27
     }
28 28
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function sort(): array
36 36
     {
37
-        if (! $this->comparator) {
37
+        if (! $this->comparator) {
38 38
             throw new \LogicException('Comparator is not set.');
39 39
         }
40 40
 
Please login to merge, or discard this patch.
src/Behavioral/Strategy/DateComparator.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 
5 5
 namespace DesignPattern\Behavioral\Strategy;
6 6
 
7
-class DateComparator implements ComparatorInterface
8
-{
7
+class DateComparator implements ComparatorInterface
8
+{
9 9
     /**
10 10
      * Compare the two given date values.
11 11
      *
Please login to merge, or discard this patch.
src/Behavioral/Iterator/Item.php 1 patch
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace DesignPattern\Behavioral\Iterator;
4 4
 
5
-class Item
6
-{
5
+class Item
6
+{
7 7
     /**
8 8
      * @var int
9 9
      */
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
      * @param int $id
21 21
      * @param string $name
22 22
      */
23
-    public function __construct(int $id, string $name)
24
-    {
23
+    public function __construct(int $id, string $name)
24
+    {
25 25
         $this->id = $id;
26 26
         $this->name = $name;
27 27
     }
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
     /**
46 46
      * @return string
47 47
      */
48
-    public function __toString()
49
-    {
48
+    public function __toString()
49
+    {
50 50
         return "$this->id - $this->name";
51 51
     }
52 52
 }
Please login to merge, or discard this patch.
src/Behavioral/Iterator/ItemList.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
      */
47 47
     public function addItem(Item $item): void
48 48
     {
49
-        if (! in_array($item, $this->list, true)) {
49
+        if ( ! in_array($item, $this->list, true)) {
50 50
             $this->list[] = $item;
51 51
         }
52 52
     }
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace DesignPattern\Behavioral\Iterator;
4 4
 
5
-class ItemList implements \Countable
6
-{
5
+class ItemList implements \Countable
6
+{
7 7
     /**
8 8
      * @var array|\DesignPattern\Behavioral\Iterator\Item[]
9 9
      */
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
     /**
13 13
      * ItemList constructor.
14 14
      */
15
-    public function __construct()
16
-    {
15
+    public function __construct()
16
+    {
17 17
         $this->list = [];
18 18
     }
19 19
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function getItem(int $id): ?Item
36 36
     {
37
-        if ($id < $this->count()) {
37
+        if ($id < $this->count()) {
38 38
             return $this->list[$id];
39 39
         }
40 40
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function addItem(Item $item): void
48 48
     {
49
-        if (! in_array($item, $this->list, true)) {
49
+        if (! in_array($item, $this->list, true)) {
50 50
             $this->list[] = $item;
51 51
         }
52 52
     }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $id = array_search($item, $this->list, true);
60 60
 
61
-        if ($id !== false) {
61
+        if ($id !== false) {
62 62
             unset($this->list[$id]);
63 63
         }
64 64
     }
Please login to merge, or discard this patch.
src/Behavioral/Iterator/ItemIterator.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace DesignPattern\Behavioral\Iterator;
4 4
 
5
-class ItemIterator implements \Iterator
6
-{
5
+class ItemIterator implements \Iterator
6
+{
7 7
     /**
8 8
      * @var \DesignPattern\Behavioral\Iterator\ItemList
9 9
      */
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
      *
20 20
      * @param \DesignPattern\Behavioral\Iterator\ItemList $list
21 21
      */
22
-    public function __construct(ItemList $list)
23
-    {
22
+    public function __construct(ItemList $list)
23
+    {
24 24
         $this->list = $list;
25 25
         $this->index = 0;
26 26
     }
Please login to merge, or discard this patch.
src/Behavioral/Command/Console.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace DesignPattern\Behavioral\Command;
4 4
 
5
-class Console
6
-{
5
+class Console
6
+{
7 7
     /**
8 8
      * @var \DesignPattern\Behavioral\Command\CommandInterface
9 9
      */
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @param \DesignPattern\Behavioral\Command\CommandInterface $command
16 16
      */
17
-    public function __construct(CommandInterface $command)
18
-    {
17
+    public function __construct(CommandInterface $command)
18
+    {
19 19
         $this->command = $command;
20 20
     }
21 21
 
Please login to merge, or discard this patch.
src/Behavioral/Command/ShutdownCommand.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace DesignPattern\Behavioral\Command;
4 4
 
5
-class ShutdownCommand implements CommandInterface
6
-{
5
+class ShutdownCommand implements CommandInterface
6
+{
7 7
     /**
8 8
      * @var \DesignPattern\Behavioral\Command\Computer
9 9
      */
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @param \DesignPattern\Behavioral\Command\Computer $computer
16 16
      */
17
-    public function __construct(Computer $computer)
18
-    {
17
+    public function __construct(Computer $computer)
18
+    {
19 19
         $this->computer = $computer;
20 20
     }
21 21
 
Please login to merge, or discard this patch.
src/Behavioral/Command/StartupCommand.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace DesignPattern\Behavioral\Command;
4 4
 
5
-class StartupCommand implements CommandInterface
6
-{
5
+class StartupCommand implements CommandInterface
6
+{
7 7
     /**
8 8
      * @var \DesignPattern\Behavioral\Command\Computer
9 9
      */
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @param \DesignPattern\Behavioral\Command\Computer $computer
16 16
      */
17
-    public function __construct(Computer $computer)
18
-    {
17
+    public function __construct(Computer $computer)
18
+    {
19 19
         $this->computer = $computer;
20 20
     }
21 21
 
Please login to merge, or discard this patch.