diff options
author | Valentin Popov <info@valentineus.link> | 2019-05-10 23:57:18 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2019-05-10 23:57:18 +0300 |
commit | 747055f9d199ea53ae066f1844d24885052f0030 (patch) | |
tree | 165392e27335104db0c345a639cea2c7ed3cdf0b /classes/local | |
parent | ed0ce52060690eff5459c037338d26796307ef79 (diff) | |
download | local_webhooks-747055f9d199ea53ae066f1844d24885052f0030.tar.xz local_webhooks-747055f9d199ea53ae066f1844d24885052f0030.zip |
Added external function add service
Signed-off-by: Valentin Popov <info@valentineus.link>
Diffstat (limited to 'classes/local')
-rw-r--r-- | classes/local/record.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/classes/local/record.php b/classes/local/record.php index 29dadce..3e74571 100644 --- a/classes/local/record.php +++ b/classes/local/record.php @@ -20,6 +20,10 @@ defined('MOODLE_INTERNAL') || die(); use stdClass; use function defined; +use function is_array; +use function is_bool; +use function is_int; +use function is_string; /** * It's a class description record. @@ -77,4 +81,45 @@ final class record extends stdClass { * @var string */ public $token; + + /** + * Classes constructor. + * + * @param array|null $conditions + */ + public function __construct(array $conditions = null) { + if (isset($conditions['events']) && is_array($conditions['events'])) { + $this->events = []; + + foreach ($conditions['events'] as $event) { + if (is_string($event)) { + $this->events[] = $event; + } + } + } + + if (isset($conditions['header']) && is_string($conditions['header'])) { + $this->header = $conditions['header']; + } + + if (isset($conditions['id']) && is_int($conditions['id'])) { + $this->id = $conditions['id']; + } + + if (isset($conditions['name']) && is_string($conditions['name'])) { + $this->name = $conditions['name']; + } + + if (isset($conditions['point']) && is_string($conditions['point'])) { + $this->point = $conditions['point']; + } + + if (isset($conditions['status']) && is_bool($conditions['status'])) { + $this->status = $conditions['status']; + } + + if (isset($conditions['token']) && is_string($conditions['token'])) { + $this->token = $conditions['token']; + } + } }
\ No newline at end of file |