Completed
Push — master ( d1d08c...570c1f )
by Carsten
11:09 queued 05:42
created
src/SalesmanIdAwareInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,5 +10,5 @@
 block discarded – undo
10 10
      * @var     int|string $salesman_id
11 11
      * @return  self
12 12
      */
13
-    public function setSalesmanId( $id );
13
+    public function setSalesmanId($id);
14 14
 }
Please login to merge, or discard this patch.
src/SalesmanIdAwareTrait.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,8 +15,10 @@
 block discarded – undo
15 15
     {
16 16
         if ($salesman instanceOf SalesmanIdProviderInterface):
17 17
             $this->salesman_id = $salesman->getSalesmanId();
18
-        else:
18
+        else {
19
+            :
19 20
             $this->salesman_id = $salesman;
21
+        }
20 22
         endif;
21 23
 
22 24
         return $this;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      * @var     int|string|SalesmanIdProviderInterface $salesman
12 12
      * @return  self
13 13
      */
14
-    public function setSalesmanId( $salesman )
14
+    public function setSalesmanId($salesman)
15 15
     {
16 16
         if ($salesman instanceOf SalesmanIdProviderInterface):
17 17
             $this->salesman_id = $salesman->getSalesmanId();
Please login to merge, or discard this patch.
src/SalesmanAbstract.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function getFullName()
84 84
     {
85
-        return trim( join(" ", array_filter([
85
+        return trim(join(" ", array_filter([
86 86
             $this->getFirstName(),
87 87
             $this->getLastName()
88 88
         ])));
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function getDisplayName()
96 96
     {
97
-        return trim( join(" ∙ ", array_filter([
97
+        return trim(join(" ∙ ", array_filter([
98 98
             $this->getFullName(),
99 99
             $this->getSalesmanId()
100 100
         ])));
Please login to merge, or discard this patch.
src/ApplySalesman.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,8 +50,10 @@
 block discarded – undo
50 50
             $aggregator->salesman = $salesman_factory( $aggregator->salesman_id, $this->salesman_fallback );
51 51
 
52 52
         // Salesman can not be set
53
-        else:
53
+        else {
54
+            :
54 55
             return false;
56
+        }
55 57
         endif;
56 58
 
57 59
         return true;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * @param callable $salesman_factory Callable that takes a Salesman ID that should return a SalesmanInterface instance.
20 20
      */
21
-    public function __construct( callable $salesman_factory, SalesmanInterface $salesman_fallback = null )
21
+    public function __construct(callable $salesman_factory, SalesmanInterface $salesman_fallback = null)
22 22
     {
23 23
         $this->salesman_factory  = $salesman_factory;
24 24
         $this->salesman_fallback = $salesman_fallback;
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * @param  SalesmanIdProviderInterface|StdClass $aggregator Object that provides a salesman_id
30 30
      * @return bool
31 31
      */
32
-    public function __invoke( $aggregator )
32
+    public function __invoke($aggregator)
33 33
     {
34 34
 
35 35
 
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 
46 46
         // If salesman_id is available
47 47
         if ($aggregator instanceOf SalesmanIdProviderInterface):
48
-            $aggregator->salesman = $salesman_factory( $aggregator->getSalesmanId(), $this->salesman_fallback );
48
+            $aggregator->salesman = $salesman_factory($aggregator->getSalesmanId(), $this->salesman_fallback);
49 49
 
50 50
         elseif (isset($aggregator->salesman_id)):
51
-            $aggregator->salesman = $salesman_factory( $aggregator->salesman_id, $this->salesman_fallback );
51
+            $aggregator->salesman = $salesman_factory($aggregator->salesman_id, $this->salesman_fallback);
52 52
 
53 53
         // Salesman can not be set
54 54
         else:
Please login to merge, or discard this patch.
src/IteratorApplySalesman.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
      * @param SalesmanInterface $salesman_fallback Optional SalesmanInterface fallback instance
33 33
      * @param callable          $apply             Optional Callable that takes the current item on iteration.
34 34
      */
35
-    public function __construct( callable $salesman_factory, SalesmanInterface $salesman_fallback = null, callable $apply = null )
35
+    public function __construct(callable $salesman_factory, SalesmanInterface $salesman_fallback = null, callable $apply = null)
36 36
     {
37 37
         $this->salesman_factory = $salesman_factory;
38
-        $this->apply = $apply ?: new ApplySalesman( $salesman_factory, $salesman_fallback );
38
+        $this->apply = $apply ?: new ApplySalesman($salesman_factory, $salesman_fallback);
39 39
     }
40 40
 
41 41
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      *
45 45
      * @see  http://php.net/manual/de/function.iterator-apply.php
46 46
      */
47
-    public function __invoke( \Traversable $iterator )
47
+    public function __invoke(\Traversable $iterator)
48 48
     {
49 49
 
50 50
         $current = ($iterator instanceOf \IteratorAggregate)
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
         // Perform
55 55
         $apply = $this->apply;
56
-        $apply( $current );
56
+        $apply($current);
57 57
 
58 58
         // Must return true for iterator_apply
59 59
         return true;
Please login to merge, or discard this patch.
src/PdoAllSalesmen.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
 
72 72
 
73 73
     /**
74
-     * @return Iterator
74
+     * @return \ArrayIterator
75 75
      */
76 76
     public function getIterator()
77 77
     {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param string                 $table    The table name to use
34 34
      * @param SalesmanInterface|null $salesman Class or object template to work with
35 35
      */
36
-    public function __construct (\PDO $pdo, $table, SalesmanInterface $salesman = null)
36
+    public function __construct(\PDO $pdo, $table, SalesmanInterface $salesman = null)
37 37
     {
38 38
         $this->table    = $table;
39 39
         $this->pdo      = $pdo;
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
         aussendienst_vorname ASC,
60 60
         aussendienst_nummer ASC";
61 61
 
62
-        $this->stmt = $pdo->prepare( $sql );
62
+        $this->stmt = $pdo->prepare($sql);
63 63
 
64
-        $this->stmt->setFetchMode( \PDO::FETCH_CLASS, $this->php_salesman_class );
64
+        $this->stmt->setFetchMode(\PDO::FETCH_CLASS, $this->php_salesman_class);
65 65
 
66 66
         if (!$this->stmt->execute()):
67 67
             throw new SalesmanDatabaseException("PdoAllSalesmen: Could not execute SQL query");
68 68
         endif;
69 69
 
70
-        $this->salesmen = $this->stmt->fetchAll( \PDO::FETCH_UNIQUE);
70
+        $this->salesmen = $this->stmt->fetchAll(\PDO::FETCH_UNIQUE);
71 71
 
72 72
     }
73 73
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     /**
87 87
      * @implements ContainerInterface
88 88
      */
89
-    public function has ($aussendienst_nummer) {
89
+    public function has($aussendienst_nummer) {
90 90
         if ($aussendienst_nummer instanceOf SalesmanIdProviderInterface) {
91 91
             $aussendienst_nummer = $aussendienst_nummer->getSalesmanId();
92 92
         }
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
     /**
98 98
      * @implements ContainerInterface
99 99
      */
100
-    public function get ($aussendienst_nummer) {
100
+    public function get($aussendienst_nummer) {
101 101
         if ($aussendienst_nummer instanceOf SalesmanIdProviderInterface) {
102 102
             $aussendienst_nummer = $aussendienst_nummer->getSalesmanId();
103 103
         }
104 104
 
105 105
         if (!$this->has($aussendienst_nummer)) {
106 106
             $msg = sprintf("Could not find Salesman with ADM-Nummer '%s'", $aussendienst_nummer);
107
-            throw new SalesmanNotFoundException( $msg );
107
+            throw new SalesmanNotFoundException($msg);
108 108
         }
109 109
 
110 110
         return $this->salesmen[$aussendienst_nummer];
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function getIterator()
118 118
     {
119
-        return new \ArrayIterator( $this->salesmen );
119
+        return new \ArrayIterator($this->salesmen);
120 120
     }
121 121
 
122 122
 
@@ -125,6 +125,6 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function count()
127 127
     {
128
-        return count( $this->salesmen );
128
+        return count($this->salesmen);
129 129
     }
130 130
 }
Please login to merge, or discard this patch.
src/ActiveSalesmanFilterIterator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@
 block discarded – undo
13 13
      * @param \Traversable $collection      Collection of SalesmanIdProviderInterface
14 14
      * @param bool $active_flag
15 15
      */
16
-    public function __construct( \Traversable $collection, $active_flag = true )
16
+    public function __construct(\Traversable $collection, $active_flag = true)
17 17
     {
18 18
         // Take care of Traversable's two faces,
19 19
         // since both IteratorAggregate and Iterator implement Traversable
20
-        parent::__construct( $collection instanceOf \IteratorAggregate ? $collection->getIterator() : $collection );
20
+        parent::__construct($collection instanceOf \IteratorAggregate ? $collection->getIterator() : $collection);
21 21
     }
22 22
 
23 23
     public function accept()
Please login to merge, or discard this patch.
src/PdoActiveSalesmen.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 class PdoActiveSalesmen extends PdoAllSalesmen
5 5
 {
6 6
 
7
-    public function __construct (\PDO $pdo, $table, SalesmanInterface $salesman = null)
7
+    public function __construct(\PDO $pdo, $table, SalesmanInterface $salesman = null)
8 8
     {
9
-        parent::__construct( $pdo, $table, $salesman);
9
+        parent::__construct($pdo, $table, $salesman);
10 10
 
11
-        $filtered = new ActiveSalesmanFilterIterator( $this->getIterator(), true);
11
+        $filtered = new ActiveSalesmanFilterIterator($this->getIterator(), true);
12 12
 
13
-        $this->salesmen = iterator_to_array( $filtered );
13
+        $this->salesmen = iterator_to_array($filtered);
14 14
     }
15 15
 
16 16
 }
Please login to merge, or discard this patch.
src/SalesmanFilterIterator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      * @param \Traversable $collection      Collection of SalesmanIdProviderInterface
15 15
      * @param SalesmanIdProviderInterface|SalesmanIdProviderInterface[]|int    $salesman_filter The Salesman ID to filter for
16 16
      */
17
-    public function __construct( \Traversable $collection, $salesman_filter )
17
+    public function __construct(\Traversable $collection, $salesman_filter)
18 18
     {
19 19
         // Allow for getSalesmanId
20 20
         $this->salesman_filter = ($salesman_filter instanceOf SalesmanIdProviderInterface)
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 
24 24
         // Cast to array
25 25
         if (!is_array($this->salesman_filter)) {
26
-            $this->salesman_filter = array( $this->salesman_filter );
26
+            $this->salesman_filter = array($this->salesman_filter);
27 27
         }
28 28
 
29 29
         // Take care of Traversable's two faces,
30 30
         // since both IteratorAggregate and Iterator implement Traversable
31
-        parent::__construct( $collection instanceOf \IteratorAggregate ? $collection->getIterator() : $collection );
31
+        parent::__construct($collection instanceOf \IteratorAggregate ? $collection->getIterator() : $collection);
32 32
 
33 33
     }
34 34
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         // Cast to array
46 46
         $item_salesman_id = $item->getSalesmanId();
47 47
         if (!is_array($item_salesman_id)) {
48
-            $item_salesman_id = array( $item_salesman_id );
48
+            $item_salesman_id = array($item_salesman_id);
49 49
         }
50 50
 
51 51
         // Check intersection
Please login to merge, or discard this patch.