@@ -30,28 +30,28 @@  | 
                                                    ||
| 30 | 30 | |
| 31 | 31 |  class ActionFactory implements IActionFactory { | 
                                                        
| 32 | 32 | |
| 33 | - /**  | 
                                                        |
| 34 | - * @param string $icon  | 
                                                        |
| 35 | - * @param string $name  | 
                                                        |
| 36 | - * @param string $href  | 
                                                        |
| 37 | - * @return ILinkAction  | 
                                                        |
| 38 | - */  | 
                                                        |
| 39 | -	public function newLinkAction($icon, $name, $href) { | 
                                                        |
| 40 | - $action = new LinkAction();  | 
                                                        |
| 41 | - $action->setName($name);  | 
                                                        |
| 42 | - $action->setIcon($icon);  | 
                                                        |
| 43 | - $action->setHref($href);  | 
                                                        |
| 44 | - return $action;  | 
                                                        |
| 45 | - }  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * @param string $icon  | 
                                                        |
| 35 | + * @param string $name  | 
                                                        |
| 36 | + * @param string $href  | 
                                                        |
| 37 | + * @return ILinkAction  | 
                                                        |
| 38 | + */  | 
                                                        |
| 39 | +    public function newLinkAction($icon, $name, $href) { | 
                                                        |
| 40 | + $action = new LinkAction();  | 
                                                        |
| 41 | + $action->setName($name);  | 
                                                        |
| 42 | + $action->setIcon($icon);  | 
                                                        |
| 43 | + $action->setHref($href);  | 
                                                        |
| 44 | + return $action;  | 
                                                        |
| 45 | + }  | 
                                                        |
| 46 | 46 | |
| 47 | - /**  | 
                                                        |
| 48 | - * @param string $icon  | 
                                                        |
| 49 | - * @param string $name  | 
                                                        |
| 50 | - * @param string $email  | 
                                                        |
| 51 | - * @return ILinkAction  | 
                                                        |
| 52 | - */  | 
                                                        |
| 53 | -	public function newEMailAction($icon, $name, $email) { | 
                                                        |
| 54 | - return $this->newLinkAction($icon, $name, 'mailto:' . urlencode($email));  | 
                                                        |
| 55 | - }  | 
                                                        |
| 47 | + /**  | 
                                                        |
| 48 | + * @param string $icon  | 
                                                        |
| 49 | + * @param string $name  | 
                                                        |
| 50 | + * @param string $email  | 
                                                        |
| 51 | + * @return ILinkAction  | 
                                                        |
| 52 | + */  | 
                                                        |
| 53 | +    public function newEMailAction($icon, $name, $email) { | 
                                                        |
| 54 | + return $this->newLinkAction($icon, $name, 'mailto:' . urlencode($email));  | 
                                                        |
| 55 | + }  | 
                                                        |
| 56 | 56 | |
| 57 | 57 | }  | 
                                                        
@@ -51,7 +51,7 @@  | 
                                                    ||
| 51 | 51 | * @return ILinkAction  | 
                                                        
| 52 | 52 | */  | 
                                                        
| 53 | 53 |  	public function newEMailAction($icon, $name, $email) { | 
                                                        
| 54 | - return $this->newLinkAction($icon, $name, 'mailto:' . urlencode($email));  | 
                                                        |
| 54 | + return $this->newLinkAction($icon, $name, 'mailto:'.urlencode($email));  | 
                                                        |
| 55 | 55 | }  | 
                                                        
| 56 | 56 | |
| 57 | 57 | }  | 
                                                        
@@ -28,76 +28,76 @@  | 
                                                    ||
