Skip to content

Commit 45409c8

Browse files
committed
Small refactor
1 parent 9046206 commit 45409c8

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

api.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -798,14 +798,15 @@ class ReflectionService
798798
private $db;
799799
private $cache;
800800
private $ttl;
801-
private $tables;
801+
private $database;
802+
private $tableCache;
802803

803804
public function __construct(GenericDB $db, Cache $cache, int $ttl)
804805
{
805806
$this->db = $db;
806807
$this->cache = $cache;
807808
$this->ttl = $ttl;
808-
$this->tables = $this->loadTables(true);
809+
$this->database = $this->loadTables(true);
809810
$this->tableCache = [];
810811
}
811812

@@ -837,7 +838,7 @@ private function loadTable(String $name, bool $useCache): ReflectedTable
837838

838839
public function refreshTables()
839840
{
840-
$this->tables = $this->loadTables(false);
841+
$this->database = $this->loadTables(false);
841842
}
842843

843844
public function refreshTable(String $tableName)
@@ -847,7 +848,7 @@ public function refreshTable(String $tableName)
847848

848849
public function hasTable(String $table): bool
849850
{
850-
return $this->tables->exists($table);
851+
return $this->database->exists($table);
851852
}
852853

853854
public function getTable(String $table): ReflectedTable
@@ -860,12 +861,12 @@ public function getTable(String $table): ReflectedTable
860861

861862
public function getTableNames(): array
862863
{
863-
return $this->tables->getTables();
864+
return $this->database->getTables();
864865
}
865866

866867
public function getDatabaseName(): String
867868
{
868-
return $this->tables->getName();
869+
return $this->database->getName();
869870
}
870871
}
871872

src/Tqdev/PhpCrudApi/Column/ReflectionService.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ class ReflectionService
1111
private $db;
1212
private $cache;
1313
private $ttl;
14-
private $tables;
14+
private $database;
15+
private $tableCache;
1516

1617
public function __construct(GenericDB $db, Cache $cache, int $ttl)
1718
{
1819
$this->db = $db;
1920
$this->cache = $cache;
2021
$this->ttl = $ttl;
21-
$this->tables = $this->loadTables(true);
22+
$this->database = $this->loadTables(true);
2223
$this->tableCache = [];
2324
}
2425

@@ -50,7 +51,7 @@ private function loadTable(String $name, bool $useCache): ReflectedTable
5051

5152
public function refreshTables()
5253
{
53-
$this->tables = $this->loadTables(false);
54+
$this->database = $this->loadTables(false);
5455
}
5556

5657
public function refreshTable(String $tableName)
@@ -60,7 +61,7 @@ public function refreshTable(String $tableName)
6061

6162
public function hasTable(String $table): bool
6263
{
63-
return $this->tables->exists($table);
64+
return $this->database->exists($table);
6465
}
6566

6667
public function getTable(String $table): ReflectedTable
@@ -73,11 +74,11 @@ public function getTable(String $table): ReflectedTable
7374

7475
public function getTableNames(): array
7576
{
76-
return $this->tables->getTables();
77+
return $this->database->getTables();
7778
}
7879

7980
public function getDatabaseName(): String
8081
{
81-
return $this->tables->getName();
82+
return $this->database->getName();
8283
}
8384
}

0 commit comments

Comments
 (0)