Apply php-cs-fixer fixes

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
Raimund Schlüßler 2020-04-10 13:20:16 +02:00
parent e8213d582c
commit b49c85b1e9
13 changed files with 60 additions and 66 deletions

View File

@ -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'],

View File

@ -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);
});

View File

@ -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',

View File

@ -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()];
});

View File

@ -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;

View File

@ -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;
}

View File

@ -1,4 +1,4 @@
<?php
script('tasks', 'tasks');
style('tasks', 'tasks');
?>
script('tasks', 'tasks');
style('tasks', 'tasks');

View File

@ -23,7 +23,6 @@
*
*/
use OCP\AppFramework\App;
use PHPUnit\Framework\TestCase;
class AppTest extends TestCase {

View File

@ -28,7 +28,6 @@ use OCP\IRequest;
use PHPUnit\Framework\TestCase;
class CollectionsControllerTest extends TestCase {
private $appName;

View File

@ -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;

View File

@ -28,7 +28,6 @@ use OCP\IRequest;
use PHPUnit\Framework\TestCase;
class SettingsControllerTest extends TestCase {
private $appName;

View File

@ -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'],

View File

@ -27,7 +27,6 @@ use OCP\IConfig;
use PHPUnit\Framework\TestCase;
class SettingsServiceTest extends TestCase {
private $settingsService;