1
|
|
|
<?php |
2
|
|
|
namespace mikemix\Wiziq\Entity; |
3
|
|
|
|
4
|
|
|
use mikemix\Wiziq\Entity\Traits\ClassroomTrait; |
5
|
|
|
|
6
|
|
|
class Classroom |
7
|
|
|
{ |
8
|
|
|
use ClassroomTrait; |
9
|
|
|
|
10
|
|
|
/** @var string */ |
11
|
|
|
private $startTime; |
12
|
|
|
|
13
|
|
|
/** @var int */ |
14
|
|
|
private $duration; |
15
|
|
|
|
16
|
|
|
/** @var int */ |
17
|
|
|
private $extendDuration; |
18
|
|
|
|
19
|
|
|
/** @var string */ |
20
|
|
|
private $timeZone; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @param string $title |
24
|
|
|
* @param \DateTime $startTime |
25
|
|
|
*/ |
26
|
13 |
|
private function __construct($title, \DateTime $startTime) |
27
|
|
|
{ |
28
|
13 |
|
$this->title = (string)$title; |
29
|
13 |
|
$this->startTime = $startTime->format('m/d/Y H:i:s'); |
30
|
13 |
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @param string $title |
34
|
|
|
* @param \DateTime $startTime |
35
|
|
|
* @return self |
36
|
|
|
*/ |
37
|
13 |
|
public static function build($title, \DateTime $startTime) |
38
|
|
|
{ |
39
|
13 |
|
return new self($title, $startTime); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param int $value |
44
|
|
|
* @return self |
45
|
|
|
*/ |
46
|
1 |
|
public function withDuration($value) |
47
|
|
|
{ |
48
|
1 |
|
$self = clone $this; |
49
|
1 |
|
$self->duration = (int)$value; |
50
|
|
|
|
51
|
1 |
|
return $self; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @param int $value |
56
|
|
|
* @return self |
57
|
|
|
*/ |
58
|
1 |
|
public function withExtendDuration($value) |
59
|
|
|
{ |
60
|
1 |
|
$self = clone $this; |
61
|
1 |
|
$self->extendDuration = (int)$value; |
62
|
|
|
|
63
|
1 |
|
return $self; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param string $value |
68
|
|
|
* @return self |
69
|
|
|
*/ |
70
|
1 |
|
public function withTimeZone($value) |
71
|
|
|
{ |
72
|
1 |
|
$self = clone $this; |
73
|
1 |
|
$self->timeZone = (string)$value; |
74
|
|
|
|
75
|
1 |
|
return $self; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @return array |
80
|
|
|
*/ |
81
|
12 |
|
public function toArray() |
82
|
|
|
{ |
83
|
|
|
$params = [ |
84
|
12 |
|
'title' => $this->title, |
85
|
12 |
|
'start_time' => $this->startTime, |
86
|
12 |
|
'language_culture_name' => $this->languageCultureName, |
87
|
12 |
|
'extend_duration' => $this->extendDuration, |
88
|
12 |
|
'duration' => $this->duration, |
89
|
12 |
|
'time_zone' => $this->timeZone, |
90
|
12 |
|
'attendee_limit' => $this->attendeeLimit, |
91
|
12 |
|
'presenter_default_controls' => $this->presenterDefaultControls, |
92
|
12 |
|
'attendee_default_controls' => $this->attendeeDefaultControls, |
93
|
12 |
|
'create_recording' => $this->createRecording, |
94
|
12 |
|
'return_url' => $this->returnUrl, |
95
|
12 |
|
'status_ping_url' => $this->statusPingUrl, |
96
|
12 |
|
]; |
97
|
|
|
|
98
|
12 |
|
if ($this->presenterEmail) { |
99
|
1 |
|
$params['presenter_email'] = $this->presenterEmail; |
100
|
1 |
|
} else { |
101
|
11 |
|
$params['presenter_id'] = $this->presenterId; |
102
|
11 |
|
$params['presenter_name'] = $this->presenterName; |
103
|
|
|
} |
104
|
|
|
|
105
|
12 |
|
return $params; |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
|