1: <?php
2: namespace Opencart\Catalog\Model\Setting;
3: /**
4: * Class Extension
5: *
6: * @package Opencart\Catalog\Model\Setting
7: */
8: class Extension extends \Opencart\System\Engine\Model {
9: /**
10: * Get Extensions
11: *
12: * @return array<int, array<string, mixed>>
13: */
14: public function getExtensions(): array {
15: $query = $this->db->query("SELECT DISTINCT `extension` FROM `" . DB_PREFIX . "extension`");
16:
17: return $query->rows;
18: }
19:
20: /**
21: * Get Extensions By Type
22: *
23: * @param string $type
24: *
25: * @return array<int, array<string, mixed>>
26: */
27: public function getExtensionsByType(string $type): array {
28: $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "extension` WHERE `type` = '" . $this->db->escape($type) . "'");
29:
30: return $query->rows;
31: }
32:
33: /**
34: * Get Extension By Code
35: *
36: * @param string $type
37: * @param string $code
38: *
39: * @return array<string, mixed>
40: */
41: public function getExtensionByCode(string $type, string $code): array {
42: $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "extension` WHERE `type` = '" . $this->db->escape($type) . "' AND `code` = '" . $this->db->escape($code) . "'");
43:
44: return $query->row;
45: }
46: }
47: