@@ -10,5 +10,5 @@ |
||
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 | } |
@@ -15,8 +15,10 @@ |
||
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; |
@@ -11,7 +11,7 @@ |
||
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(); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @param \Traversable $collection Collection of SalesmanIdProviderInterface |
15 | 15 | * @param array|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 |
||
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 |
||
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 |
@@ -71,7 +71,7 @@ |
||
71 | 71 | |
72 | 72 | |
73 | 73 | /** |
74 | - * @return Iterator |
|
74 | + * @return \ArrayIterator |
|
75 | 75 | */ |
76 | 76 | public function getIterator() |
77 | 77 | { |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | public $salesmen = array(); |
16 | 16 | |
17 | - public function __construct (\PDO $pdo, $table, SalesmanInterface $salesman = null) |
|
17 | + public function __construct(\PDO $pdo, $table, SalesmanInterface $salesman = null) |
|
18 | 18 | { |
19 | 19 | $this->table = $table; |
20 | 20 | $this->pdo = $pdo; |
@@ -39,20 +39,20 @@ discard block |
||
39 | 39 | aussendienst_vorname ASC, |
40 | 40 | aussendienst_nummer ASC"; |
41 | 41 | |
42 | - $this->stmt = $pdo->prepare( $sql ); |
|
42 | + $this->stmt = $pdo->prepare($sql); |
|
43 | 43 | |
44 | - $this->stmt->setFetchMode( \PDO::FETCH_CLASS, $salesman ? get_class($salesman) : Salesman::class ); |
|
44 | + $this->stmt->setFetchMode(\PDO::FETCH_CLASS, $salesman ? get_class($salesman) : Salesman::class); |
|
45 | 45 | |
46 | 46 | $bool = $this->stmt->execute(); |
47 | 47 | |
48 | - $this->salesmen = $this->stmt->fetchAll( \PDO::FETCH_UNIQUE); |
|
48 | + $this->salesmen = $this->stmt->fetchAll(\PDO::FETCH_UNIQUE); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @implements ContainerInterface |
54 | 54 | */ |
55 | - public function has ($aussendienst_nummer) { |
|
55 | + public function has($aussendienst_nummer) { |
|
56 | 56 | return array_key_exists($aussendienst_nummer, $this->salesmen); |
57 | 57 | } |
58 | 58 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * @implements ContainerInterface |
62 | 62 | */ |
63 | - public function get ($aussendienst_nummer) { |
|
63 | + public function get($aussendienst_nummer) { |
|
64 | 64 | if (!$this->has($aussendienst_nummer)) { |
65 | 65 | $msg = sprintf("Could not find Salesman with ADM-Nummer '%s'", $aussendienst_nummer); |
66 | - throw new SalesmanNotFoundException( $msg ); |
|
66 | + throw new SalesmanNotFoundException($msg); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return $this->salesmen[$aussendienst_nummer]; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getIterator() |
77 | 77 | { |
78 | - return new \ArrayIterator( $this->salesmen ); |
|
78 | + return new \ArrayIterator($this->salesmen); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -84,6 +84,6 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function count() |
86 | 86 | { |
87 | - return count( $this->salesmen ); |
|
87 | + return count($this->salesmen); |
|
88 | 88 | } |
89 | 89 | } |
@@ -82,7 +82,7 @@ discard block |
||
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 |
||
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 | ]))); |
@@ -18,7 +18,7 @@ discard block |
||
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 |
||
29 | 29 | * @param object $aggregator Object that |
30 | 30 | * @return bool |
31 | 31 | */ |
32 | - public function __invoke( $aggregator ) |
|
32 | + public function __invoke($aggregator) |
|
33 | 33 | { |
34 | 34 | |
35 | 35 | // Default value |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | |
45 | 45 | // If salesman_id is available |
46 | 46 | if ($aggregator instanceOf SalesmanIdProviderInterface): |
47 | - $aggregator->salesman = $salesman_factory( $aggregator->getSalesmanId(), $this->salesman_fallback ); |
|
47 | + $aggregator->salesman = $salesman_factory($aggregator->getSalesmanId(), $this->salesman_fallback); |
|
48 | 48 | |
49 | 49 | elseif (isset($aggregator->salesman_id)): |
50 | - $aggregator->salesman = $salesman_factory( $aggregator->salesman_id, $this->salesman_fallback ); |
|
50 | + $aggregator->salesman = $salesman_factory($aggregator->salesman_id, $this->salesman_fallback); |
|
51 | 51 | |
52 | 52 | // Salesman can not be set |
53 | 53 | else: |
@@ -50,8 +50,10 @@ |
||
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; |
@@ -32,10 +32,10 @@ discard block |
||
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 |
||
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 |
||
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; |