diff options
-rw-r--r-- | appinfo/routes.php | 38 | ||||
-rw-r--r-- | lib/Controller/CollectionsController.php | 6 | ||||
-rw-r--r-- | lib/Controller/Response.php | 2 | ||||
-rw-r--r-- | lib/Controller/SettingsController.php | 4 | ||||
-rw-r--r-- | lib/Service/CollectionsService.php | 32 | ||||
-rw-r--r-- | lib/Service/SettingsService.php | 4 | ||||
-rw-r--r-- | templates/main.php | 6 | ||||
-rw-r--r-- | tests/php/integration/AppInfo/ApplicationTest.php | 1 | ||||
-rw-r--r-- | tests/php/unit/Controller/CollectionsControllerTest.php | 1 | ||||
-rw-r--r-- | tests/php/unit/Controller/PageControllerTest.php | 1 | ||||
-rw-r--r-- | tests/php/unit/Controller/SettingsControllerTest.php | 1 | ||||
-rw-r--r-- | tests/php/unit/Service/CollectionsServiceTest.php | 29 | ||||
-rw-r--r-- | tests/php/unit/Service/SettingsServiceTest.php | 1 |
13 files changed, 60 insertions, 66 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php index 79657225..6f0c7b24 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -1,24 +1,24 @@ <?php /** -* Nextcloud - Tasks -* -* @author Raimund Schlüßler -* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org> -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ + * Nextcloud - Tasks + * + * @author Raimund Schlüßler + * @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ return [ 'routes' => [ ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], diff --git a/lib/Controller/CollectionsController.php b/lib/Controller/CollectionsController.php index 98250d84..0dd46a71 100644 --- a/lib/Controller/CollectionsController.php +++ b/lib/Controller/CollectionsController.php @@ -40,7 +40,7 @@ class CollectionsController extends Controller { * @param IRequest $request an instance of the request * @param CollectionsService $collectionsService */ - public function __construct(string $appName, IRequest $request, CollectionsService $collectionsService){ + public function __construct(string $appName, IRequest $request, CollectionsService $collectionsService) { parent::__construct($appName, $request); $this->collectionsService = $collectionsService; } @@ -48,7 +48,7 @@ class CollectionsController extends Controller { /** * @NoAdminRequired */ - public function getCollections(){ + public function getCollections() { return $this->generateResponse(function () { return ['collections' => $this->collectionsService->getAll()]; }); @@ -57,7 +57,7 @@ class CollectionsController extends Controller { /** * @NoAdminRequired */ - public function setVisibility($collectionID, $visibility){ + public function setVisibility($collectionID, $visibility) { return $this->generateResponse(function () use ($collectionID, $visibility) { return $this->collectionsService->setVisibility($collectionID, $visibility); }); diff --git a/lib/Controller/Response.php b/lib/Controller/Response.php index 75064e7d..9dac6506 100644 --- a/lib/Controller/Response.php +++ b/lib/Controller/Response.php @@ -27,7 +27,7 @@ use \OCP\AppFramework\Http\JSONResponse; trait Response { - protected function generateResponse (Closure $callback) { + protected function generateResponse(Closure $callback) { try { $message = [ 'status' => 'success', diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 28934031..28bab89e 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -40,7 +40,7 @@ class SettingsController extends Controller { * @param IRequest $request an instance of the request * @param SettingsService $settingsService */ - public function __construct(string $appName, IRequest $request, SettingsService $settingsService){ + public function __construct(string $appName, IRequest $request, SettingsService $settingsService) { parent::__construct($appName, $request); $this->settingsService = $settingsService; } @@ -48,7 +48,7 @@ class SettingsController extends Controller { /** * @NoAdminRequired */ - public function get(){ + public function get() { return $this->generateResponse(function () { return ['settings' => $this->settingsService->get()]; }); diff --git a/lib/Service/CollectionsService.php b/lib/Service/CollectionsService.php index 76e3a0b7..c8a91053 100644 --- a/lib/Service/CollectionsService.php +++ b/lib/Service/CollectionsService.php @@ -66,41 +66,41 @@ class CollectionsService { * @return array */ public function getAll():array { - $collections = array( - array( + $collections = [ + [ 'id' => "starred", 'displayName' => (string)$this->l10n->t('Important'), 'show' => 2, - 'icon' => 'sprt-task-star'), - array( + 'icon' => 'sprt-task-star'], + [ 'id' => "today", 'displayName' => (string)$this->l10n->t('Today'), 'show' => 2, - 'icon' => 'sprt-calendar'), - array( + 'icon' => 'sprt-calendar'], + [ 'id' => "week", 'displayName' => (string)$this->l10n->t('Week'), 'show' => 2, - 'icon' => 'sprt-calendar'), - array( + 'icon' => 'sprt-calendar'], + [ 'id' => "all", 'displayName' => (string)$this->l10n->t('All'), 'show' => 2, - 'icon' => 'sprt-all'), - array( + 'icon' => 'sprt-all'], + [ 'id' => "current", 'displayName' => (string)$this->l10n->t('Current'), 'show' => 2, - 'icon' => 'sprt-current'), - array( + 'icon' => 'sprt-current'], + [ 'id' => "completed", 'displayName' => (string)$this->l10n->t('Completed'), 'show' => 2, - 'icon' => 'sprt-checkmark') - ); + 'icon' => 'sprt-checkmark'] + ]; foreach ($collections as $key => $collection){ $tmp = $this->settings->getUserValue($this->userId, $this->appName,'show_'.$collection['id']); - if (!in_array($tmp, array('0','1','2'))) { + if (!in_array($tmp, ['0','1','2'])) { $this->settings->setUserValue($this->userId, $this->appName,'show_'.$collection['id'],$collections[$key]['show']); } else { $collections[$key]['show'] = (int)$tmp; @@ -117,7 +117,7 @@ class CollectionsService { * @return bool */ public function setVisibility(string $collectionID, int $visibility):bool { - if (in_array($visibility, array(0,1,2))){ + if (in_array($visibility, [0,1,2])){ $this->settings->setUserValue($this->userId, $this->appName,'show_'.$collectionID,$visibility); } return true; diff --git a/lib/Service/SettingsService.php b/lib/Service/SettingsService.php index 5788173c..1c5bd0da 100644 --- a/lib/Service/SettingsService.php +++ b/lib/Service/SettingsService.php @@ -58,14 +58,14 @@ class SettingsService { * @return array */ public function get():array { - $settings = array( + $settings = [ 'defaultCalendarId' => (string)$this->settings->getUserValue($this->userId, $this->appName,'various_defaultCalendarId'), 'showHidden' => (int)$this->settings->getUserValue($this->userId, $this->appName,'various_showHidden'), 'sortOrder' => (string)$this->settings->getUserValue($this->userId, $this->appName,'various_sortOrder'), 'sortDirection' => (bool)$this->settings->getUserValue($this->userId, $this->appName,'various_sortDirection'), 'allDay' => (bool)$this->settings->getUserValue($this->userId, $this->appName,'various_allDay'), 'userID' => $this->userId - ); + ]; return $settings; } diff --git a/templates/main.php b/templates/main.php index 963cbbe7..df7f18ca 100644 --- a/templates/main.php +++ b/templates/main.php @@ -1,4 +1,4 @@ <?php - script('tasks', 'tasks'); - style('tasks', 'tasks'); -?> + + script('tasks', 'tasks'); + style('tasks', 'tasks'); diff --git a/tests/php/integration/AppInfo/ApplicationTest.php b/tests/php/integration/AppInfo/ApplicationTest.php index e1447fb1..a78fb33b 100644 --- a/tests/php/integration/AppInfo/ApplicationTest.php +++ b/tests/php/integration/AppInfo/ApplicationTest.php @@ -23,7 +23,6 @@ * */ -use OCP\AppFramework\App; use PHPUnit\Framework\TestCase; class AppTest extends TestCase { diff --git a/tests/php/unit/Controller/CollectionsControllerTest.php b/tests/php/unit/Controller/CollectionsControllerTest.php index 046bceac..bfcdde70 100644 --- a/tests/php/unit/Controller/CollectionsControllerTest.php +++ b/tests/php/unit/Controller/CollectionsControllerTest.php @@ -28,7 +28,6 @@ use OCP\IRequest; use PHPUnit\Framework\TestCase; - class CollectionsControllerTest extends TestCase { private $appName; diff --git a/tests/php/unit/Controller/PageControllerTest.php b/tests/php/unit/Controller/PageControllerTest.php index e74a934f..a6dba9fe 100644 --- a/tests/php/unit/Controller/PageControllerTest.php +++ b/tests/php/unit/Controller/PageControllerTest.php @@ -14,7 +14,6 @@ namespace OCA\Tasks\Controller; use OCP\AppFramework\Http\TemplateResponse; use PHPUnit\Framework\TestCase as Base; - class PageControllerTest extends Base { private $controller; diff --git a/tests/php/unit/Controller/SettingsControllerTest.php b/tests/php/unit/Controller/SettingsControllerTest.php index 4a534bea..7e9c99c8 100644 --- a/tests/php/unit/Controller/SettingsControllerTest.php +++ b/tests/php/unit/Controller/SettingsControllerTest.php @@ -28,7 +28,6 @@ use OCP\IRequest; use PHPUnit\Framework\TestCase; - class SettingsControllerTest extends TestCase { private $appName; diff --git a/tests/php/unit/Service/CollectionsServiceTest.php b/tests/php/unit/Service/CollectionsServiceTest.php index 3348e06c..eef7ef6c 100644 --- a/tests/php/unit/Service/CollectionsServiceTest.php +++ b/tests/php/unit/Service/CollectionsServiceTest.php @@ -28,7 +28,6 @@ use OCP\IL10N; use PHPUnit\Framework\TestCase; - class CollectionsServiceTest extends TestCase { private $collectionsService; @@ -56,38 +55,38 @@ class CollectionsServiceTest extends TestCase { } public function testGetAll() { - $return = array( - array( + $return = [ + [ 'id' => "starred", 'displayName' => 'Important', 'show' => 2, - 'icon' => 'sprt-task-star'), - array( + 'icon' => 'sprt-task-star'], + [ 'id' => "today", 'displayName' => 'Today', 'show' => 2, - 'icon' => 'sprt-calendar'), - array( + 'icon' => 'sprt-calendar'], + [ 'id' => "week", 'displayName' => 'Week', 'show' => 2, - 'icon' => 'sprt-calendar'), - array( + 'icon' => 'sprt-calendar'], + [ 'id' => "all", 'displayName' => 'All', 'show' => 2, - 'icon' => 'sprt-all'), - array( + 'icon' => 'sprt-all'], + [ 'id' => "current", 'displayName' => 'Current', 'show' => 2, - 'icon' => 'sprt-current'), - array( + 'icon' => 'sprt-current'], + [ 'id' => "completed", 'displayName' => 'Completed', 'show' => 2, - 'icon' => 'sprt-checkmark') - ); + 'icon' => 'sprt-checkmark'] + ]; $map = [ ['Important', [],'Important'], diff --git a/tests/php/unit/Service/SettingsServiceTest.php b/tests/php/unit/Service/SettingsServiceTest.php index ce4878f1..36ffa5f6 100644 --- a/tests/php/unit/Service/SettingsServiceTest.php +++ b/tests/php/unit/Service/SettingsServiceTest.php @@ -27,7 +27,6 @@ use OCP\IConfig; use PHPUnit\Framework\TestCase; - class SettingsServiceTest extends TestCase { private $settingsService; |