@@ -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 | } |
@@ -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(); |
@@ -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 | ]))); |
@@ -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; |
@@ -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 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 |
||
| 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: |
@@ -13,11 +13,11 @@ |
||
| 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() |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param string $table The table name to use |
| 29 | 29 | * @param SalesmanInterface|null $salesman Class or object template to work with |
| 30 | 30 | */ |
| 31 | - public function __construct (\PDO $pdo, $table, SalesmanInterface $salesman = null) |
|
| 31 | + public function __construct(\PDO $pdo, $table, SalesmanInterface $salesman = null) |
|
| 32 | 32 | { |
| 33 | 33 | $this->table = $table; |
| 34 | 34 | $this->pdo = $pdo; |
@@ -53,15 +53,15 @@ discard block |
||
| 53 | 53 | aussendienst_vorname ASC, |
| 54 | 54 | aussendienst_nummer ASC"; |
| 55 | 55 | |
| 56 | - $this->stmt = $pdo->prepare( $sql ); |
|
| 56 | + $this->stmt = $pdo->prepare($sql); |
|
| 57 | 57 | |
| 58 | - $this->stmt->setFetchMode( \PDO::FETCH_CLASS, $salesman ? get_class($salesman) : Salesman::class ); |
|
| 58 | + $this->stmt->setFetchMode(\PDO::FETCH_CLASS, $salesman ? get_class($salesman) : Salesman::class); |
|
| 59 | 59 | |
| 60 | 60 | if (!$this->stmt->execute()): |
| 61 | 61 | throw new SalesmanDatabaseException("PdoAllSalesmen: Could not execute SQL query"); |
| 62 | 62 | endif; |
| 63 | 63 | |
| 64 | - $this->salesmen = $this->stmt->fetchAll( \PDO::FETCH_UNIQUE); |
|
| 64 | + $this->salesmen = $this->stmt->fetchAll(\PDO::FETCH_UNIQUE); |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * @implements ContainerInterface |
| 71 | 71 | */ |
| 72 | - public function has ($aussendienst_nummer) { |
|
| 72 | + public function has($aussendienst_nummer) { |
|
| 73 | 73 | if ($aussendienst_nummer instanceOf SalesmanIdProviderInterface) { |
| 74 | 74 | $aussendienst_nummer = $aussendienst_nummer->getSalesmanId(); |
| 75 | 75 | } |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | /** |
| 81 | 81 | * @implements ContainerInterface |
| 82 | 82 | */ |
| 83 | - public function get ($aussendienst_nummer) { |
|
| 83 | + public function get($aussendienst_nummer) { |
|
| 84 | 84 | if ($aussendienst_nummer instanceOf SalesmanIdProviderInterface) { |
| 85 | 85 | $aussendienst_nummer = $aussendienst_nummer->getSalesmanId(); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | if (!$this->has($aussendienst_nummer)) { |
| 89 | 89 | $msg = sprintf("Could not find Salesman with ADM-Nummer '%s'", $aussendienst_nummer); |
| 90 | - throw new SalesmanNotFoundException( $msg ); |
|
| 90 | + throw new SalesmanNotFoundException($msg); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | return $this->salesmen[$aussendienst_nummer]; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function getIterator() |
| 101 | 101 | { |
| 102 | - return new \ArrayIterator( $this->salesmen ); |
|
| 102 | + return new \ArrayIterator($this->salesmen); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -108,6 +108,6 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function count() |
| 110 | 110 | { |
| 111 | - return count( $this->salesmen ); |
|
| 111 | + return count($this->salesmen); |
|
| 112 | 112 | } |
| 113 | 113 | } |
@@ -4,13 +4,13 @@ |
||
| 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 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 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 |
||
| 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 |