@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | * @throws UserNotFoundException |
16 | 16 | * @uses $users |
17 | 17 | */ |
18 | - public function get( $id ) |
|
18 | + public function get($id) |
|
19 | 19 | { |
20 | - if ($this->has( $id )) { |
|
21 | - return $this->users[ $id ]; |
|
20 | + if ($this->has($id)) { |
|
21 | + return $this->users[$id]; |
|
22 | 22 | } |
23 | 23 | throw new UserNotFoundException("Could not find User with ID '$id'"); |
24 | 24 | } |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * @return boolean |
29 | 29 | * @uses $users |
30 | 30 | */ |
31 | - public function has ($id ) |
|
31 | + public function has($id) |
|
32 | 32 | { |
33 | - return array_key_exists( $id, $this->users); |
|
33 | + return array_key_exists($id, $this->users); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function getIterator() |
43 | 43 | { |
44 | - return new \ArrayIterator( $this->users ); |
|
44 | + return new \ArrayIterator($this->users); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 |
@@ -4,9 +4,9 @@ |
||
4 | 4 | class ActiveUsersFilterIterator extends \FilterIterator |
5 | 5 | { |
6 | 6 | |
7 | - public function __construct( \Traversable $users ) |
|
7 | + public function __construct(\Traversable $users) |
|
8 | 8 | { |
9 | - parent::__construct( new \IteratorIterator( $users )); |
|
9 | + parent::__construct(new \IteratorIterator($users)); |
|
10 | 10 | } |
11 | 11 | public function accept() |
12 | 12 | { |
@@ -21,12 +21,12 @@ |
||
21 | 21 | * @param UserAbstract $user Optional: User template object |
22 | 22 | * @param string $table Optional: Users table name |
23 | 23 | */ |
24 | - public function __construct( \PDO $pdo, UserAbstract $user = null, $table = null ) |
|
24 | + public function __construct(\PDO $pdo, UserAbstract $user = null, $table = null) |
|
25 | 25 | { |
26 | - parent::__construct( $pdo, $user, $table ); |
|
26 | + parent::__construct($pdo, $user, $table); |
|
27 | 27 | |
28 | - $active = new ActiveUsersFilterIterator( $this ); |
|
29 | - $this->users = iterator_to_array( $active ); |
|
28 | + $active = new ActiveUsersFilterIterator($this); |
|
29 | + $this->users = iterator_to_array($active); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function getCreationDateTime() |
44 | 44 | { |
45 | 45 | if ($this->created) |
46 | - return \DateTime::createFromFormat( "Y-m-d H:i:s", $this->created ); |
|
46 | + return \DateTime::createFromFormat("Y-m-d H:i:s", $this->created); |
|
47 | 47 | return $this->created; |
48 | 48 | } |
49 | 49 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | public function getLastUpdateDateTime() |
55 | 55 | { |
56 | 56 | if ($this->updated) |
57 | - return \DateTime::createFromFormat( "Y-m-d H:i:s", $this->updated ); |
|
57 | + return \DateTime::createFromFormat("Y-m-d H:i:s", $this->updated); |
|
58 | 58 | return $this->updated; |
59 | 59 | |
60 | 60 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param mixed $email |
163 | 163 | * @return self |
164 | 164 | */ |
165 | - public function setEmail( $email) |
|
165 | + public function setEmail($email) |
|
166 | 166 | { |
167 | 167 | $this->email = $email; |
168 | 168 | return $this; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return self |
199 | 199 | * @uses $api_key |
200 | 200 | */ |
201 | - public function setApiKey( $key ) |
|
201 | + public function setApiKey($key) |
|
202 | 202 | { |
203 | 203 | $this->api_key = $key; |
204 | 204 | return $this; |
@@ -42,8 +42,9 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getCreationDateTime() |
44 | 44 | { |
45 | - if ($this->created) |
|
46 | - return \DateTime::createFromFormat( "Y-m-d H:i:s", $this->created ); |
|
45 | + if ($this->created) { |
|
46 | + return \DateTime::createFromFormat( "Y-m-d H:i:s", $this->created ); |
|
47 | + } |
|
47 | 48 | return $this->created; |
48 | 49 | } |
49 | 50 | |
@@ -53,8 +54,9 @@ discard block |
||
53 | 54 | */ |
54 | 55 | public function getLastUpdateDateTime() |
55 | 56 | { |
56 | - if ($this->updated) |
|
57 | - return \DateTime::createFromFormat( "Y-m-d H:i:s", $this->updated ); |
|
57 | + if ($this->updated) { |
|
58 | + return \DateTime::createFromFormat( "Y-m-d H:i:s", $this->updated ); |
|
59 | + } |
|
58 | 60 | return $this->updated; |
59 | 61 | |
60 | 62 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param UserAbstract $user Optional: User template object |
22 | 22 | * @param string $table Optional: Users table name |
23 | 23 | */ |
24 | - public function __construct( \PDO $pdo, UserAbstract $user = null, $table = null ) |
|
24 | + public function __construct(\PDO $pdo, UserAbstract $user = null, $table = null) |
|
25 | 25 | { |
26 | 26 | $this->table = $table ?: $this->table; |
27 | 27 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | |
43 | 43 | FROM {$this->table}"; |
44 | 44 | |
45 | - $stmt = $pdo->prepare( $sql ); |
|
45 | + $stmt = $pdo->prepare($sql); |
|
46 | 46 | |
47 | - $stmt->setFetchMode( \PDO::FETCH_CLASS, $user ? get_class($user) : User::class ); |
|
47 | + $stmt->setFetchMode(\PDO::FETCH_CLASS, $user ? get_class($user) : User::class); |
|
48 | 48 | |
49 | 49 | if (!$stmt->execute()): |
50 | 50 | throw new \RuntimeException("Could not retrieve Users from database"); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | public function getLastUpdateDateTime(); |
25 | 25 | |
26 | 26 | |
27 | - public function setDisplayName( $name ); |
|
27 | + public function setDisplayName($name); |
|
28 | 28 | public function getDisplayName(); |
29 | 29 | |
30 | 30 | public function setFirstName($name); |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | public function setLoginName($name); |
37 | 37 | public function getLoginName(); |
38 | 38 | |
39 | - public function setEmail( $email); |
|
39 | + public function setEmail($email); |
|
40 | 40 | public function getEmail(); |
41 | 41 | |
42 | 42 | public function getApiKey(); |
43 | - public function setApiKey( $key ); |
|
43 | + public function setApiKey($key); |
|
44 | 44 | |
45 | 45 | |
46 | 46 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param UserAbstract $user Optional: User template object |
35 | 35 | * @param string $table Optional: Users table name |
36 | 36 | */ |
37 | - public function __construct( \PDO $pdo, UserAbstract $user = null, $table = null ) |
|
37 | + public function __construct(\PDO $pdo, UserAbstract $user = null, $table = null) |
|
38 | 38 | { |
39 | 39 | $this->pdo = $pdo; |
40 | 40 | $this->table = $table ?: $this->table; |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | WHERE U.id = :id |
58 | 58 | AND U.is_active > 0"; |
59 | 59 | |
60 | - $this->stmt = $pdo->prepare( $sql ); |
|
60 | + $this->stmt = $pdo->prepare($sql); |
|
61 | 61 | |
62 | - $this->stmt->setFetchMode( \PDO::FETCH_CLASS, $this->php_users_class ); |
|
62 | + $this->stmt->setFetchMode(\PDO::FETCH_CLASS, $this->php_users_class); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | |
75 | 75 | |
76 | - public function has ($id) { |
|
76 | + public function has($id) { |
|
77 | 77 | if (!$this->stmt->execute([ |
78 | 78 | 'id' => $id |
79 | 79 | ])): |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | - public function get ($id) { |
|
87 | + public function get($id) { |
|
88 | 88 | if (!$this->stmt->execute([ |
89 | 89 | 'id' => $id |
90 | 90 | ])): |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param UserAbstract $user Optional: User template object |
35 | 35 | * @param string $table Optional: Users table name |
36 | 36 | */ |
37 | - public function __construct( \PDO $pdo, UserAbstract $user = null, $table = null ) |
|
37 | + public function __construct(\PDO $pdo, UserAbstract $user = null, $table = null) |
|
38 | 38 | { |
39 | 39 | $this->pdo = $pdo; |
40 | 40 | $this->table = $table ?: $this->table; |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | WHERE U.user_login_name = :user_login_name |
58 | 58 | AND U.is_active > 0"; |
59 | 59 | |
60 | - $this->stmt = $pdo->prepare( $sql ); |
|
60 | + $this->stmt = $pdo->prepare($sql); |
|
61 | 61 | |
62 | - $this->stmt->setFetchMode( \PDO::FETCH_CLASS, $this->php_users_class ); |
|
62 | + $this->stmt->setFetchMode(\PDO::FETCH_CLASS, $this->php_users_class); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | |
75 | 75 | |
76 | - public function has ($user_login_name) { |
|
76 | + public function has($user_login_name) { |
|
77 | 77 | if (!$this->stmt->execute([ |
78 | 78 | 'user_login_name' => $user_login_name |
79 | 79 | ])): |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | - public function get ($user_login_name) { |
|
87 | + public function get($user_login_name) { |
|
88 | 88 | if (!$this->stmt->execute([ |
89 | 89 | 'user_login_name' => $user_login_name |
90 | 90 | ])): |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param UserAbstract|null $user Optional: UserInterface instance |
42 | 42 | * @param [type] $table Optional: table name |
43 | 43 | */ |
44 | - public function __construct( \PDO $pdo, UuidFactoryInterface $uuid_factory, UserAbstract $user = null, $table = null ) |
|
44 | + public function __construct(\PDO $pdo, UuidFactoryInterface $uuid_factory, UserAbstract $user = null, $table = null) |
|
45 | 45 | { |
46 | 46 | $this->pdo = $pdo; |
47 | 47 | $this->uuid_factory = $uuid_factory; |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | WHERE U.uuid = UNHEX( REPLACE( :uuid, '-','') ) |
67 | 67 | AND U.is_active > 0"; |
68 | 68 | |
69 | - $this->stmt = $pdo->prepare( $sql ); |
|
69 | + $this->stmt = $pdo->prepare($sql); |
|
70 | 70 | |
71 | - $this->stmt->setFetchMode( \PDO::FETCH_CLASS, $this->php_users_class ); |
|
71 | + $this->stmt->setFetchMode(\PDO::FETCH_CLASS, $this->php_users_class); |
|
72 | 72 | |
73 | 73 | } |
74 | 74 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | |
83 | 83 | |
84 | 84 | |
85 | - public function has ($uuid) { |
|
86 | - $uuid = $this->assertUUID( $uuid ); |
|
85 | + public function has($uuid) { |
|
86 | + $uuid = $this->assertUUID($uuid); |
|
87 | 87 | if (!$this->stmt->execute([ |
88 | 88 | 'uuid' => $uuid |
89 | 89 | ])): |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | |
97 | - public function get ($uuid) { |
|
98 | - $uuid = $this->assertUUID( $uuid ); |
|
97 | + public function get($uuid) { |
|
98 | + $uuid = $this->assertUUID($uuid); |
|
99 | 99 | if (!$this->stmt->execute([ |
100 | 100 | 'uuid' => $uuid |
101 | 101 | ])): |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @throws Ramsey\Uuid\Exception\InvalidUuidStringException |
121 | 121 | */ |
122 | - protected function assertUUID( $uuid ) |
|
122 | + protected function assertUUID($uuid) |
|
123 | 123 | { |
124 | - if (is_string( $uuid )): |
|
125 | - $uuid = $this->uuid_factory->fromString( $uuid ); |
|
124 | + if (is_string($uuid)): |
|
125 | + $uuid = $this->uuid_factory->fromString($uuid); |
|
126 | 126 | elseif (!$uuid instanceOf UuidInterface): |
127 | 127 | throw new \InvalidArgumentException("UuidInterface or UUID string expected"); |
128 | 128 | endif; |