1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of Phraseanet SDK. |
5
|
|
|
* |
6
|
|
|
* (c) Alchemy <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace PhraseanetSDK\Entity; |
13
|
|
|
|
14
|
|
|
class BasketValidationParticipant |
15
|
|
|
{ |
16
|
|
|
|
17
|
2 |
|
public static function fromList(array $values) |
18
|
|
|
{ |
19
|
2 |
|
$participants = array(); |
20
|
|
|
|
21
|
2 |
|
foreach ($values as $value) { |
22
|
2 |
|
$participants[] = self::fromValue($value); |
23
|
2 |
|
} |
24
|
|
|
|
25
|
2 |
|
return $participants; |
26
|
|
|
} |
27
|
|
|
|
28
|
3 |
|
public static function fromValue(\stdClass $value) |
29
|
|
|
{ |
30
|
3 |
|
return new self($value); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var \stdClass |
35
|
|
|
*/ |
36
|
|
|
protected $source; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var User |
40
|
|
|
*/ |
41
|
|
|
protected $user; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param \stdClass $source |
45
|
|
|
*/ |
46
|
3 |
|
public function __construct(\stdClass $source) |
47
|
|
|
{ |
48
|
3 |
|
$this->source = $source; |
49
|
3 |
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return \stdClass |
53
|
|
|
*/ |
54
|
|
|
public function getRawData() |
55
|
|
|
{ |
56
|
3 |
|
return $this->source; |
57
|
|
|
} |
58
|
3 |
|
|
59
|
|
|
/** |
60
|
|
|
* Get the user |
61
|
|
|
* |
62
|
|
|
* @return User |
63
|
|
|
*/ |
64
|
|
|
public function getUser() |
65
|
|
|
{ |
66
|
3 |
|
return $this->user ?: $this->user = User::fromValue($this->source->user); |
67
|
|
|
} |
68
|
3 |
|
|
69
|
|
|
/** |
70
|
|
|
* Tell whether the participant is confirmed |
71
|
|
|
* |
72
|
|
|
* @return bool |
73
|
|
|
*/ |
74
|
|
|
public function isConfirmed() |
75
|
|
|
{ |
76
|
3 |
|
return $this->source->confirmed; |
77
|
|
|
} |
78
|
3 |
|
|
79
|
|
|
/** |
80
|
|
|
* Tell whether the participant can agree |
81
|
|
|
* |
82
|
|
|
* @return bool |
83
|
|
|
*/ |
84
|
|
|
public function canAgree() |
85
|
|
|
{ |
86
|
3 |
|
return $this->source->can_agree; |
87
|
|
|
} |
88
|
3 |
|
|
89
|
|
|
/** |
90
|
|
|
* Tell whether the participant can see the other participants |
91
|
|
|
* |
92
|
|
|
* @return bool |
93
|
|
|
*/ |
94
|
|
|
public function canSeeOthers() |
95
|
|
|
{ |
96
|
|
|
return $this->source->can_see_others; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Tell whether the participant can access data in readonly mode |
101
|
|
|
* |
102
|
|
|
* @return bool |
103
|
|
|
*/ |
104
|
|
|
public function isReadOnly() |
105
|
|
|
{ |
106
|
|
|
return $this->source->readonly; |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|