| 28 | 28 | |
| 29 | 29 |  class LinkAction implements ILinkAction { | 
                                                        
| 30 | 30 | |
| 31 | - /** @var string */  | 
                                                        |
| 32 | - private $icon;  | 
                                                        |
| 33 | -  | 
                                                        |
| 34 | - /** @var string */  | 
                                                        |
| 35 | - private $name;  | 
                                                        |
| 36 | -  | 
                                                        |
| 37 | - /** @var string */  | 
                                                        |
| 38 | - private $href;  | 
                                                        |
| 39 | -  | 
                                                        |
| 40 | - /** @var int */  | 
                                                        |
| 41 | - private $priority = 10;  | 
                                                        |
| 42 | -  | 
                                                        |
| 43 | - /**  | 
                                                        |
| 44 | - * @param string $icon absolute URI to an icon  | 
                                                        |
| 45 | - */  | 
                                                        |
| 46 | -	public function setIcon($icon) { | 
                                                        |
| 47 | - $this->icon = $icon;  | 
                                                        |
| 48 | - }  | 
                                                        |
| 49 | -  | 
                                                        |
| 50 | - /**  | 
                                                        |
| 51 | - * @param string $name  | 
                                                        |
| 52 | - */  | 
                                                        |
| 53 | -	public function setName($name) { | 
                                                        |
| 54 | - $this->name = $name;  | 
                                                        |
| 55 | - }  | 
                                                        |
| 56 | -  | 
                                                        |
| 57 | - /**  | 
                                                        |
| 58 | - * @return string  | 
                                                        |
| 59 | - */  | 
                                                        |
| 60 | -	public function getName() { | 
                                                        |
| 61 | - return $this->name;  | 
                                                        |
| 62 | - }  | 
                                                        |
| 63 | -  | 
                                                        |
| 64 | - /**  | 
                                                        |
| 65 | - * @param int $priority  | 
                                                        |
| 66 | - */  | 
                                                        |
| 67 | -	public function setPriority($priority) { | 
                                                        |
| 68 | - $this->priority = $priority;  | 
                                                        |
| 69 | - }  | 
                                                        |
| 70 | -  | 
                                                        |
| 71 | - /**  | 
                                                        |
| 72 | - * @return int  | 
                                                        |
| 73 | - */  | 
                                                        |
| 74 | -	public function getPriority() { | 
                                                        |
| 75 | - return $this->priority;  | 
                                                        |
| 76 | - }  | 
                                                        |
| 77 | -  | 
                                                        |
| 78 | - /**  | 
                                                        |
| 79 | - * @param string $href  | 
                                                        |
| 80 | - */  | 
                                                        |
| 81 | -	public function setHref($href) { | 
                                                        |
| 82 | - $this->href = $href;  | 
                                                        |
| 83 | - }  | 
                                                        |
| 84 | -  | 
                                                        |
| 85 | - /**  | 
                                                        |
| 86 | - * @return string  | 
                                                        |
| 87 | - */  | 
                                                        |
| 88 | -	public function getHref() { | 
                                                        |
| 89 | - return $this->href;  | 
                                                        |
| 90 | - }  | 
                                                        |
| 91 | -  | 
                                                        |
| 92 | - /**  | 
                                                        |
| 93 | - * @return array  | 
                                                        |
| 94 | - */  | 
                                                        |
| 95 | -	public function jsonSerialize() { | 
                                                        |
| 96 | - return [  | 
                                                        |
| 97 | - 'title' => $this->name,  | 
                                                        |
| 98 | - 'icon' => $this->icon,  | 
                                                        |
| 99 | - 'hyperlink' => $this->href,  | 
                                                        |
| 100 | - ];  | 
                                                        |
| 101 | - }  | 
                                                        |
| 31 | + /** @var string */  | 
                                                        |
| 32 | + private $icon;  | 
                                                        |
| 33 | +  | 
                                                        |
| 34 | + /** @var string */  | 
                                                        |
| 35 | + private $name;  | 
                                                        |
| 36 | +  | 
                                                        |
| 37 | + /** @var string */  | 
                                                        |
| 38 | + private $href;  | 
                                                        |
| 39 | +  | 
                                                        |
| 40 | + /** @var int */  | 
                                                        |
| 41 | + private $priority = 10;  | 
                                                        |
| 42 | +  | 
                                                        |
| 43 | + /**  | 
                                                        |
| 44 | + * @param string $icon absolute URI to an icon  | 
                                                        |
| 45 | + */  | 
                                                        |
| 46 | +    public function setIcon($icon) { | 
                                                        |
| 47 | + $this->icon = $icon;  | 
                                                        |
| 48 | + }  | 
                                                        |
| 49 | +  | 
                                                        |
| 50 | + /**  | 
                                                        |
| 51 | + * @param string $name  | 
                                                        |
| 52 | + */  | 
                                                        |
| 53 | +    public function setName($name) { | 
                                                        |
| 54 | + $this->name = $name;  | 
                                                        |
| 55 | + }  | 
                                                        |
| 56 | +  | 
                                                        |
| 57 | + /**  | 
                                                        |
| 58 | + * @return string  | 
                                                        |
| 59 | + */  | 
                                                        |
| 60 | +    public function getName() { | 
                                                        |
| 61 | + return $this->name;  | 
                                                        |
| 62 | + }  | 
                                                        |
| 63 | +  | 
                                                        |
| 64 | + /**  | 
                                                        |
| 65 | + * @param int $priority  | 
                                                        |
| 66 | + */  | 
                                                        |
| 67 | +    public function setPriority($priority) { | 
                                                        |
| 68 | + $this->priority = $priority;  | 
                                                        |
| 69 | + }  | 
                                                        |
| 70 | +  | 
                                                        |
| 71 | + /**  | 
                                                        |
| 72 | + * @return int  | 
                                                        |
| 73 | + */  | 
                                                        |
| 74 | +    public function getPriority() { | 
                                                        |
| 75 | + return $this->priority;  | 
                                                        |
| 76 | + }  | 
                                                        |
| 77 | +  | 
                                                        |
| 78 | + /**  | 
                                                        |
| 79 | + * @param string $href  | 
                                                        |
| 80 | + */  | 
                                                        |
| 81 | +    public function setHref($href) { | 
                                                        |
| 82 | + $this->href = $href;  | 
                                                        |
| 83 | + }  | 
                                                        |
| 84 | +  | 
                                                        |
| 85 | + /**  | 
                                                        |
| 86 | + * @return string  | 
                                                        |
| 87 | + */  | 
                                                        |
| 88 | +    public function getHref() { | 
                                                        |
| 89 | + return $this->href;  | 
                                                        |
| 90 | + }  | 
                                                        |
| 91 | +  | 
                                                        |
| 92 | + /**  | 
                                                        |
| 93 | + * @return array  | 
                                                        |
| 94 | + */  | 
                                                        |
| 95 | +    public function jsonSerialize() { | 
                                                        |
| 96 | + return [  | 
                                                        |
| 97 | + 'title' => $this->name,  | 
                                                        |
| 98 | + 'icon' => $this->icon,  | 
                                                        |
| 99 | + 'hyperlink' => $this->href,  | 
                                                        |
| 100 | + ];  | 
                                                        |
| 101 | + }  | 
                                                        |
| 102 | 102 | |
| 103 | 103 | }  | 
                                                        
@@ -33,33 +33,33 @@  | 
                                                    ||
| 33 | 33 | */  | 
                                                        
