Skip to content

Commit 37a965d

Browse files
committed
removed Nette\SmartObject
1 parent c39f8b6 commit 37a965d

File tree

7 files changed

+6
-28
lines changed

7 files changed

+6
-28
lines changed

src/Bridges/SecurityHttp/CookieStorage.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
*/
2020
final class CookieStorage implements Nette\Security\UserStorage
2121
{
22-
use Nette\SmartObject;
23-
2422
private const MinLength = 13;
2523

2624
private Http\IRequest $request;

src/Bridges/SecurityHttp/SessionStorage.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
*/
2121
final class SessionStorage implements Nette\Security\UserStorage
2222
{
23-
use Nette\SmartObject;
24-
2523
private string $namespace = '';
2624
private Session $sessionHandler;
2725
private ?SessionSection $sessionSection = null;

src/Bridges/SecurityTracy/UserPanel.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
class UserPanel implements Tracy\IBarPanel
2020
{
21-
use Nette\SmartObject;
22-
2321
private Nette\Security\User $user;
2422

2523

src/Security/Identity.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
namespace Nette\Security;
1111

12-
use Nette;
13-
1412

1513
/**
1614
* @deprecated use Nette\Security\SimpleIdentity
@@ -20,12 +18,6 @@
2018
*/
2119
class Identity implements IIdentity
2220
{
23-
use Nette\SmartObject {
24-
__get as private parentGet;
25-
__set as private parentSet;
26-
__isset as private parentIsSet;
27-
}
28-
2921
private string|int $id;
3022
private array $roles;
3123
private array $data;
@@ -46,7 +38,6 @@ public function __construct($id, $roles = null, ?iterable $data = null)
4638
*/
4739
public function setId(string|int $id): static
4840
{
49-
5041
$this->id = is_numeric($id) && !is_float($tmp = $id * 1) ? $tmp : $id;
5142
return $this;
5243
}
@@ -94,8 +85,8 @@ public function getData(): array
9485
*/
9586
public function __set(string $key, $value): void
9687
{
97-
if ($this->parentIsSet($key)) {
98-
$this->parentSet($key, $value);
88+
if (in_array($key, ['id', 'roles', 'data'], strict: true)) {
89+
$this->{"set$key"}($value);
9990

10091
} else {
10192
$this->data[$key] = $value;
@@ -108,8 +99,9 @@ public function __set(string $key, $value): void
10899
*/
109100
public function &__get(string $key): mixed
110101
{
111-
if ($this->parentIsSet($key)) {
112-
return $this->parentGet($key);
102+
if (in_array($key, ['id', 'roles', 'data'], strict: true)) {
103+
$res = $this->{"get$key"}();
104+
return $res;
113105

114106
} else {
115107
return $this->data[$key];
@@ -119,6 +111,6 @@ public function &__get(string $key): mixed
119111

120112
public function __isset(string $key): bool
121113
{
122-
return isset($this->data[$key]) || $this->parentIsSet($key);
114+
return isset($this->data[$key]) || in_array($key, ['id', 'roles', 'data'], strict: true);
123115
}
124116
}

src/Security/Passwords.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
*/
1818
class Passwords
1919
{
20-
use Nette\SmartObject;
21-
2220
private string $algo;
2321
private array $options;
2422

src/Security/Permission.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
*/
2020
class Permission implements Authorizator
2121
{
22-
use Nette\SmartObject;
23-
2422
/** Role storage */
2523
private array $roles = [];
2624

src/Security/SimpleAuthenticator.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@
99

1010
namespace Nette\Security;
1111

12-
use Nette;
13-
1412

1513
/**
1614
* Trivial implementation of Authenticator.
1715
*/
1816
class SimpleAuthenticator implements Authenticator
1917
{
20-
use Nette\SmartObject;
21-
2218
private array $passwords;
2319
private array $roles;
2420
private array $data;

0 commit comments

Comments
 (0)