Skip to content

Commit 552c907

Browse files
remove unused variables
1 parent 7a98143 commit 552c907

File tree

4 files changed

+13
-17
lines changed

4 files changed

+13
-17
lines changed

src/Collection/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ public function addIndex(IndexInterface $index): bool
454454
$uri = Api::addQuery(Api::INDEX, ['collection' => $this->getName()]);
455455
$response = $this->connection->post($uri, $index->getCreateData());
456456

457-
$data = json_decode((string)$response->getBody(), true);
457+
json_decode((string)$response->getBody(), true);
458458
return true;
459459
} catch (ClientException $exception) {
460460
$response = json_decode((string)$exception->getResponse()->getBody(), true);

src/Connection/ManagesConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ abstract class ManagesConnection implements ManagesConnectionInterface
1717
*
1818
* @var Connection
1919
*/
20-
protected $connection;
20+
protected Connection $connection;
2121

2222
/**
2323
* Sets a connection for class.

src/Database/Database.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,28 @@ class Database extends DatabaseHandler
2929
*
3030
* @var string
3131
*/
32-
protected $database;
32+
protected string $database;
3333

3434
/**
3535
* Collections of database
3636
*
3737
* @var ArrayList
3838
*/
39-
protected $collections;
39+
protected ArrayList $collections;
4040

4141
/**
4242
* Information about database
4343
*
4444
* @var array
4545
*/
46-
protected $info;
46+
protected array $info;
4747

4848
/**
4949
* Connection to use to manage database
5050
*
5151
* @var Connection
5252
*/
53-
protected $connection;
53+
protected Connection $connection;
5454

5555
/**
5656
* Database constructor.
@@ -103,7 +103,7 @@ public function hasCollection(string $collection): bool
103103
try {
104104
$uri = Api::buildDatabaseUri($this->connection->getBaseUri(), $this->getDatabaseName(), Api::COLLECTION);
105105
$uri = sprintf("%s/%s", $uri, $collection);
106-
$response = $this->connection->get($uri);
106+
$this->connection->get($uri);
107107
return true;
108108
} catch (ClientException $exception) {
109109
$response = json_decode((string)$exception->getResponse()->getBody(), true);

src/Database/DatabaseHandler.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,11 @@ public static function create(Connection $connection, string $database): bool
3939

4040
$uri = Api::buildSystemUri($connection->getBaseUri(), Api::DATABASE);
4141
$response = $connection->post($uri, $db);
42-
$data = json_decode((string)$response->getBody(), true);
42+
json_decode((string)$response->getBody(), true);
4343
return true;
4444
} catch (ClientException $exception) {
4545
$response = json_decode((string)$exception->getResponse()->getBody(), true);
46-
$databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']);
47-
throw $databaseException;
46+
throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']);
4847
}
4948
}
5049

@@ -64,7 +63,7 @@ public static function drop(Connection $connection, string $database): bool
6463
$uri = Api::buildSystemUri($connection->getBaseUri(), Api::DATABASE);
6564
$uri = sprintf("%s/%s", $uri, $database);
6665
$response = $connection->delete($uri);
67-
$data = json_decode((string)$response->getBody(), true);
66+
json_decode((string)$response->getBody(), true);
6867
return true;
6968
} catch (ClientException $exception) {
7069
$response = json_decode((string)$exception->getResponse()->getBody(), true);
@@ -98,8 +97,7 @@ public static function list(Connection $connection): ArrayList
9897
return new ArrayList($data['result']);
9998
} catch (ClientException $exception) {
10099
$response = json_decode((string)$exception->getResponse()->getBody(), true);
101-
$databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']);
102-
throw $databaseException;
100+
throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']);
103101
}
104102
}
105103

@@ -122,8 +120,7 @@ public static function userDatabases(Connection $connection): ArrayList
122120
return new ArrayList($data['result']);
123121
} catch (ClientException $exception) {
124122
$response = json_decode((string)$exception->getResponse()->getBody(), true);
125-
$databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']);
126-
throw $databaseException;
123+
throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']);
127124
}
128125
}
129126

@@ -147,8 +144,7 @@ public static function current(Connection $connection): array
147144
return $data['result'];
148145
} catch (ClientException $exception) {
149146
$response = json_decode((string)$exception->getResponse()->getBody(), true);
150-
$databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']);
151-
throw $databaseException;
147+
throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']);
152148
}
153149
}
154150
}

0 commit comments

Comments
 (0)