| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.1.1 Free | |
| 4 | + * @version 2.0.12 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2022 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2023 FirePlugins All Rights Reserved | |
| 9 | 9 | * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | namespace FireBox\Core; |
| @@ -17,10 +17,22 @@ | ||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | class Tables |
| 20 | 20 | { |
| 21 | + /** | |
| 22 | + * Caches the FireBox tables. | |
| 23 | + * | |
| 24 | + * @var array | |
| 25 | + */ | |
| 26 | + private $tables = []; | |
| 27 | + | |
| 21 | 28 | public function __get($table = '') |
| 22 | 29 | { |
| 30 | + if (isset($this->tables[$table])) | |
| 31 | + { | |
| 32 | + return $this->tables[$table]; | |
| 33 | + } | |
| 34 | + | |
| 23 | 35 | $table_class = '\FireBox\Core\Tables\\' . ucfirst(strtolower($table)); |
| 24 | 36 | |
| 25 | 37 | if (!class_exists($table_class)) |
| 26 | 38 | { |
| @@ -26,7 +38,11 @@ | ||
| 26 | 38 | { |
| 27 | 39 | return false; |
| 28 | 40 | } |
| 29 | 41 | |
| 30 | - return new $table_class(); | |
| 42 | + $class = new $table_class(); | |
| 43 | + | |
| 44 | + $this->tables[$table] = $class; | |
| 45 | + | |
| 46 | + return $this->tables[$table]; | |
| 31 | 47 | } |
| 32 | 48 | } |