@@ -53,8 +53,8 @@ |
||
| 53 | 53 | public function __construct(private AuthInterface $auth, |
| 54 | 54 | private DriverInterface $driver, array $database, array $options) |
| 55 | 55 | { |
| 56 | - $this->enduserEnabled = (bool)($options['enduser']['enabled'] ?? false); |
|
| 57 | - $this->historyEnabled = (bool)($options['history']['enabled'] ?? false); |
|
| 56 | + $this->enduserEnabled = (bool) ($options['enduser']['enabled'] ?? false); |
|
| 57 | + $this->historyEnabled = (bool) ($options['history']['enabled'] ?? false); |
|
| 58 | 58 | $this->category = Options::CAT_BUILDER; |
| 59 | 59 | $this->userDatabase = $options['database']; |
| 60 | 60 | if (!$this->enduserEnabled && !$this->historyEnabled) { |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * @var int|null |
| 19 | 19 | */ |
| 20 | - private int|null $ownerId = null; |
|
| 20 | + private int | null $ownerId = null; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @var ConnectionInterface |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @return bool|StatementInterface |
| 58 | 58 | */ |
| 59 | - private function executeQuery(string $query, array $values): bool|StatementInterface |
|
| 59 | + private function executeQuery(string $query, array $values): bool | StatementInterface |
|
| 60 | 60 | { |
| 61 | 61 | $st = $this->connection->prepareStatement($query); |
| 62 | 62 | return $this->connection->executeStatement($st, $values) ?? false; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $query = "select id from dbadmin_owners where username=:username limit 1"; |
| 78 | 78 | $statement = $this->executeQuery($query, ['username' => $username]); |
| 79 | - return !$statement || !($row = $statement->fetchAssoc()) ? 0 : (int)$row['id']; |
|
| 79 | + return !$statement || !($row = $statement->fetchAssoc()) ? 0 : (int) $row['id']; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -107,8 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | private function getOwnerId(bool $canCreate = true): int |
| 109 | 109 | { |
| 110 | - return $this->ownerId !== null ? $this->ownerId : |
|
| 111 | - ($this->readOwnerId($this->user()) ?: ($canCreate ? |
|
| 110 | + return $this->ownerId !== null ? $this->ownerId : ($this->readOwnerId($this->user()) ?: ($canCreate ? |
|
| 112 | 111 | $this->newOwnerId($this->user()) : 0)); |
| 113 | 112 | } |
| 114 | 113 | } |
@@ -40,9 +40,9 @@ |
||
| 40 | 40 | public function __construct(private AuthInterface $auth, |
| 41 | 41 | private DriverInterface $driver, array $database, array $options) |
| 42 | 42 | { |
| 43 | - $this->historyEnabled = (bool)($options['history']['enabled'] ?? false); |
|
| 44 | - $this->historyDistinct = (bool)($options['history']['distinct'] ?? false); |
|
| 45 | - $this->historyLimit = (int)($options['history']['limit'] ?? 15); |
|
| 43 | + $this->historyEnabled = (bool) ($options['history']['enabled'] ?? false); |
|
| 44 | + $this->historyDistinct = (bool) ($options['history']['distinct'] ?? false); |
|
| 45 | + $this->historyLimit = (int) ($options['history']['limit'] ?? 15); |
|
| 46 | 46 | if (!$this->historyEnabled) { |
| 47 | 47 | return; |
| 48 | 48 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | // Check in server options |
| 73 | 73 | $serverAccess = $this->getOption("servers.$server.access.server", null); |
| 74 | - if($serverAccess === true || $serverAccess === false) |
|
| 74 | + if ($serverAccess === true || $serverAccess === false) |
|
| 75 | 75 | { |
| 76 | 76 | return $serverAccess; |
| 77 | 77 | } |
@@ -127,8 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | $defaultServer = $this->getOption('default'); |
| 129 | 129 | return !$defaultServer || |
| 130 | - !$this->getOption("servers.$defaultServer") ? '' : |
|
| 131 | - rq(Admin::class)->server($defaultServer); |
|
| 130 | + !$this->getOption("servers.$defaultServer") ? '' : rq(Admin::class)->server($defaultServer); |
|
| 132 | 131 | } |
| 133 | 132 | |
| 134 | 133 | /** |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | /** |
| 15 | 15 | * @var AppDriver|null |
| 16 | 16 | */ |
| 17 | - protected AppDriver|null $driver = null; |
|
| 17 | + protected AppDriver | null $driver = null; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @var Admin |
@@ -12,8 +12,7 @@ discard block |
||
| 12 | 12 | function getAuth($di): Config\AuthInterface |
| 13 | 13 | { |
| 14 | 14 | return $di->h(Config\AuthInterface::class) ? |
| 15 | - $di->g(Config\AuthInterface::class) : |
|
| 16 | - new class implements Config\AuthInterface { |
|
| 15 | + $di->g(Config\AuthInterface::class) : new class implements Config\AuthInterface { |
|
| 17 | 16 | public function user(): string |
| 18 | 17 | { |
| 19 | 18 | return ''; |
@@ -62,7 +61,7 @@ discard block |
||
| 62 | 61 | Driver\DriverInterface::class => function($di) { |
| 63 | 62 | // Register a driver for each database server. |
| 64 | 63 | $package = $di->g(Lagdo\DbAdmin\DbAdminPackage::class); |
| 65 | - foreach($package->getServers() as $server => $options) { |
|
| 64 | + foreach ($package->getServers() as $server => $options) { |
|
| 66 | 65 | $di->set("dbadmin_driver_$server", fn() => |
| 67 | 66 | Driver\Driver::createDriver($options)); |
| 68 | 67 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | Driver\DriverInterface::class => function($di) { |
| 61 | 61 | // Register a driver for each database server. |
| 62 | 62 | $package = $di->g(Lagdo\DbAdmin\DbAdminPackage::class); |
| 63 | - foreach($package->getServers() as $server => $options) { |
|
| 63 | + foreach ($package->getServers() as $server => $options) { |
|
| 64 | 64 | $di->set("dbadmin_driver_$server", fn() => |
| 65 | 65 | Driver\Driver::createDriver($options)); |
| 66 | 66 | } |