| 34 | 34 |  interface IAction extends JsonSerializable { | 
                                                        
| 35 | 35 | |
| 36 | - /**  | 
                                                        |
| 37 | - * @param string $icon absolute URI to an icon  | 
                                                        |
| 38 | - * @since 12.0  | 
                                                        |
| 39 | - */  | 
                                                        |
| 40 | - public function setIcon($icon);  | 
                                                        |
| 36 | + /**  | 
                                                        |
| 37 | + * @param string $icon absolute URI to an icon  | 
                                                        |
| 38 | + * @since 12.0  | 
                                                        |
| 39 | + */  | 
                                                        |
| 40 | + public function setIcon($icon);  | 
                                                        |
| 41 | 41 | |
| 42 | - /**  | 
                                                        |
| 43 | - * @return string localized action name, e.g. 'Call'  | 
                                                        |
| 44 | - * @since 12.0  | 
                                                        |
| 45 | - */  | 
                                                        |
| 46 | - public function getName();  | 
                                                        |
| 42 | + /**  | 
                                                        |
| 43 | + * @return string localized action name, e.g. 'Call'  | 
                                                        |
| 44 | + * @since 12.0  | 
                                                        |
| 45 | + */  | 
                                                        |
| 46 | + public function getName();  | 
                                                        |
| 47 | 47 | |
| 48 | - /**  | 
                                                        |
| 49 | - * @param string $name localized action name, e.g. 'Call'  | 
                                                        |
| 50 | - * @since 12.0  | 
                                                        |
| 51 | - */  | 
                                                        |
| 52 | - public function setName($name);  | 
                                                        |
| 48 | + /**  | 
                                                        |
| 49 | + * @param string $name localized action name, e.g. 'Call'  | 
                                                        |
| 50 | + * @since 12.0  | 
                                                        |
| 51 | + */  | 
                                                        |
| 52 | + public function setName($name);  | 
                                                        |
| 53 | 53 | |
| 54 | - /**  | 
                                                        |
| 55 | - * @param int $priority priorize actions, high order ones are shown on top  | 
                                                        |
| 56 | - * @since 12.0  | 
                                                        |
| 57 | - */  | 
                                                        |
| 58 | - public function setPriority($priority);  | 
                                                        |
| 54 | + /**  | 
                                                        |
| 55 | + * @param int $priority priorize actions, high order ones are shown on top  | 
                                                        |
| 56 | + * @since 12.0  | 
                                                        |
| 57 | + */  | 
                                                        |
| 58 | + public function setPriority($priority);  | 
                                                        |
| 59 | 59 | |
| 60 | - /**  | 
                                                        |
| 61 | - * @return int priority to priorize actions, high order ones are shown on top  | 
                                                        |
| 62 | - * @since 12.0  | 
                                                        |
| 63 | - */  | 
                                                        |
| 64 | - public function getPriority();  | 
                                                        |
| 60 | + /**  | 
                                                        |
| 61 | + * @return int priority to priorize actions, high order ones are shown on top  | 
                                                        |
| 62 | + * @since 12.0  | 
                                                        |
| 63 | + */  | 
                                                        |
| 64 | + public function getPriority();  | 
                                                        |
| 65 | 65 | }  | 
                                                        
@@ -28,27 +28,27 @@  | 
                                                    ||
| 28 | 28 | */  | 
                                                        
| 29 | 29 |  interface IActionFactory { | 
                                                        
| 30 | 30 | |
| 31 | - /**  | 
                                                        |
| 32 | - * Construct and return a new link action for the contacts menu  | 
                                                        |
| 33 | - *  | 
                                                        |
| 34 | - * @since 12.0  | 
                                                        |
| 35 | - *  | 
                                                        |
| 36 | - * @param string $icon full path to the action's icon  | 
                                                        |
| 37 | - * @param string $name localized name of the action  | 
                                                        |
| 38 | - * @param string $href target URL  | 
                                                        |
| 39 | - * @return ILinkAction  | 
                                                        |
| 40 | - */  | 
                                                        |
| 41 | - public function newLinkAction($icon, $name, $href);  | 
                                                        |
| 31 | + /**  | 
                                                        |
| 32 | + * Construct and return a new link action for the contacts menu  | 
                                                        |
| 33 | + *  | 
                                                        |
| 34 | + * @since 12.0  | 
                                                        |
| 35 | + *  | 
                                                        |
| 36 | + * @param string $icon full path to the action's icon  | 
                                                        |
| 37 | + * @param string $name localized name of the action  | 
                                                        |
| 38 | + * @param string $href target URL  | 
                                                        |
| 39 | + * @return ILinkAction  | 
                                                        |
| 40 | + */  | 
                                                        |
| 41 | + public function newLinkAction($icon, $name, $href);  | 
                                                        |
| 42 | 42 | |
| 43 | - /**  | 
                                                        |
| 44 | - * Construct and return a new email action for the contacts menu  | 
                                                        |
| 45 | - *  | 
                                                        |
| 46 | - * @since 12.0  | 
                                                        |
| 47 | - *  | 
                                                        |
| 48 | - * @param string $icon full path to the action's icon  | 
                                                        |
| 49 | - * @param string $name localized name of the action  | 
                                                        |
| 50 | - * @param string $email target e-mail address  | 
                                                        |
| 51 | - * @return ILinkAction  | 
                                                        |
| 52 | - */  | 
                                                        |
| 53 | - public function newEMailAction($icon, $name, $email);  | 
                                                        |
| 43 | + /**  | 
                                                        |
| 44 | + * Construct and return a new email action for the contacts menu  | 
                                                        |
| 45 | + *  | 
                                                        |
| 46 | + * @since 12.0  | 
                                                        |
| 47 | + *  | 
                                                        |
| 48 | + * @param string $icon full path to the action's icon  | 
                                                        |
| 49 | + * @param string $name localized name of the action  | 
                                                        |
| 50 | + * @param string $email target e-mail address  | 
                                                        |
| 51 | + * @return ILinkAction  | 
                                                        |
| 52 | + */  | 
                                                        |
| 53 | + public function newEMailAction($icon, $name, $email);  | 
                                                        |
| 54 | 54 | }  | 
                                                        
@@ -29,15 +29,15 @@  | 
                                                    ||
| 29 | 29 | */  | 
                                                        
| 30 | 30 |  interface ILinkAction extends IAction { | 
                                                        
| 31 | 31 | |
| 32 | - /**  | 
                                                        |
| 33 | - * @since 12.0  | 
                                                        |
| 34 | - * @param string $href the target URL of the action  | 
                                                        |
| 35 | - */  | 
                                                        |
| 36 | - public function setHref($href);  | 
                                                        |
| 32 | + /**  | 
                                                        |
| 33 | + * @since 12.0  | 
                                                        |
| 34 | + * @param string $href the target URL of the action  | 
                                                        |
| 35 | + */  | 
                                                        |
| 36 | + public function setHref($href);  | 
                                                        |
| 37 | 37 | |
| 38 | - /**  | 
                                                        |
| 39 | - * @since 12.0  | 
                                                        |
| 40 | - * @return string  | 
                                                        |
| 41 | - */  | 
                                                        |
| 42 | - public function getHref();  | 
                                                        |
| 38 | + /**  | 
                                                        |
| 39 | + * @since 12.0  | 
                                                        |
| 40 | + * @return string  | 
                                                        |
| 41 | + */  | 
                                                        |
| 42 | + public function getHref();  | 
                                                        |
| 43 | 43 | }  | 
                                                        
@@ -29,141 +29,141 @@  | 
                                                    ||
