|
|
|
|
@ -1,4 +1,7 @@
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
|
|
|
*
|
|
|
|
|
@ -49,56 +52,56 @@ class Entry implements IEntry {
|
|
|
|
|
/**
|
|
|
|
|
* @param string $id
|
|
|
|
|
*/
|
|
|
|
|
public function setId($id) {
|
|
|
|
|
public function setId(string $id): void {
|
|
|
|
|
$this->id = $id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $displayName
|
|
|
|
|
*/
|
|
|
|
|
public function setFullName($displayName) {
|
|
|
|
|
public function setFullName(string $displayName): void {
|
|
|
|
|
$this->fullName = $displayName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getFullName() {
|
|
|
|
|
public function getFullName(): string {
|
|
|
|
|
return $this->fullName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $address
|
|
|
|
|
*/
|
|
|
|
|
public function addEMailAddress($address) {
|
|
|
|
|
public function addEMailAddress(string $address): void {
|
|
|
|
|
$this->emailAddresses[] = $address;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
* @return string[]
|
|
|
|
|
*/
|
|
|
|
|
public function getEMailAddresses() {
|
|
|
|
|
public function getEMailAddresses(): array {
|
|
|
|
|
return $this->emailAddresses;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $avatar
|
|
|
|
|
*/
|
|
|
|
|
public function setAvatar($avatar) {
|
|
|
|
|
public function setAvatar(string $avatar): void {
|
|
|
|
|
$this->avatar = $avatar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getAvatar() {
|
|
|
|
|
public function getAvatar(): ?string {
|
|
|
|
|
return $this->avatar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param IAction $action
|
|
|
|
|
*/
|
|
|
|
|
public function addAction(IAction $action) {
|
|
|
|
|
public function addAction(IAction $action): void {
|
|
|
|
|
$this->actions[] = $action;
|
|
|
|
|
$this->sortActions();
|
|
|
|
|
}
|
|
|
|
|
@ -106,14 +109,14 @@ class Entry implements IEntry {
|
|
|
|
|
/**
|
|
|
|
|
* @return IAction[]
|
|
|
|
|
*/
|
|
|
|
|
public function getActions() {
|
|
|
|
|
public function getActions(): array {
|
|
|
|
|
return $this->actions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* sort the actions by priority and name
|
|
|
|
|
*/
|
|
|
|
|
private function sortActions() {
|
|
|
|
|
private function sortActions(): void {
|
|
|
|
|
usort($this->actions, function (IAction $action1, IAction $action2) {
|
|
|
|
|
$prio1 = $action1->getPriority();
|
|
|
|
|
$prio2 = $action2->getPriority();
|
|
|
|
|
@ -131,7 +134,7 @@ class Entry implements IEntry {
|
|
|
|
|
/**
|
|
|
|
|
* @param array $contact key-value array containing additional properties
|
|
|
|
|
*/
|
|
|
|
|
public function setProperties(array $contact) {
|
|
|
|
|
public function setProperties(array $contact): void {
|
|
|
|
|
$this->properties = $contact;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -139,7 +142,7 @@ class Entry implements IEntry {
|
|
|
|
|
* @param string $key
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public function getProperty($key) {
|
|
|
|
|
public function getProperty(string $key) {
|
|
|
|
|
if (!isset($this->properties[$key])) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
@ -149,7 +152,7 @@ class Entry implements IEntry {
|
|
|
|
|
/**
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function jsonSerialize() {
|
|
|
|
|
public function jsonSerialize(): array {
|
|
|
|
|
$topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null;
|
|
|
|
|
$otherActions = array_map(function (IAction $action) {
|
|
|
|
|
return $action->jsonSerialize();
|
|
|
|
|
|