Completed
Pull Request — master (#3233)
by Jan-Christoph
48:24 queued 36:20
created
core/Controller/ContactsMenuController.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -31,30 +31,30 @@
 block discarded – undo
31 31
 
32 32
 class ContactsMenuController extends Controller {
33 33
 
34
-	/** @var Manager */
35
-	private $manager;
36
-
37
-	/** @var string */
38
-	private $userId;
39
-
40
-	/**
41
-	 * @param IRequest $request
42
-	 * @param string $UserId
43
-	 */
44
-	public function __construct(IRequest $request, $UserId, Manager $manager) {
45
-		parent::__construct('core', $request);
46
-		$this->userId = $UserId;
47
-		$this->manager = $manager;
48
-	}
49
-
50
-	/**
51
-	 * @NoAdminRequired
52
-	 *
53
-	 * @param string|null filter
54
-	 * @return JSONResponse
55
-	 */
56
-	public function index($filter = null) {
57
-		return $this->manager->getEntries($this->userId, $filter);
58
-	}
34
+    /** @var Manager */
35
+    private $manager;
36
+
37
+    /** @var string */
38
+    private $userId;
39
+
40
+    /**
41
+     * @param IRequest $request
42
+     * @param string $UserId
43
+     */
44
+    public function __construct(IRequest $request, $UserId, Manager $manager) {
45
+        parent::__construct('core', $request);
46
+        $this->userId = $UserId;
47
+        $this->manager = $manager;
48
+    }
49
+
50
+    /**
51
+     * @NoAdminRequired
52
+     *
53
+     * @param string|null filter
54
+     * @return JSONResponse
55
+     */
56
+    public function index($filter = null) {
57
+        return $this->manager->getEntries($this->userId, $filter);
58
+    }
59 59
 
60 60
 }
Please login to merge, or discard this patch.
lib/private/Contacts/ContactsMenu/ActionFactory.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -30,28 +30,28 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/private/Contacts/ContactsMenu/Actions/LinkAction.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -28,76 +28,76 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -30,27 +30,27 @@
 block discarded – undo
30 30
 
31 31
 class EMailProvider implements IProvider {
32 32
 
33
-	/** @var IActionFactory */
34
-	private $actionFactory;
35
-
36
-	/**
37
-	 * @param IActionFactory $actionFactory
38
-	 */
39
-	public function __construct(IActionFactory $actionFactory) {
40
-		$this->actionFactory = $actionFactory;
41
-	}
42
-
43
-	/**
44
-	 * @param IEntry $entry
45
-	 */
46
-	public function process(IEntry $entry) {
47
-		foreach ($entry->getEMailAddresses() as $address) {
48
-			// TODO: absolute path
49
-			// TODO: meaningful URL
50
-			// TODO: l10n
51
-			$action = $this->actionFactory->newEMailAction('icon-mail', 'Mail', $address);
52
-			$entry->addAction($action);
53
-		}
54
-	}
33
+    /** @var IActionFactory */
34
+    private $actionFactory;
35
+
36
+    /**
37
+     * @param IActionFactory $actionFactory
38
+     */
39
+    public function __construct(IActionFactory $actionFactory) {
40
+        $this->actionFactory = $actionFactory;
41
+    }
42
+
43
+    /**
44
+     * @param IEntry $entry
45
+     */
46
+    public function process(IEntry $entry) {
47
+        foreach ($entry->getEMailAddresses() as $address) {
48
+            // TODO: absolute path
49
+            // TODO: meaningful URL
50
+            // TODO: l10n
51
+            $action = $this->actionFactory->newEMailAction('icon-mail', 'Mail', $address);
52
+            $entry->addAction($action);
53
+        }
54
+    }
55 55
 
56 56
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/IAction.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -33,33 +33,33 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/IActionFactory.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -28,27 +28,27 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/ILinkAction.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/IProvider.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@
 block discarded – undo
29 29
  */
30 30
 interface IProvider {
31 31
 
32
-	/**
33
-	 * @since 12.0
34
-	 * @param IEntry $entry
35
-	 */
36
-	public function process(IEntry $entry);
32
+    /**
33
+     * @since 12.0
34
+     * @param IEntry $entry
35
+     */
36
+    public function process(IEntry $entry);
37 37
 }
Please login to merge, or discard this patch.
lib/private/Contacts/ContactsMenu/Manager.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -30,69 +30,69 @@
 block discarded – undo
30 30
 
31 31
 class Manager {
32 32
 
33
-	/** @var ContactsStore */
34
-	private $store;
33
+    /** @var ContactsStore */
34
+    private $store;
35 35
 
36
-	/** @var ActionProviderStore */
37
-	private $actionProviderStore;
36
+    /** @var ActionProviderStore */
37
+    private $actionProviderStore;
38 38
 
39
-	/** @var IAppManager */
40
-	private $appManager;
39
+    /** @var IAppManager */
40
+    private $appManager;
41 41
 
42
-	/** @var IURLGenerator */
43
-	private $urlGenerator;
42
+    /** @var IURLGenerator */
43
+    private $urlGenerator;
44 44
 
45
-	/**
46
-	 * @param ContactsStore $store
47
-	 * @param ActionProviderStore $actionProviderStore
48
-	 * @param IAppManager $appManager
49
-	 */
50
-	public function __construct(ContactsStore $store, ActionProviderStore $actionProviderStore, IAppManager $appManager) {
51
-		$this->store = $store;
52
-		$this->actionProviderStore = $actionProviderStore;
53
-		$this->appManager = $appManager;
54
-	}
45
+    /**
46
+     * @param ContactsStore $store
47
+     * @param ActionProviderStore $actionProviderStore
48
+     * @param IAppManager $appManager
49
+     */
50
+    public function __construct(ContactsStore $store, ActionProviderStore $actionProviderStore, IAppManager $appManager) {
51
+        $this->store = $store;
52
+        $this->actionProviderStore = $actionProviderStore;
53
+        $this->appManager = $appManager;
54
+    }
55 55
 
56
-	/**
57
-	 * @param string $userId
58
-	 * @param string $filter
59
-	 * @return array
60
-	 */
61
-	public function getEntries($userId, $filter) {
62
-		$entries = $this->store->getContacts($filter);
56
+    /**
57
+     * @param string $userId
58
+     * @param string $filter
59
+     * @return array
60
+     */
61
+    public function getEntries($userId, $filter) {
62
+        $entries = $this->store->getContacts($filter);
63 63
 
64
-		$sortedEntries = $this->sortEntries($entries);
65
-		$topEntries = array_slice($sortedEntries, 0, 25);
66
-		$this->processEntries($topEntries);
64
+        $sortedEntries = $this->sortEntries($entries);
65
+        $topEntries = array_slice($sortedEntries, 0, 25);
66
+        $this->processEntries($topEntries);
67 67
 
68
-		$contactsEnabled = $this->appManager->isEnabledForUser('contacts', $userId);
69
-		return [
70
-			'contacts' => $topEntries,
71
-			'contactsAppEnabled' => $contactsEnabled,
72
-		];
73
-	}
68
+        $contactsEnabled = $this->appManager->isEnabledForUser('contacts', $userId);
69
+        return [
70
+            'contacts' => $topEntries,
71
+            'contactsAppEnabled' => $contactsEnabled,
72
+        ];
73
+    }
74 74
 
75
-	/**
76
-	 * @param IEntry[] $entries
77
-	 * @return IEntry[]
78
-	 */
79
-	private function sortEntries(array $entries) {
80
-		usort($entries, function(IEntry $entryA, IEntry $entryB) {
81
-			return strcasecmp($entryA->getFullName(), $entryB->getFullName());
82
-		});
83
-		return $entries;
84
-	}
75
+    /**
76
+     * @param IEntry[] $entries
77
+     * @return IEntry[]
78
+     */
79
+    private function sortEntries(array $entries) {
80
+        usort($entries, function(IEntry $entryA, IEntry $entryB) {
81
+            return strcasecmp($entryA->getFullName(), $entryB->getFullName());
82
+        });
83
+        return $entries;
84
+    }
85 85
 
86
-	/**
87
-	 * @param IEntry[] $entries
88
-	 */
89
-	private function processEntries(array $entries) {
90
-		$providers = $this->actionProviderStore->getProviders();
91
-		foreach ($entries as $entry) {
92
-			foreach ($providers as $provider) {
93
-				$provider->process($entry);
94
-			}
95
-		}
96
-	}
86
+    /**
87
+     * @param IEntry[] $entries
88
+     */
89
+    private function processEntries(array $entries) {
90
+        $providers = $this->actionProviderStore->getProviders();
91
+        foreach ($entries as $entry) {
92
+            foreach ($providers as $provider) {
93
+                $provider->process($entry);
94
+            }
95
+        }
96
+    }
97 97
 
98 98
 }
Please login to merge, or discard this patch.