| 29 | 29 | |
| 30 | 30 |  class Entry implements IEntry { | 
                                                        
| 31 | 31 | |
| 32 | - /** @var string|int|null */  | 
                                                        |
| 33 | - private $id = null;  | 
                                                        |
| 34 | -  | 
                                                        |
| 35 | - /** @var string */  | 
                                                        |
| 36 | - private $fullName = '';  | 
                                                        |
| 37 | -  | 
                                                        |
| 38 | - /** @var string[] */  | 
                                                        |
| 39 | - private $emailAddresses = [];  | 
                                                        |
| 40 | -  | 
                                                        |
| 41 | - /** @var string|null */  | 
                                                        |
| 42 | - private $avatar;  | 
                                                        |
| 43 | -  | 
                                                        |
| 44 | - /** @var IAction[] */  | 
                                                        |
| 45 | - private $actions = [];  | 
                                                        |
| 46 | -  | 
                                                        |
| 47 | - /** @var array */  | 
                                                        |
| 48 | - private $properties = [];  | 
                                                        |
| 49 | -  | 
                                                        |
| 50 | - /**  | 
                                                        |
| 51 | - * @param string $id  | 
                                                        |
| 52 | - */  | 
                                                        |
| 53 | -	public function setId($id) { | 
                                                        |
| 54 | - $this->id = $id;  | 
                                                        |
| 55 | - }  | 
                                                        |
| 56 | -  | 
                                                        |
| 57 | - /**  | 
                                                        |
| 58 | - * @param string $displayName  | 
                                                        |
| 59 | - */  | 
                                                        |
| 60 | -	public function setFullName($displayName) { | 
                                                        |
| 61 | - $this->fullName = $displayName;  | 
                                                        |
| 62 | - }  | 
                                                        |
| 63 | -  | 
                                                        |
| 64 | - /**  | 
                                                        |
| 65 | - * @return string  | 
                                                        |
| 66 | - */  | 
                                                        |
| 67 | -	public function getFullName() { | 
                                                        |
| 68 | - return $this->fullName;  | 
                                                        |
| 69 | - }  | 
                                                        |
| 70 | -  | 
                                                        |
| 71 | - /**  | 
                                                        |
| 72 | - * @param string $address  | 
                                                        |
| 73 | - */  | 
                                                        |
| 74 | -	public function addEMailAddress($address) { | 
                                                        |
| 75 | - $this->emailAddresses[] = $address;  | 
                                                        |
| 76 | - }  | 
                                                        |
| 77 | -  | 
                                                        |
| 78 | - /**  | 
                                                        |
| 79 | - * @return string  | 
                                                        |
| 80 | - */  | 
                                                        |
| 81 | -	public function getEMailAddresses() { | 
                                                        |
| 82 | - return $this->emailAddresses;  | 
                                                        |
| 83 | - }  | 
                                                        |
| 84 | -  | 
                                                        |
| 85 | - /**  | 
                                                        |
| 86 | - * @param string $avatar  | 
                                                        |
| 87 | - */  | 
                                                        |
| 88 | -	public function setAvatar($avatar) { | 
                                                        |
| 89 | - $this->avatar = $avatar;  | 
                                                        |
| 90 | - }  | 
                                                        |
| 91 | -  | 
                                                        |
| 92 | - /**  | 
                                                        |
| 93 | - * @return string  | 
                                                        |
| 94 | - */  | 
                                                        |
| 95 | -	public function getAvatar() { | 
                                                        |
| 96 | - return $this->avatar;  | 
                                                        |
| 97 | - }  | 
                                                        |
| 98 | -  | 
                                                        |
| 99 | - /**  | 
                                                        |
| 100 | - * @param IAction $action  | 
                                                        |
| 101 | - */  | 
                                                        |
| 102 | -	public function addAction(IAction $action) { | 
                                                        |
| 103 | - $this->actions[] = $action;  | 
                                                        |
| 104 | - $this->sortActions();  | 
                                                        |
| 105 | - }  | 
                                                        |
| 106 | -  | 
                                                        |
| 107 | - /**  | 
                                                        |
| 108 | - * @return IAction[]  | 
                                                        |
| 109 | - */  | 
                                                        |
| 110 | -	public function getActions() { | 
                                                        |
| 111 | - return $this->actions;  | 
                                                        |
| 112 | - }  | 
                                                        |
| 113 | -  | 
                                                        |
| 114 | - /**  | 
                                                        |
| 115 | - * sort the actions by priority and name  | 
                                                        |
| 116 | - */  | 
                                                        |
| 117 | -	private function sortActions() { | 
                                                        |
| 118 | -		usort($this->actions, function(IAction $action1, IAction $action2) { | 
                                                        |
| 119 | - $prio1 = $action1->getPriority();  | 
                                                        |
| 120 | - $prio2 = $action2->getPriority();  | 
                                                        |
| 121 | -  | 
                                                        |
| 122 | -			if ($prio1 === $prio2) { | 
                                                        |
| 123 | - // Ascending order for same priority  | 
                                                        |
| 124 | - return strcasecmp($action1->getName(), $action2->getName());  | 
                                                        |
| 125 | - }  | 
                                                        |
| 126 | -  | 
                                                        |
| 127 | - // Descending order when priority differs  | 
                                                        |
| 128 | - return $prio2 - $prio1;  | 
                                                        |
| 129 | - });  | 
                                                        |
| 130 | - }  | 
                                                        |
| 131 | -  | 
                                                        |
| 132 | - /**  | 
                                                        |
| 133 | - * @param array $contact key-value array containing additional properties  | 
                                                        |
| 134 | - */  | 
                                                        |
| 135 | -	public function setProperties(array $contact) { | 
                                                        |
| 136 | - $this->properties = $contact;  | 
                                                        |
| 137 | - }  | 
                                                        |
| 138 | -  | 
                                                        |
| 139 | - /**  | 
                                                        |
| 140 | - * @param string $key  | 
                                                        |
| 141 | - * @return mixed  | 
                                                        |
| 142 | - */  | 
                                                        |
| 143 | -	public function getProperty($key) { | 
                                                        |
| 144 | -		if (!isset($this->properties[$key])) { | 
                                                        |
| 145 | - return null;  | 
                                                        |
| 146 | - }  | 
                                                        |
| 147 | - return $this->properties[$key];  | 
                                                        |
| 148 | - }  | 
                                                        |
| 149 | -  | 
                                                        |
| 150 | - /**  | 
                                                        |
| 151 | - * @return array  | 
                                                        |
| 152 | - */  | 
                                                        |
| 153 | -	public function jsonSerialize() { | 
                                                        |
| 154 | - $topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null;  | 
                                                        |
| 155 | -		$otherActions = array_map(function(IAction $action) { | 
                                                        |
| 156 | - return $action->jsonSerialize();  | 
                                                        |
| 157 | - }, array_slice($this->actions, 1));  | 
                                                        |
| 158 | -  | 
                                                        |
| 159 | - return [  | 
                                                        |
| 160 | - 'id' => $this->id,  | 
                                                        |
| 161 | - 'fullName' => $this->fullName,  | 
                                                        |
| 162 | - 'avatar' => $this->getAvatar(),  | 
                                                        |
| 163 | - 'topAction' => $topAction,  | 
                                                        |
| 164 | - 'actions' => $otherActions,  | 
                                                        |
| 165 | - 'lastMessage' => '',  | 
                                                        |
| 166 | - ];  | 
                                                        |
| 167 | - }  | 
                                                        |
| 32 | + /** @var string|int|null */  | 
                                                        |
| 33 | + private $id = null;  | 
                                                        |
| 34 | +  | 
                                                        |
| 35 | + /** @var string */  | 
                                                        |
| 36 | + private $fullName = '';  | 
                                                        |
| 37 | +  | 
                                                        |
| 38 | + /** @var string[] */  | 
                                                        |
| 39 | + private $emailAddresses = [];  | 
                                                        |
| 40 | +  | 
                                                        |
| 41 | + /** @var string|null */  | 
                                                        |
| 42 | + private $avatar;  | 
                                                        |
| 43 | +  | 
                                                        |
| 44 | + /** @var IAction[] */  | 
                                                        |
| 45 | + private $actions = [];  | 
                                                        |
| 46 | +  | 
                                                        |
| 47 | + /** @var array */  | 
                                                        |
| 48 | + private $properties = [];  | 
                                                        |
| 49 | +  | 
                                                        |
| 50 | + /**  | 
                                                        |
| 51 | + * @param string $id  | 
                                                        |
| 52 | + */  | 
                                                        |
| 53 | +    public function setId($id) { | 
                                                        |
| 54 | + $this->id = $id;  | 
                                                        |
| 55 | + }  | 
                                                        |
| 56 | +  | 
                                                        |
| 57 | + /**  | 
                                                        |
| 58 | + * @param string $displayName  | 
                                                        |
| 59 | + */  | 
                                                        |
| 60 | +    public function setFullName($displayName) { | 
                                                        |
| 61 | + $this->fullName = $displayName;  | 
                                                        |
| 62 | + }  | 
                                                        |
| 63 | +  | 
                                                        |
| 64 | + /**  | 
                                                        |
| 65 | + * @return string  | 
                                                        |
| 66 | + */  | 
                                                        |
| 67 | +    public function getFullName() { | 
                                                        |
| 68 | + return $this->fullName;  | 
                                                        |
| 69 | + }  | 
                                                        |
| 70 | +  | 
                                                        |
| 71 | + /**  | 
                                                        |
| 72 | + * @param string $address  | 
                                                        |
| 73 | + */  | 
                                                        |
| 74 | +    public function addEMailAddress($address) { | 
                                                        |
| 75 | + $this->emailAddresses[] = $address;  | 
                                                        |
| 76 | + }  | 
                                                        |
| 77 | +  | 
                                                        |
| 78 | + /**  | 
                                                        |
| 79 | + * @return string  | 
                                                        |
| 80 | + */  | 
                                                        |
| 81 | +    public function getEMailAddresses() { | 
                                                        |
| 82 | + return $this->emailAddresses;  | 
                                                        |
| 83 | + }  | 
                                                        |
| 84 | +  | 
                                                        |
| 85 | + /**  | 
                                                        |
| 86 | + * @param string $avatar  | 
                                                        |
| 87 | + */  | 
                                                        |
| 88 | +    public function setAvatar($avatar) { | 
                                                        |
| 89 | + $this->avatar = $avatar;  | 
                                                        |
| 90 | + }  | 
                                                        |
| 91 | +  | 
                                                        |
| 92 | + /**  | 
                                                        |
| 93 | + * @return string  | 
                                                        |
| 94 | + */  | 
                                                        |
| 95 | +    public function getAvatar() { | 
                                                        |
| 96 | + return $this->avatar;  | 
                                                        |
| 97 | + }  | 
                                                        |
| 98 | +  | 
                                                        |
| 99 | + /**  | 
                                                        |
| 100 | + * @param IAction $action  | 
                                                        |
| 101 | + */  | 
                                                        |
| 102 | +    public function addAction(IAction $action) { | 
                                                        |
| 103 | + $this->actions[] = $action;  | 
                                                        |
| 104 | + $this->sortActions();  | 
                                                        |
| 105 | + }  | 
                                                        |
| 106 | +  | 
                                                        |
| 107 | + /**  | 
                                                        |
| 108 | + * @return IAction[]  | 
                                                        |
| 109 | + */  | 
                                                        |
| 110 | +    public function getActions() { | 
                                                        |
| 111 | + return $this->actions;  | 
                                                        |
| 112 | + }  | 
                                                        |
| 113 | +  | 
                                                        |
| 114 | + /**  | 
                                                        |
| 115 | + * sort the actions by priority and name  | 
                                                        |
| 116 | + */  | 
                                                        |
| 117 | +    private function sortActions() { | 
                                                        |
| 118 | +        usort($this->actions, function(IAction $action1, IAction $action2) { | 
                                                        |
| 119 | + $prio1 = $action1->getPriority();  | 
                                                        |
| 120 | + $prio2 = $action2->getPriority();  | 
                                                        |
| 121 | +  | 
                                                        |
| 122 | +            if ($prio1 === $prio2) { | 
                                                        |
| 123 | + // Ascending order for same priority  | 
                                                        |
| 124 | + return strcasecmp($action1->getName(), $action2->getName());  | 
                                                        |
| 125 | + }  | 
                                                        |
| 126 | +  | 
                                                        |
| 127 | + // Descending order when priority differs  | 
                                                        |
| 128 | + return $prio2 - $prio1;  | 
                                                        |
| 129 | + });  | 
                                                        |
| 130 | + }  | 
                                                        |
| 131 | +  | 
                                                        |
| 132 | + /**  | 
                                                        |
| 133 | + * @param array $contact key-value array containing additional properties  | 
                                                        |
| 134 | + */  | 
                                                        |
| 135 | +    public function setProperties(array $contact) { | 
                                                        |
| 136 | + $this->properties = $contact;  | 
                                                        |
| 137 | + }  | 
                                                        |
| 138 | +  | 
                                                        |
| 139 | + /**  | 
                                                        |
| 140 | + * @param string $key  | 
                                                        |
| 141 | + * @return mixed  | 
                                                        |
| 142 | + */  | 
                                                        |
| 143 | +    public function getProperty($key) { | 
                                                        |
| 144 | +        if (!isset($this->properties[$key])) { | 
                                                        |
| 145 | + return null;  | 
                                                        |
| 146 | + }  | 
                                                        |
| 147 | + return $this->properties[$key];  | 
                                                        |
| 148 | + }  | 
                                                        |
| 149 | +  | 
                                                        |
| 150 | + /**  | 
                                                        |
| 151 | + * @return array  | 
                                                        |
| 152 | + */  | 
                                                        |
| 153 | +    public function jsonSerialize() { | 
                                                        |
| 154 | + $topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null;  | 
                                                        |
| 155 | +        $otherActions = array_map(function(IAction $action) { | 
                                                        |
| 156 | + return $action->jsonSerialize();  | 
                                                        |
| 157 | + }, array_slice($this->actions, 1));  | 
                                                        |
| 158 | +  | 
                                                        |
| 159 | + return [  | 
                                                        |
| 160 | + 'id' => $this->id,  | 
                                                        |
| 161 | + 'fullName' => $this->fullName,  | 
                                                        |
| 162 | + 'avatar' => $this->getAvatar(),  | 
                                                        |
| 163 | + 'topAction' => $topAction,  | 
                                                        |
| 164 | + 'actions' => $otherActions,  | 
                                                        |
| 165 | + 'lastMessage' => '',  | 
                                                        |
| 166 | + ];  | 
                                                        |
| 167 | + }  | 
                                                        |
| 168 | 168 | |
| 169 | 169 | }  | 
                                                        
