1 | <?php |
||
41 | class store implements \tool_log\log\writer { |
||
42 | use \tool_log\helper\store, |
||
43 | \tool_log\helper\reader; |
||
44 | |||
45 | /** @var string $logguests true if logging guest access */ |
||
46 | protected $logguests; |
||
47 | |||
48 | private $logger; |
||
49 | |||
50 | public function __construct(\tool_log\log\manager $manager) { |
||
57 | |||
58 | /** |
||
59 | * Should the event be ignored (== not logged)? |
||
60 | * @param \core\event\base $event |
||
61 | * @return bool |
||
62 | */ |
||
63 | protected function is_event_ignored(\core\event\base $event) { |
||
75 | |||
76 | /** |
||
77 | * Write one event to the store. |
||
78 | * |
||
79 | * @param \core\event\base $evententries |
||
80 | * @return void |
||
81 | */ |
||
82 | public function insert_event_entries($evententries) { |
||
87 | |||
88 | /** |
||
89 | * Fetch records using given criteria returning a Traversable object. |
||
90 | * |
||
91 | * Note that the traversable object contains a moodle_recordset, so |
||
92 | * remember that is important that you call close() once you finish |
||
93 | * using it. |
||
94 | * |
||
95 | * @param string $selectwhere |
||
96 | * @param array $params |
||
97 | * @param string $sort |
||
98 | * @param int $limitfrom |
||
99 | * @param int $limitnum |
||
100 | * @return \core\dml\recordset_walk|\core\event\base[] |
||
101 | */ |
||
102 | public function get_events_select_iterator($selectwhere, array $params, $sort, $limitfrom, $limitnum) { |
||
105 | |||
106 | /** |
||
107 | * Returns an event from the log data. |
||
108 | * |
||
109 | * @param \stdClass $data Log data |
||
110 | * @return \core\event\base |
||
111 | */ |
||
112 | public function get_log_event($data) { |
||
115 | |||
116 | public function get_events_select_count($selectwhere, array $params) { |
||
119 | |||
120 | public function get_internal_log_table_name() { |
||
123 | |||
124 | /** |
||
125 | * Are the new events appearing in the reader? |
||
126 | * |
||
127 | * @return bool true means new log events are being added, false means no new data will be added |
||
128 | */ |
||
129 | public function is_logging() { |
||
134 | |||
135 | public function dispose() { |
||
137 | } |
||
138 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.