Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
History_Model
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2/**
3 * Model class for Protect history report data.
4 *
5 * @package automattic/jetpack-protect-models
6 */
7
8namespace Automattic\Jetpack\Protect_Models;
9
10/**
11 * Model class for the Protect history report data.
12 */
13class History_Model {
14    /**
15     * The date and time when the history was generated.
16     *
17     * @var string
18     */
19    public $last_checked;
20
21    /**
22     * Threats.
23     *
24     * @since 0.4.0
25     *
26     * @var array<Threat_Model>
27     */
28    public $threats = array();
29
30    /**
31     * Whether there was an error loading the history.
32     *
33     * @var bool
34     */
35    public $error = false;
36
37    /**
38     * The error code thrown when loading the history.
39     *
40     * @var string
41     */
42    public $error_code;
43
44    /**
45     * The error message thrown when loading the history.
46     *
47     * @var string
48     */
49    public $error_message;
50
51    /**
52     * The number of threats.
53     *
54     * @deprecated 0.4.0 This property is deprecated. Count History_Model::$threats instead.
55     *
56     * @var int
57     */
58    public $num_threats;
59
60    /**
61     * The number of core threats.
62     *
63     * @deprecated 0.4.0 This property is deprecated. Filter and count History_Model::$threats instead.
64     *
65     * @var int
66     */
67    public $num_core_threats;
68
69    /**
70     * The number of plugin threats.
71     *
72     * @deprecated 0.4.0 This property is deprecated. Filter and count History_Model::$threats instead.
73     *
74     * @var int
75     */
76    public $num_plugins_threats;
77
78    /**
79     * The number of theme threats.
80     *
81     * @deprecated 0.4.0 This property is deprecated. Filter and count History_Model::$threats instead.
82     *
83     * @var int
84     */
85    public $num_themes_threats;
86
87    /**
88     * WordPress core.
89     *
90     * @deprecated 0.4.0 This property is deprecated. Use History_Model::$threats instead.
91     *
92     * @var array<Extension_Model>
93     */
94    public $core = array();
95
96    /**
97     * Status themes.
98     *
99     * @deprecated 0.4.0 This property is deprecated. Filter and use History_Model::$threats instead.
100     *
101     * @var array<Extension_Model>
102     */
103    public $themes = array();
104
105    /**
106     * Status plugins.
107     *
108     * @deprecated 0.4.0 This property is deprecated. Filter and use History_Model::$threats instead.
109     *
110     * @var array<Extension_Model>
111     */
112    public $plugins = array();
113
114    /**
115     * File threats.
116     *
117     * @deprecated 0.4.0 This property is deprecated. Filter and use History_Model::$threats instead.
118     *
119     * @var array<Extension_Model>
120     */
121    public $files = array();
122
123    /**
124     * Database threats.
125     *
126     * @deprecated 0.4.0 This property is deprecated. Filter and use History_Model::$threats instead.
127     *
128     * @var array<Extension_Model>
129     */
130    public $database = array();
131
132    /**
133     * Status constructor.
134     *
135     * @param array $history The history data to load into the class instance.
136     */
137    public function __construct( $history = array() ) {
138        foreach ( $history as $property => $value ) {
139            if ( property_exists( $this, $property ) ) {
140                $this->$property = $value;
141            }
142        }
143    }
144}