@@ -31,36 +31,36 @@  | 
                                                    ||
| 31 | 31 | */  | 
                                                        
| 32 | 32 |  interface IEntry extends JsonSerializable { | 
                                                        
| 33 | 33 | |
| 34 | - /**  | 
                                                        |
| 35 | - * @since 12.0  | 
                                                        |
| 36 | - * @return string  | 
                                                        |
| 37 | - */  | 
                                                        |
| 38 | - public function getFullName();  | 
                                                        |
| 34 | + /**  | 
                                                        |
| 35 | + * @since 12.0  | 
                                                        |
| 36 | + * @return string  | 
                                                        |
| 37 | + */  | 
                                                        |
| 38 | + public function getFullName();  | 
                                                        |
| 39 | 39 | |
| 40 | - /**  | 
                                                        |
| 41 | - * @since 12.0  | 
                                                        |
| 42 | - * @return string[]  | 
                                                        |
| 43 | - */  | 
                                                        |
| 44 | - public function getEMailAddresses();  | 
                                                        |
| 40 | + /**  | 
                                                        |
| 41 | + * @since 12.0  | 
                                                        |
| 42 | + * @return string[]  | 
                                                        |
| 43 | + */  | 
                                                        |
| 44 | + public function getEMailAddresses();  | 
                                                        |
| 45 | 45 | |
| 46 | - /**  | 
                                                        |
| 47 | - * @since 12.0  | 
                                                        |
| 48 | - * @return string|null image URI  | 
                                                        |
| 49 | - */  | 
                                                        |
| 50 | - public function getAvatar();  | 
                                                        |
| 46 | + /**  | 
                                                        |
| 47 | + * @since 12.0  | 
                                                        |
| 48 | + * @return string|null image URI  | 
                                                        |
| 49 | + */  | 
                                                        |
| 50 | + public function getAvatar();  | 
                                                        |
| 51 | 51 | |
| 52 | - /**  | 
                                                        |
| 53 | - * @since 12.0  | 
                                                        |
| 54 | - * @param IAction $action an action to show in the contacts menu  | 
                                                        |
| 55 | - */  | 
                                                        |
| 56 | - public function addAction(IAction $action);  | 
                                                        |
| 52 | + /**  | 
                                                        |
| 53 | + * @since 12.0  | 
                                                        |
| 54 | + * @param IAction $action an action to show in the contacts menu  | 
                                                        |
| 55 | + */  | 
                                                        |
| 56 | + public function addAction(IAction $action);  | 
                                                        |
| 57 | 57 | |
| 58 | - /**  | 
                                                        |
| 59 | - * Get an arbitrary property from the contact  | 
                                                        |
| 60 | - *  | 
                                                        |
| 61 | - * @since 12.0  | 
                                                        |
| 62 | - * @param string $key  | 
                                                        |
| 63 | - * @return mixed the value of the property or null  | 
                                                        |
| 64 | - */  | 
                                                        |
| 65 | - public function getProperty($key);  | 
                                                        |
| 58 | + /**  | 
                                                        |
| 59 | + * Get an arbitrary property from the contact  | 
                                                        |
| 60 | + *  | 
                                                        |
| 61 | + * @since 12.0  | 
                                                        |
| 62 | + * @param string $key  | 
                                                        |
| 63 | + * @return mixed the value of the property or null  | 
                                                        |
| 64 | + */  | 
                                                        |
| 65 | + public function getProperty($key);  | 
                                                        |
| 66 | 66 | }  | 
                                                        
