Skip to content

Commit

Permalink
Fix php cs issues
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Apr 22, 2020
1 parent 7ad5daa commit 52febb3
Show file tree
Hide file tree
Showing 130 changed files with 1,117 additions and 1,473 deletions.
2 changes: 0 additions & 2 deletions appinfo/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

namespace OCA\Deck\AppInfo;

use OCP\AppFramework\App;

/**
* Additional autoloader registration, e.g. registering composer autoloaders
*/
Expand Down
94 changes: 46 additions & 48 deletions lib/Activity/ActivityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
use OCP\IUser;

class ActivityManager {

const DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED = 'DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED';
public const DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED = 'DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED';
private $manager;
private $userId;
private $permissionService;
Expand All @@ -60,49 +59,49 @@ class ActivityManager {
private $stackMapper;
private $l10n;

const DECK_OBJECT_BOARD = 'deck_board';
const DECK_OBJECT_CARD = 'deck_card';

const SUBJECT_BOARD_CREATE = 'board_create';
const SUBJECT_BOARD_UPDATE = 'board_update';
const SUBJECT_BOARD_UPDATE_TITLE = 'board_update_title';
const SUBJECT_BOARD_UPDATE_ARCHIVED = 'board_update_archived';
const SUBJECT_BOARD_DELETE = 'board_delete';
const SUBJECT_BOARD_RESTORE = 'board_restore';
const SUBJECT_BOARD_SHARE = 'board_share';
const SUBJECT_BOARD_UNSHARE = 'board_unshare';

const SUBJECT_STACK_CREATE = 'stack_create';
const SUBJECT_STACK_UPDATE = 'stack_update';
const SUBJECT_STACK_UPDATE_TITLE = 'stack_update_title';
const SUBJECT_STACK_UPDATE_ORDER = 'stack_update_order';
const SUBJECT_STACK_DELETE = 'stack_delete';

const SUBJECT_CARD_CREATE = 'card_create';
const SUBJECT_CARD_DELETE = 'card_delete';
const SUBJECT_CARD_RESTORE = 'card_restore';
const SUBJECT_CARD_UPDATE = 'card_update';
const SUBJECT_CARD_UPDATE_TITLE = 'card_update_title';
const SUBJECT_CARD_UPDATE_DESCRIPTION = 'card_update_description';
const SUBJECT_CARD_UPDATE_DUEDATE = 'card_update_duedate';
const SUBJECT_CARD_UPDATE_ARCHIVE = 'card_update_archive';
const SUBJECT_CARD_UPDATE_UNARCHIVE = 'card_update_unarchive';
const SUBJECT_CARD_UPDATE_STACKID = 'card_update_stackId';
const SUBJECT_CARD_USER_ASSIGN = 'card_user_assign';
const SUBJECT_CARD_USER_UNASSIGN = 'card_user_unassign';

const SUBJECT_ATTACHMENT_CREATE = 'attachment_create';
const SUBJECT_ATTACHMENT_UPDATE = 'attachment_update';
const SUBJECT_ATTACHMENT_DELETE = 'attachment_delete';
const SUBJECT_ATTACHMENT_RESTORE = 'attachment_restore';

const SUBJECT_LABEL_CREATE = 'label_create';
const SUBJECT_LABEL_UPDATE = 'label_update';
const SUBJECT_LABEL_DELETE = 'label_delete';
const SUBJECT_LABEL_ASSIGN = 'label_assign';
const SUBJECT_LABEL_UNASSING = 'label_unassign';

const SUBJECT_CARD_COMMENT_CREATE = 'card_comment_create';
public const DECK_OBJECT_BOARD = 'deck_board';
public const DECK_OBJECT_CARD = 'deck_card';

public const SUBJECT_BOARD_CREATE = 'board_create';
public const SUBJECT_BOARD_UPDATE = 'board_update';
public const SUBJECT_BOARD_UPDATE_TITLE = 'board_update_title';
public const SUBJECT_BOARD_UPDATE_ARCHIVED = 'board_update_archived';
public const SUBJECT_BOARD_DELETE = 'board_delete';
public const SUBJECT_BOARD_RESTORE = 'board_restore';
public const SUBJECT_BOARD_SHARE = 'board_share';
public const SUBJECT_BOARD_UNSHARE = 'board_unshare';

public const SUBJECT_STACK_CREATE = 'stack_create';
public const SUBJECT_STACK_UPDATE = 'stack_update';
public const SUBJECT_STACK_UPDATE_TITLE = 'stack_update_title';
public const SUBJECT_STACK_UPDATE_ORDER = 'stack_update_order';
public const SUBJECT_STACK_DELETE = 'stack_delete';

public const SUBJECT_CARD_CREATE = 'card_create';
public const SUBJECT_CARD_DELETE = 'card_delete';
public const SUBJECT_CARD_RESTORE = 'card_restore';
public const SUBJECT_CARD_UPDATE = 'card_update';
public const SUBJECT_CARD_UPDATE_TITLE = 'card_update_title';
public const SUBJECT_CARD_UPDATE_DESCRIPTION = 'card_update_description';
public const SUBJECT_CARD_UPDATE_DUEDATE = 'card_update_duedate';
public const SUBJECT_CARD_UPDATE_ARCHIVE = 'card_update_archive';
public const SUBJECT_CARD_UPDATE_UNARCHIVE = 'card_update_unarchive';
public const SUBJECT_CARD_UPDATE_STACKID = 'card_update_stackId';
public const SUBJECT_CARD_USER_ASSIGN = 'card_user_assign';
public const SUBJECT_CARD_USER_UNASSIGN = 'card_user_unassign';

public const SUBJECT_ATTACHMENT_CREATE = 'attachment_create';
public const SUBJECT_ATTACHMENT_UPDATE = 'attachment_update';
public const SUBJECT_ATTACHMENT_DELETE = 'attachment_delete';
public const SUBJECT_ATTACHMENT_RESTORE = 'attachment_restore';

public const SUBJECT_LABEL_CREATE = 'label_create';
public const SUBJECT_LABEL_UPDATE = 'label_update';
public const SUBJECT_LABEL_DELETE = 'label_delete';
public const SUBJECT_LABEL_ASSIGN = 'label_assign';
public const SUBJECT_LABEL_UNASSING = 'label_unassign';

public const SUBJECT_CARD_COMMENT_CREATE = 'card_comment_create';

public function __construct(
IManager $manager,
Expand Down Expand Up @@ -197,7 +196,7 @@ public function getActivityFormat($subjectIdentifier, $subjectParams = [], $ownA
case self::SUBJECT_CARD_UPDATE_DUEDATE:
if (!isset($subjectParams['after'])) {
$subject = $ownActivity ? $this->l10n->t('You have removed the due date of card {card}') : $this->l10n->t('{user} has removed the due date of card {card}');
} else if (!isset($subjectParams['before']) && isset($subjectParams['after'])) {
} elseif (!isset($subjectParams['before']) && isset($subjectParams['after'])) {
$subject = $ownActivity ? $this->l10n->t('You have set the due date of card {card} to {after}') : $this->l10n->t('{user} has set the due date of card {card} to {after}');
} else {
$subject = $ownActivity ? $this->l10n->t('You have updated the due date of card {card} to {after}') : $this->l10n->t('{user} has updated the due date of card {card} to {after}');
Expand Down Expand Up @@ -376,7 +375,7 @@ private function createEvent($objectType, $entity, $subject, $additionalParams =
break;
}

if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION){
if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION) {
$card = $subjectParams['card'];
if ($card->getLastEditor() === $this->userId) {
return null;
Expand Down Expand Up @@ -526,5 +525,4 @@ private function findDetailsForAcl($aclId) {
'board' => $board
];
}

}
2 changes: 0 additions & 2 deletions lib/Activity/ChangeSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@

namespace OCA\Deck\Activity;


class ChangeSet implements \JsonSerializable {

private $before;
private $after;
private $diff = false;
Expand Down
7 changes: 3 additions & 4 deletions lib/Activity/CommentEventHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public function __construct(ActivityManager $activityManager, NotificationHelper
* @param CommentsEvent $event
*/
public function handle(CommentsEvent $event) {
if($event->getComment()->getObjectType() !== 'deckCard') {
if ($event->getComment()->getObjectType() !== 'deckCard') {
return;
}

$eventType = $event->getEvent();
if( $eventType === CommentsEvent::EVENT_ADD
if ($eventType === CommentsEvent::EVENT_ADD
) {
$this->notificationHandler($event);
$this->activityHandler($event);
Expand All @@ -65,7 +65,7 @@ public function handle(CommentsEvent $event) {
$applicableEvents = [
CommentsEvent::EVENT_UPDATE
];
if(in_array($eventType, $applicableEvents)) {
if (in_array($eventType, $applicableEvents)) {
$this->notificationHandler($event);
return;
}
Expand All @@ -79,7 +79,6 @@ private function activityHandler(CommentsEvent $event) {
$comment = $event->getComment();
$card = $this->cardMapper->find($comment->getObjectId());
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_CARD_COMMENT_CREATE, ['comment' => $comment]);

}

/**
Expand Down
1 change: 0 additions & 1 deletion lib/Activity/DeckProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

namespace OCA\Deck\Activity;


use cogpowered\FineDiff\Diff;
use OCA\Deck\Db\Acl;
use OCP\Activity\IEvent;
Expand Down
2 changes: 0 additions & 2 deletions lib/Activity/DescriptionSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

namespace OCA\Deck\Activity;


class DescriptionSetting extends Setting {

/**
Expand All @@ -41,5 +40,4 @@ public function getIdentifier() {
public function getName() {
return $this->l->t('A <strong>card description</strong> inside the Deck app has been changed');
}

}
1 change: 0 additions & 1 deletion lib/Activity/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
use OCP\IURLGenerator;

class Filter implements \OCP\Activity\IFilter {

private $l10n;
private $urlGenerator;

Expand Down
1 change: 0 additions & 1 deletion lib/Activity/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

namespace OCA\Deck\Activity;


use OCP\IL10N;

class Setting implements \OCP\Activity\ISetting {
Expand Down
2 changes: 0 additions & 2 deletions lib/Activity/SettingComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

namespace OCA\Deck\Activity;


class SettingComment extends Setting {

/**
Expand All @@ -49,5 +48,4 @@ public function getName() {
public function canChangeStream() {
return false;
}

}
56 changes: 26 additions & 30 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
namespace OCA\Deck\AppInfo;

use Exception;
use InvalidArgumentException;
use OC_Util;
use OCA\Deck\Activity\CommentEventHandler;
use OCA\Deck\Capabilities;
Expand Down Expand Up @@ -52,10 +51,8 @@
use OCP\IUserManager;
use OCP\IURLGenerator;
use OCP\Util;
use Symfony\Component\EventDispatcher\GenericEvent;

class Application extends App {

public const APP_ID = 'deck';

public const COMMENT_ENTITY_TYPE = 'deckCard';
Expand All @@ -69,7 +66,7 @@ class Application extends App {
/** @var IFullTextSearchManager */
private $fullTextSearchManager;

public function __construct(array $urlParams = array()) {
public function __construct(array $urlParams = []) {
parent::__construct('deck', $urlParams);

$container = $this->getContainer();
Expand All @@ -81,10 +78,10 @@ public function __construct(array $urlParams = array()) {
$container->registerMiddleWare(ExceptionMiddleware::class);
$container->registerMiddleWare(DefaultBoardMiddleware::class);

$container->registerService('databaseType', static function() use ($server) {
$container->registerService('databaseType', static function () use ($server) {
return $server->getConfig()->getSystemValue('dbtype', 'sqlite');
});
$container->registerService('database4ByteSupport', static function() use ($server) {
$container->registerService('database4ByteSupport', static function () use ($server) {
return $server->getDatabaseConnection()->supports4ByteText();
});
}
Expand All @@ -100,7 +97,7 @@ public function register(): void {

public function registerNavigationEntry(): void {
$container = $this->getContainer();
$this->server->getNavigationManager()->add(static function() use ($container) {
$this->server->getNavigationManager()->add(static function () use ($container) {
$urlGenerator = $container->query(IURLGenerator::class);
return [
'id' => 'deck',
Expand All @@ -117,7 +114,7 @@ private function registerUserGroupHooks(): void {
// Delete user/group acl entries when they get deleted
/** @var IUserManager $userManager */
$userManager = $this->server->getUserManager();
$userManager->listen('\OC\User', 'postDelete', static function(IUser $user) use ($container) {
$userManager->listen('\OC\User', 'postDelete', static function (IUser $user) use ($container) {
// delete existing acl entries for deleted user
/** @var AclMapper $aclMapper */
$aclMapper = $container->query(AclMapper::class);
Expand All @@ -135,7 +132,7 @@ private function registerUserGroupHooks(): void {

/** @var IUserManager $userManager */
$groupManager = $this->server->getGroupManager();
$groupManager->listen('\OC\Group', 'postDelete', static function(IGroup $group) use ($container) {
$groupManager->listen('\OC\Group', 'postDelete', static function (IGroup $group) use ($container) {
/** @var AclMapper $aclMapper */
$aclMapper = $container->query(AclMapper::class);
$aclMapper->findByParticipant(Acl::PERMISSION_TYPE_GROUP, $group->getGID());
Expand All @@ -152,8 +149,8 @@ public function registerNotifications(): void {
}

public function registerCommentsEntity(): void {
$this->server->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) {
$event->addEntityCollection(self::COMMENT_ENTITY_TYPE, function($name) {
$this->server->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) {
$event->addEntityCollection(self::COMMENT_ENTITY_TYPE, function ($name) {
/** @var CardMapper */
$cardMapper = $this->getContainer()->query(CardMapper::class);
$permissionService = $this->getContainer()->query(PermissionService::class);
Expand Down Expand Up @@ -222,35 +219,34 @@ public function registerFullTextSearch(): void {
/** @var IEventDispatcher $eventDispatcher */
$eventDispatcher = $this->server->query(IEventDispatcher::class);
$eventDispatcher->addListener(
'\OCA\Deck\Card::onCreate', function(Event $e) {
$this->fullTextSearchService->onCardCreated($e);
}
'\OCA\Deck\Card::onCreate', function (Event $e) {
$this->fullTextSearchService->onCardCreated($e);
}
);
$eventDispatcher->addListener(
'\OCA\Deck\Card::onUpdate', function(Event $e) {
$this->fullTextSearchService->onCardUpdated($e);
}
'\OCA\Deck\Card::onUpdate', function (Event $e) {
$this->fullTextSearchService->onCardUpdated($e);
}
);
$eventDispatcher->addListener(
'\OCA\Deck\Card::onDelete', function(Event $e) {
$this->fullTextSearchService->onCardDeleted($e);
}
'\OCA\Deck\Card::onDelete', function (Event $e) {
$this->fullTextSearchService->onCardDeleted($e);
}
);
$eventDispatcher->addListener(
'\OCA\Deck\Board::onShareNew', function(Event $e) {
$this->fullTextSearchService->onBoardShares($e);
}
'\OCA\Deck\Board::onShareNew', function (Event $e) {
$this->fullTextSearchService->onBoardShares($e);
}
);
$eventDispatcher->addListener(
'\OCA\Deck\Board::onShareEdit', function(Event $e) {
$this->fullTextSearchService->onBoardShares($e);
}
'\OCA\Deck\Board::onShareEdit', function (Event $e) {
$this->fullTextSearchService->onBoardShares($e);
}
);
$eventDispatcher->addListener(
'\OCA\Deck\Board::onShareDelete', function(Event $e) {
$this->fullTextSearchService->onBoardShares($e);
}
'\OCA\Deck\Board::onShareDelete', function (Event $e) {
$this->fullTextSearchService->onBoardShares($e);
}
);
}

}
10 changes: 5 additions & 5 deletions lib/ArchivedItemException.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program 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 program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/

namespace OCA\Deck;
Expand All @@ -31,4 +31,4 @@ class ArchivedItemException extends \Exception {
public function __construct($msg = 'Operation not allowed. Item is archived.') {
parent::__construct($msg);
}
}
}
Loading

0 comments on commit 52febb3

Please sign in to comment.