19declare(strict_types=1);
41 $this->
logger = $DIC->logger()->wsrv();
49 $instance =
new self();
50 $detailsOnServer = $instance->
loadFromServer($a_server_id, $a_econtent_id, $a_resource_type);
51 if ($detailsOnServer) {
52 $instance->loadFromJson($detailsOnServer);
62 $res = $connector->getResource($a_resource_type, $a_econtent_id,
true);
66 if (!is_object(
$res->getResult())) {
67 $this->
logger->error(__METHOD__ .
': Error parsing result. Expected result of type array.');
74 return $res->getResult();
89 return $this->senders[0] ?? 0;
114 return count($this->receivers) ? $this->receivers[0] : 0;
146 $this->
logger->info(print_r($json,
true));
147 foreach ((array) $json->senders as $sender) {
148 $this->senders[] = $sender->mid;
152 foreach ((array) $json->receivers as $receiver) {
153 $this->receivers[] = $receiver->mid;
154 if ($receiver->itsyou && $this->sender_index ===
null) {
155 $this->sender_index = $index;
161 for ($i = 0, $iMax = count($this->
getReceivers()); $i < $iMax; ++$i) {
162 $this->receiver_info[$this->senders[$i]] = $this->receivers[$i];
165 if (is_object($json->owner)) {
166 $this->owner = (
int) $json->owner->pid;
169 $this->url = $json->url;
const HTTP_CODE_NOT_FOUND
Presentation of ecs content details (http://...campusconnect/courselinks/id/details)
getMySender()
Get sender from whom we received the ressource According to the documentation the sender and receiver...
getFirstReceiver()
Get first receiver.
getReceiverInfo()
Get receiver info.
loadFromJson(object $json)
Load from JSON object.
getReceivers()
Get recievers.
static getInstanceFromServer(int $a_server_id, int $a_econtent_id, string $a_resource_type)
Get data from server.
getFirstSender()
get first sender
loadFromServer(int $a_server_id, int $a_econtent_id, string $a_resource_type)
static getInstanceByServerId(int $a_server_id)
Get singleton instance per server.
Component logger with individual log levels by component id.