@@ -35,36 +35,36 @@ discard block  | 
                                                    ||
| 35 | 35 | |
| 36 | 36 | $application = new Application();  | 
                                                        
| 37 | 37 | $application->registerRoutes($this, [  | 
                                                        
| 38 | - 'routes' => [  | 
                                                        |
| 39 | - ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'],  | 
                                                        |
| 40 | -		['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'], | 
                                                        |
| 41 | -		['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'], | 
                                                        |
| 42 | - ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'],  | 
                                                        |
| 43 | -		['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'], | 
                                                        |
| 44 | - ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'],  | 
                                                        |
| 45 | - ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'],  | 
                                                        |
| 46 | - ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'],  | 
                                                        |
| 47 | - ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'],  | 
                                                        |
| 48 | - ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'],  | 
                                                        |
| 49 | - ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'],  | 
                                                        |
| 50 | - ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'],  | 
                                                        |
| 51 | - ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'],  | 
                                                        |
| 52 | - ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'],  | 
                                                        |
| 53 | -		['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'], | 
                                                        |
| 54 | -		['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'], | 
                                                        |
| 55 | - ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'],  | 
                                                        |
| 56 | - ['name' => 'Preview#getPreview', 'url' => '/core/preview', 'verb' => 'GET'],  | 
                                                        |
| 57 | - ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'],  | 
                                                        |
| 58 | -		['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'], | 
                                                        |
| 59 | -		['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'], | 
                                                        |
| 60 | - ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'GET'],  | 
                                                        |
| 61 | - ],  | 
                                                        |
| 62 | - 'ocs' => [  | 
                                                        |
| 63 | - ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],  | 
                                                        |
| 64 | - ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'],  | 
                                                        |
| 65 | - ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'],  | 
                                                        |
| 66 | -		['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'], | 
                                                        |
| 67 | - ],  | 
                                                        |
