PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.0.1
Defender Security – Malware Scanner, Login Security & Firewall v6.0.1
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / src / class-db.php

class-db.php in Defender Security – Malware Scanner, Login Security & Firewall 6.0.1, at src/class-db.php

57 lines 1015 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Handles database operations.
4 *
5 * @package WP_Defender
6 */
7
8 namespace WP_Defender;
9
10 use Calotes\DB\Mapper;
11 use Calotes\Base\Model;
12 use ReflectionException;
13
14 /**
15 * Contains methods for saving the current instance, getting the ORM, and retrieving the table name.
16 */
17 class DB extends Model {
18
19 /**
20 * Constructor for the class.
21 * Initializes the object by parsing annotations.
22 *
23 * @return void
24 */
25 public function __construct() {
26 $this->parse_annotations();
27 }
28
29 /**
30 * Save the current instance.
31 *
32 * @return false|int
33 * @throws ReflectionException If class is not defined.
34 */
35 public function save() {
36 return self::get_orm()->save( $this );
37 }
38
39 /**
40 * Retrieves the ORM instance from the dependency injection container.
41 *
42 * @return Mapper The ORM instance.
43 */
44 protected static function get_orm(): Mapper {
45 return wd_di()->get( Mapper::class );
46 }
47
48 /**
49 * Get table name.
50 *
51 * @return string
52 */
53 public function get_table(): string {
54 return $this->table;
55 }
56 }
57