| 38 | + 'routes' => [  | 
                                                        |
| 39 | + ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'],  | 
                                                        |
| 40 | +        ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'], | 
                                                        |
| 41 | +        ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'], | 
                                                        |
| 42 | + ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'],  | 
                                                        |
| 43 | +        ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'], | 
                                                        |
| 44 | + ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'],  | 
                                                        |
| 45 | + ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'],  | 
                                                        |
| 46 | + ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'],  | 
                                                        |
| 47 | + ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'],  | 
                                                        |
| 48 | + ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'],  | 
                                                        |
| 49 | + ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'],  | 
                                                        |
| 50 | + ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'],  | 
                                                        |
| 51 | + ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'],  | 
                                                        |
| 52 | + ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'],  | 
                                                        |
| 53 | +        ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'], | 
                                                        |
| 54 | +        ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'], | 
                                                        |
| 55 | + ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'],  | 
                                                        |
| 56 | + ['name' => 'Preview#getPreview', 'url' => '/core/preview', 'verb' => 'GET'],  | 
                                                        |
| 57 | + ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'],  | 
                                                        |
| 58 | +        ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'], | 
                                                        |
| 59 | +        ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'], | 
                                                        |
| 60 | + ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'GET'],  | 
                                                        |
| 61 | + ],  | 
                                                        |
| 62 | + 'ocs' => [  | 
                                                        |
| 63 | + ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],  | 
                                                        |
| 64 | + ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'],  | 
                                                        |
| 65 | + ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'],  | 
                                                        |
| 66 | +        ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'], | 
                                                        |
| 67 | + ],  | 
                                                        |
| 68 | 68 | ]);  | 
                                                        
| 69 | 69 | |
| 70 | 70 | // Post installation check  | 
                                                        
@@ -73,62 +73,62 @@ discard block  | 
                                                    ||
| 73 | 73 | // Core ajax actions  | 
                                                        
| 74 | 74 | // Search  | 
                                                        
| 75 | 75 |  $this->create('search_ajax_search', '/core/search') | 
                                                        
| 76 | -	->actionInclude('core/search/ajax/search.php'); | 
                                                        |
| 76 | +    ->actionInclude('core/search/ajax/search.php'); | 
                                                        |
| 77 | 77 | // Routing  | 
                                                        
| 78 | 78 |  $this->create('core_ajax_update', '/core/ajax/update.php') | 
                                                        
| 79 | -	->actionInclude('core/ajax/update.php'); | 
                                                        |
| 79 | +    ->actionInclude('core/ajax/update.php'); | 
                                                        |
| 80 | 80 | |
| 81 | 81 | // File routes  | 
                                                        
| 82 | 82 |  $this->create('files.viewcontroller.showFile', '/f/{fileid}')->action(function($urlParams) { | 
                                                        
| 83 | - $app = new \OCA\Files\AppInfo\Application($urlParams);  | 
                                                        |
| 84 | -	$app->dispatch('ViewController', 'index'); | 
                                                        |
| 83 | + $app = new \OCA\Files\AppInfo\Application($urlParams);  | 
                                                        |
| 84 | +    $app->dispatch('ViewController', 'index'); | 
                                                        |
| 85 | 85 | });  | 
                                                        
| 86 | 86 | |
| 87 | 87 | // Call routes  | 
                                                        
| 88 | 88 |  $this->create('spreed.pagecontroller.showCall', '/call/{token}')->action(function($urlParams) { | 
                                                        
| 89 | -	if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) { | 
                                                        |
| 90 | - $app = new \OCA\Spreed\AppInfo\Application($urlParams);  | 
                                                        |
| 91 | -		$app->dispatch('PageController', 'index'); | 
                                                        |
| 92 | -	} else { | 
                                                        |
| 93 | -		throw new \OC\HintException('App spreed is not enabled'); | 
                                                        |
| 94 | - }  | 
                                                        |
| 89 | +    if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) { | 
                                                        |
| 90 | + $app = new \OCA\Spreed\AppInfo\Application($urlParams);  | 
                                                        |
| 91 | +        $app->dispatch('PageController', 'index'); | 
                                                        |
| 92 | +    } else { | 
                                                        |
| 93 | +        throw new \OC\HintException('App spreed is not enabled'); | 
                                                        |
| 94 | + }  | 
                                                        |
| 95 | 95 | });  | 
                                                        
| 96 | 96 | |
| 97 | 97 | // Sharing routes  | 
                                                        
| 98 | 98 |  $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) { | 
                                                        
| 99 | -	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { | 
                                                        |
| 100 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);  | 
                                                        |
| 101 | -		$app->dispatch('ShareController', 'showShare'); | 
                                                        |
| 102 | -	} else { | 
                                                        |
| 103 | -		throw new \OC\HintException('App file sharing is not enabled'); | 
                                                        |
| 104 | - }  | 
                                                        |
| 99 | +    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { | 
                                                        |
| 100 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);  | 
                                                        |
| 101 | +        $app->dispatch('ShareController', 'showShare'); | 
                                                        |
| 102 | +    } else { | 
                                                        |
| 103 | +        throw new \OC\HintException('App file sharing is not enabled'); | 
                                                        |
| 104 | + }  | 
                                                        |
| 105 | 105 | });  | 
                                                        
| 106 | 106 |  $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate')->post()->action(function($urlParams) { | 
                                                        
| 107 | -	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { | 
                                                        |
| 108 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);  | 
                                                        |
| 109 | -		$app->dispatch('ShareController', 'authenticate'); | 
                                                        |
| 110 | -	} else { | 
                                                        |
| 111 | -		throw new \OC\HintException('App file sharing is not enabled'); | 
                                                        |
| 112 | - }  | 
                                                        |
| 107 | +    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { | 
                                                        |
| 108 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);  | 
                                                        |
| 109 | +        $app->dispatch('ShareController', 'authenticate'); | 
                                                        |
| 110 | +    } else { | 
                                                        |
| 111 | +        throw new \OC\HintException('App file sharing is not enabled'); | 
                                                        |
| 112 | + }  | 
                                                        |
| 113 | 113 | });  | 
                                                        
| 114 | 114 |  $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate')->get()->action(function($urlParams) { | 
                                                        
| 115 | -	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { | 
                                                        |
| 116 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);  | 
                                                        |
| 117 | -		$app->dispatch('ShareController', 'showAuthenticate'); | 
                                                        |
| 118 | -	} else { | 
                                                        |
| 119 | -		throw new \OC\HintException('App file sharing is not enabled'); | 
                                                        |
| 120 | - }  | 
                                                        |
| 115 | +    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { | 
                                                        |
| 116 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);  | 
                                                        |
| 117 | +        $app->dispatch('ShareController', 'showAuthenticate'); | 
                                                        |
| 118 | +    } else { | 
                                                        |
| 119 | +        throw new \OC\HintException('App file sharing is not enabled'); | 
                                                        |
| 120 | + }  | 
                                                        |
| 121 | 121 | });  | 
                                                        
| 122 | 122 |  $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function($urlParams) { | 
                                                        
| 123 | -	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { | 
                                                        |
| 124 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);  | 
                                                        |
| 125 | -		$app->dispatch('ShareController', 'downloadShare'); | 
                                                        |
| 126 | -	} else { | 
                                                        |
| 127 | -		throw new \OC\HintException('App file sharing is not enabled'); | 
                                                        |
| 128 | - }  | 
                                                        |
| 123 | +    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { | 
                                                        |
| 124 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);  | 
                                                        |
| 125 | +        $app->dispatch('ShareController', 'downloadShare'); | 
                                                        |
| 126 | +    } else { | 
                                                        |
| 127 | +        throw new \OC\HintException('App file sharing is not enabled'); | 
                                                        |
| 128 | + }  | 
                                                        |
| 129 | 129 | });  | 
                                                        
| 130 | 130 | |
| 131 | 131 | // used for heartbeat  | 
                                                        
| 132 | 132 |  $this->create('heartbeat', '/heartbeat')->action(function(){ | 
                                                        
| 133 | - // do nothing  | 
                                                        |
| 133 | + // do nothing  | 
                                                        |
| 134 | 134 | });  | 
                                                        
@@ -32,31 +32,31 @@  | 
                                                    ||
| 32 | 32 | |
| 33 | 33 |  class ContactsMenuController extends Controller { | 
                                                        
| 34 | 34 | |
| 35 | - /** @var Manager */  | 
                                                        |
| 36 | - private $manager;  | 
                                                        |
| 37 | -  | 
                                                        |
| 38 | - /** @var IUserSession */  | 
                                                        |
| 39 | - private $userSession;  | 
                                                        |
| 40 | -  | 
                                                        |
| 41 | - /**  | 
                                                        |
| 42 | - * @param IRequest $request  | 
                                                        |
| 43 | - * @param IUserSession $userSession  | 
                                                        |
| 44 | - * @param Manager $manager  | 
                                                        |
| 45 | - */  | 
                                                        |
| 46 | -	public function __construct(IRequest $request, IUserSession $userSession, Manager $manager) { | 
                                                        |
| 47 | -		parent::__construct('core', $request); | 
                                                        |
| 48 | - $this->userSession = $userSession;  | 
                                                        |
| 49 | - $this->manager = $manager;  | 
                                                        |
| 50 | - }  | 
                                                        |
| 51 | -  | 
                                                        |
| 52 | - /**  | 
                                                        |
| 53 | - * @NoAdminRequired  | 
                                                        |
| 54 | - *  | 
                                                        |
| 55 | - * @param string|null filter  | 
                                                        |
| 56 | - * @return JSONResponse  | 
                                                        |
| 57 | - */  | 
                                                        |
| 58 | -	public function index($filter = null) { | 
                                                        |
| 59 | - return $this->manager->getEntries($this->userSession->getUser(), $filter);  | 
                                                        |
| 60 | - }  | 
                                                        |
| 35 | + /** @var Manager */  | 
                                                        |
| 36 | + private $manager;  | 
                                                        |
| 37 | +  | 
                                                        |
| 38 | + /** @var IUserSession */  | 
                                                        |
| 39 | + private $userSession;  | 
                                                        |
| 40 | +  | 
                                                        |
| 41 | + /**  | 
                                                        |
| 42 | + * @param IRequest $request  | 
                                                        |
| 43 | + * @param IUserSession $userSession  | 
                                                        |
| 44 | + * @param Manager $manager  | 
                                                        |
| 45 | + */  | 
                                                        |
| 46 | +    public function __construct(IRequest $request, IUserSession $userSession, Manager $manager) { | 
                                                        |
| 47 | +        parent::__construct('core', $request); | 
                                                        |
| 48 | + $this->userSession = $userSession;  | 
                                                        |
| 49 | + $this->manager = $manager;  | 
                                                        |
| 50 | + }  | 
                                                        |
| 51 | +  | 
                                                        |
| 52 | + /**  | 
                                                        |
| 53 | + * @NoAdminRequired  | 
                                                        |
| 54 | + *  | 
                                                        |
| 55 | + * @param string|null filter  | 
                                                        |
| 56 | + * @return JSONResponse  | 
                                                        |
| 57 | + */  | 
                                                        |
| 58 | +    public function index($filter = null) { | 
                                                        |
| 59 | + return $this->manager->getEntries($this->userSession->getUser(), $filter);  | 
                                                        |
| 60 | + }  | 
                                                        |
| 61 | 61 | |
| 62 | 62 | }  |