Fix php cs issues

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-04-22 19:57:19 +02:00
parent 7ad5daabeb
commit 52febb396c
130 changed files with 1068 additions and 1424 deletions

View File

@@ -23,8 +23,6 @@
namespace OCA\Deck\AppInfo; namespace OCA\Deck\AppInfo;
use OCP\AppFramework\App;
/** /**
* Additional autoloader registration, e.g. registering composer autoloaders * Additional autoloader registration, e.g. registering composer autoloaders
*/ */

View File

@@ -48,8 +48,7 @@ use OCP\IL10N;
use OCP\IUser; use OCP\IUser;
class ActivityManager { class ActivityManager {
public const DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED = 'DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED';
const DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED = 'DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED';
private $manager; private $manager;
private $userId; private $userId;
private $permissionService; private $permissionService;
@@ -60,49 +59,49 @@ class ActivityManager {
private $stackMapper; private $stackMapper;
private $l10n; private $l10n;
const DECK_OBJECT_BOARD = 'deck_board'; public const DECK_OBJECT_BOARD = 'deck_board';
const DECK_OBJECT_CARD = 'deck_card'; public const DECK_OBJECT_CARD = 'deck_card';
const SUBJECT_BOARD_CREATE = 'board_create'; public const SUBJECT_BOARD_CREATE = 'board_create';
const SUBJECT_BOARD_UPDATE = 'board_update'; public const SUBJECT_BOARD_UPDATE = 'board_update';
const SUBJECT_BOARD_UPDATE_TITLE = 'board_update_title'; public const SUBJECT_BOARD_UPDATE_TITLE = 'board_update_title';
const SUBJECT_BOARD_UPDATE_ARCHIVED = 'board_update_archived'; public const SUBJECT_BOARD_UPDATE_ARCHIVED = 'board_update_archived';
const SUBJECT_BOARD_DELETE = 'board_delete'; public const SUBJECT_BOARD_DELETE = 'board_delete';
const SUBJECT_BOARD_RESTORE = 'board_restore'; public const SUBJECT_BOARD_RESTORE = 'board_restore';
const SUBJECT_BOARD_SHARE = 'board_share'; public const SUBJECT_BOARD_SHARE = 'board_share';
const SUBJECT_BOARD_UNSHARE = 'board_unshare'; public const SUBJECT_BOARD_UNSHARE = 'board_unshare';
const SUBJECT_STACK_CREATE = 'stack_create'; public const SUBJECT_STACK_CREATE = 'stack_create';
const SUBJECT_STACK_UPDATE = 'stack_update'; public const SUBJECT_STACK_UPDATE = 'stack_update';
const SUBJECT_STACK_UPDATE_TITLE = 'stack_update_title'; public const SUBJECT_STACK_UPDATE_TITLE = 'stack_update_title';
const SUBJECT_STACK_UPDATE_ORDER = 'stack_update_order'; public const SUBJECT_STACK_UPDATE_ORDER = 'stack_update_order';
const SUBJECT_STACK_DELETE = 'stack_delete'; public const SUBJECT_STACK_DELETE = 'stack_delete';
const SUBJECT_CARD_CREATE = 'card_create'; public const SUBJECT_CARD_CREATE = 'card_create';
const SUBJECT_CARD_DELETE = 'card_delete'; public const SUBJECT_CARD_DELETE = 'card_delete';
const SUBJECT_CARD_RESTORE = 'card_restore'; public const SUBJECT_CARD_RESTORE = 'card_restore';
const SUBJECT_CARD_UPDATE = 'card_update'; public const SUBJECT_CARD_UPDATE = 'card_update';
const SUBJECT_CARD_UPDATE_TITLE = 'card_update_title'; public const SUBJECT_CARD_UPDATE_TITLE = 'card_update_title';
const SUBJECT_CARD_UPDATE_DESCRIPTION = 'card_update_description'; public const SUBJECT_CARD_UPDATE_DESCRIPTION = 'card_update_description';
const SUBJECT_CARD_UPDATE_DUEDATE = 'card_update_duedate'; public const SUBJECT_CARD_UPDATE_DUEDATE = 'card_update_duedate';
const SUBJECT_CARD_UPDATE_ARCHIVE = 'card_update_archive'; public const SUBJECT_CARD_UPDATE_ARCHIVE = 'card_update_archive';
const SUBJECT_CARD_UPDATE_UNARCHIVE = 'card_update_unarchive'; public const SUBJECT_CARD_UPDATE_UNARCHIVE = 'card_update_unarchive';
const SUBJECT_CARD_UPDATE_STACKID = 'card_update_stackId'; public const SUBJECT_CARD_UPDATE_STACKID = 'card_update_stackId';
const SUBJECT_CARD_USER_ASSIGN = 'card_user_assign'; public const SUBJECT_CARD_USER_ASSIGN = 'card_user_assign';
const SUBJECT_CARD_USER_UNASSIGN = 'card_user_unassign'; public const SUBJECT_CARD_USER_UNASSIGN = 'card_user_unassign';
const SUBJECT_ATTACHMENT_CREATE = 'attachment_create'; public const SUBJECT_ATTACHMENT_CREATE = 'attachment_create';
const SUBJECT_ATTACHMENT_UPDATE = 'attachment_update'; public const SUBJECT_ATTACHMENT_UPDATE = 'attachment_update';
const SUBJECT_ATTACHMENT_DELETE = 'attachment_delete'; public const SUBJECT_ATTACHMENT_DELETE = 'attachment_delete';
const SUBJECT_ATTACHMENT_RESTORE = 'attachment_restore'; public const SUBJECT_ATTACHMENT_RESTORE = 'attachment_restore';
const SUBJECT_LABEL_CREATE = 'label_create'; public const SUBJECT_LABEL_CREATE = 'label_create';
const SUBJECT_LABEL_UPDATE = 'label_update'; public const SUBJECT_LABEL_UPDATE = 'label_update';
const SUBJECT_LABEL_DELETE = 'label_delete'; public const SUBJECT_LABEL_DELETE = 'label_delete';
const SUBJECT_LABEL_ASSIGN = 'label_assign'; public const SUBJECT_LABEL_ASSIGN = 'label_assign';
const SUBJECT_LABEL_UNASSING = 'label_unassign'; public const SUBJECT_LABEL_UNASSING = 'label_unassign';
const SUBJECT_CARD_COMMENT_CREATE = 'card_comment_create'; public const SUBJECT_CARD_COMMENT_CREATE = 'card_comment_create';
public function __construct( public function __construct(
IManager $manager, IManager $manager,
@@ -197,7 +196,7 @@ class ActivityManager {
case self::SUBJECT_CARD_UPDATE_DUEDATE: case self::SUBJECT_CARD_UPDATE_DUEDATE:
if (!isset($subjectParams['after'])) { 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}'); $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}'); $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 { } 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}'); $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}');
@@ -376,7 +375,7 @@ class ActivityManager {
break; break;
} }
if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION){ if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION) {
$card = $subjectParams['card']; $card = $subjectParams['card'];
if ($card->getLastEditor() === $this->userId) { if ($card->getLastEditor() === $this->userId) {
return null; return null;
@@ -526,5 +525,4 @@ class ActivityManager {
'board' => $board 'board' => $board
]; ];
} }
} }

View File

@@ -23,9 +23,7 @@
namespace OCA\Deck\Activity; namespace OCA\Deck\Activity;
class ChangeSet implements \JsonSerializable { class ChangeSet implements \JsonSerializable {
private $before; private $before;
private $after; private $after;
private $diff = false; private $diff = false;

View File

@@ -50,12 +50,12 @@ class CommentEventHandler implements ICommentsEventHandler {
* @param CommentsEvent $event * @param CommentsEvent $event
*/ */
public function handle(CommentsEvent $event) { public function handle(CommentsEvent $event) {
if($event->getComment()->getObjectType() !== 'deckCard') { if ($event->getComment()->getObjectType() !== 'deckCard') {
return; return;
} }
$eventType = $event->getEvent(); $eventType = $event->getEvent();
if( $eventType === CommentsEvent::EVENT_ADD if ($eventType === CommentsEvent::EVENT_ADD
) { ) {
$this->notificationHandler($event); $this->notificationHandler($event);
$this->activityHandler($event); $this->activityHandler($event);
@@ -65,7 +65,7 @@ class CommentEventHandler implements ICommentsEventHandler {
$applicableEvents = [ $applicableEvents = [
CommentsEvent::EVENT_UPDATE CommentsEvent::EVENT_UPDATE
]; ];
if(in_array($eventType, $applicableEvents)) { if (in_array($eventType, $applicableEvents)) {
$this->notificationHandler($event); $this->notificationHandler($event);
return; return;
} }
@@ -79,7 +79,6 @@ class CommentEventHandler implements ICommentsEventHandler {
$comment = $event->getComment(); $comment = $event->getComment();
$card = $this->cardMapper->find($comment->getObjectId()); $card = $this->cardMapper->find($comment->getObjectId());
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_CARD_COMMENT_CREATE, ['comment' => $comment]); $this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_CARD_COMMENT_CREATE, ['comment' => $comment]);
} }
/** /**

View File

@@ -25,7 +25,6 @@
namespace OCA\Deck\Activity; namespace OCA\Deck\Activity;
use cogpowered\FineDiff\Diff; use cogpowered\FineDiff\Diff;
use OCA\Deck\Db\Acl; use OCA\Deck\Db\Acl;
use OCP\Activity\IEvent; use OCP\Activity\IEvent;

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Activity; namespace OCA\Deck\Activity;
class DescriptionSetting extends Setting { class DescriptionSetting extends Setting {
/** /**
@@ -41,5 +40,4 @@ class DescriptionSetting extends Setting {
public function getName() { public function getName() {
return $this->l->t('A <strong>card description</strong> inside the Deck app has been changed'); return $this->l->t('A <strong>card description</strong> inside the Deck app has been changed');
} }
} }

View File

@@ -27,7 +27,6 @@ use OCP\IL10N;
use OCP\IURLGenerator; use OCP\IURLGenerator;
class Filter implements \OCP\Activity\IFilter { class Filter implements \OCP\Activity\IFilter {
private $l10n; private $l10n;
private $urlGenerator; private $urlGenerator;

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Activity; namespace OCA\Deck\Activity;
use OCP\IL10N; use OCP\IL10N;
class Setting implements \OCP\Activity\ISetting { class Setting implements \OCP\Activity\ISetting {

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Activity; namespace OCA\Deck\Activity;
class SettingComment extends Setting { class SettingComment extends Setting {
/** /**
@@ -49,5 +48,4 @@ class SettingComment extends Setting {
public function canChangeStream() { public function canChangeStream() {
return false; return false;
} }
} }

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\AppInfo; namespace OCA\Deck\AppInfo;
use Exception; use Exception;
use InvalidArgumentException;
use OC_Util; use OC_Util;
use OCA\Deck\Activity\CommentEventHandler; use OCA\Deck\Activity\CommentEventHandler;
use OCA\Deck\Capabilities; use OCA\Deck\Capabilities;
@@ -52,10 +51,8 @@ use OCP\IUser;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use OCP\Util; use OCP\Util;
use Symfony\Component\EventDispatcher\GenericEvent;
class Application extends App { class Application extends App {
public const APP_ID = 'deck'; public const APP_ID = 'deck';
public const COMMENT_ENTITY_TYPE = 'deckCard'; public const COMMENT_ENTITY_TYPE = 'deckCard';
@@ -69,7 +66,7 @@ class Application extends App {
/** @var IFullTextSearchManager */ /** @var IFullTextSearchManager */
private $fullTextSearchManager; private $fullTextSearchManager;
public function __construct(array $urlParams = array()) { public function __construct(array $urlParams = []) {
parent::__construct('deck', $urlParams); parent::__construct('deck', $urlParams);
$container = $this->getContainer(); $container = $this->getContainer();
@@ -81,10 +78,10 @@ class Application extends App {
$container->registerMiddleWare(ExceptionMiddleware::class); $container->registerMiddleWare(ExceptionMiddleware::class);
$container->registerMiddleWare(DefaultBoardMiddleware::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'); return $server->getConfig()->getSystemValue('dbtype', 'sqlite');
}); });
$container->registerService('database4ByteSupport', static function() use ($server) { $container->registerService('database4ByteSupport', static function () use ($server) {
return $server->getDatabaseConnection()->supports4ByteText(); return $server->getDatabaseConnection()->supports4ByteText();
}); });
} }
@@ -100,7 +97,7 @@ class Application extends App {
public function registerNavigationEntry(): void { public function registerNavigationEntry(): void {
$container = $this->getContainer(); $container = $this->getContainer();
$this->server->getNavigationManager()->add(static function() use ($container) { $this->server->getNavigationManager()->add(static function () use ($container) {
$urlGenerator = $container->query(IURLGenerator::class); $urlGenerator = $container->query(IURLGenerator::class);
return [ return [
'id' => 'deck', 'id' => 'deck',
@@ -117,7 +114,7 @@ class Application extends App {
// Delete user/group acl entries when they get deleted // Delete user/group acl entries when they get deleted
/** @var IUserManager $userManager */ /** @var IUserManager $userManager */
$userManager = $this->server->getUserManager(); $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 // delete existing acl entries for deleted user
/** @var AclMapper $aclMapper */ /** @var AclMapper $aclMapper */
$aclMapper = $container->query(AclMapper::class); $aclMapper = $container->query(AclMapper::class);
@@ -135,7 +132,7 @@ class Application extends App {
/** @var IUserManager $userManager */ /** @var IUserManager $userManager */
$groupManager = $this->server->getGroupManager(); $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 */ /** @var AclMapper $aclMapper */
$aclMapper = $container->query(AclMapper::class); $aclMapper = $container->query(AclMapper::class);
$aclMapper->findByParticipant(Acl::PERMISSION_TYPE_GROUP, $group->getGID()); $aclMapper->findByParticipant(Acl::PERMISSION_TYPE_GROUP, $group->getGID());
@@ -152,8 +149,8 @@ class Application extends App {
} }
public function registerCommentsEntity(): void { public function registerCommentsEntity(): void {
$this->server->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) { $this->server->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) {
$event->addEntityCollection(self::COMMENT_ENTITY_TYPE, function($name) { $event->addEntityCollection(self::COMMENT_ENTITY_TYPE, function ($name) {
/** @var CardMapper */ /** @var CardMapper */
$cardMapper = $this->getContainer()->query(CardMapper::class); $cardMapper = $this->getContainer()->query(CardMapper::class);
$permissionService = $this->getContainer()->query(PermissionService::class); $permissionService = $this->getContainer()->query(PermissionService::class);
@@ -222,35 +219,34 @@ class Application extends App {
/** @var IEventDispatcher $eventDispatcher */ /** @var IEventDispatcher $eventDispatcher */
$eventDispatcher = $this->server->query(IEventDispatcher::class); $eventDispatcher = $this->server->query(IEventDispatcher::class);
$eventDispatcher->addListener( $eventDispatcher->addListener(
'\OCA\Deck\Card::onCreate', function(Event $e) { '\OCA\Deck\Card::onCreate', function (Event $e) {
$this->fullTextSearchService->onCardCreated($e); $this->fullTextSearchService->onCardCreated($e);
} }
); );
$eventDispatcher->addListener( $eventDispatcher->addListener(
'\OCA\Deck\Card::onUpdate', function(Event $e) { '\OCA\Deck\Card::onUpdate', function (Event $e) {
$this->fullTextSearchService->onCardUpdated($e); $this->fullTextSearchService->onCardUpdated($e);
} }
); );
$eventDispatcher->addListener( $eventDispatcher->addListener(
'\OCA\Deck\Card::onDelete', function(Event $e) { '\OCA\Deck\Card::onDelete', function (Event $e) {
$this->fullTextSearchService->onCardDeleted($e); $this->fullTextSearchService->onCardDeleted($e);
} }
); );
$eventDispatcher->addListener( $eventDispatcher->addListener(
'\OCA\Deck\Board::onShareNew', function(Event $e) { '\OCA\Deck\Board::onShareNew', function (Event $e) {
$this->fullTextSearchService->onBoardShares($e); $this->fullTextSearchService->onBoardShares($e);
} }
); );
$eventDispatcher->addListener( $eventDispatcher->addListener(
'\OCA\Deck\Board::onShareEdit', function(Event $e) { '\OCA\Deck\Board::onShareEdit', function (Event $e) {
$this->fullTextSearchService->onBoardShares($e); $this->fullTextSearchService->onBoardShares($e);
} }
); );
$eventDispatcher->addListener( $eventDispatcher->addListener(
'\OCA\Deck\Board::onShareDelete', function(Event $e) { '\OCA\Deck\Board::onShareDelete', function (Event $e) {
$this->fullTextSearchService->onBoardShares($e); $this->fullTextSearchService->onBoardShares($e);
} }
); );
} }
} }

View File

@@ -24,8 +24,8 @@
namespace OCA\Deck; namespace OCA\Deck;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
class BadRequestException extends StatusException {
class BadRequestException extends StatusException {
public function __construct($message) { public function __construct($message) {
parent::__construct($message); parent::__construct($message);
} }

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck; namespace OCA\Deck;
use OCP\Capabilities\ICapability; use OCP\Capabilities\ICapability;
class Capabilities implements ICapability { class Capabilities implements ICapability {

View File

@@ -23,9 +23,7 @@
namespace OCA\Deck\Collaboration\Resources; namespace OCA\Deck\Collaboration\Resources;
use OCA\Deck\Db\Acl; use OCA\Deck\Db\Acl;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Service\PermissionService; use OCA\Deck\Service\PermissionService;
use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\DoesNotExistException;
@@ -34,12 +32,10 @@ use OCP\AppFramework\QueryException;
use OCP\Collaboration\Resources\IManager; use OCP\Collaboration\Resources\IManager;
use OCP\Collaboration\Resources\IProvider; use OCP\Collaboration\Resources\IProvider;
use OCP\Collaboration\Resources\IResource; use OCP\Collaboration\Resources\IResource;
use OCP\Collaboration\Resources\ResourceException;
use OCP\IUser; use OCP\IUser;
class ResourceProvider implements IProvider { class ResourceProvider implements IProvider {
public const RESOURCE_TYPE = 'deck';
const RESOURCE_TYPE = 'deck';
private $boardMapper; private $boardMapper;
private $permissionService; private $permissionService;
@@ -83,7 +79,6 @@ class ResourceProvider implements IProvider {
'link' => $link, 'link' => $link,
'iconUrl' => \OC::$server->getURLGenerator()->imagePath('deck', 'deck-dark.svg') 'iconUrl' => \OC::$server->getURLGenerator()->imagePath('deck', 'deck-dark.svg')
]; ];
} }
/** /**

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Collaboration\Resources; namespace OCA\Deck\Collaboration\Resources;
use OCA\Deck\Db\Acl; use OCA\Deck\Db\Acl;
use OCA\Deck\Db\Board; use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\BoardMapper;
@@ -40,8 +39,7 @@ use OCP\IURLGenerator;
use OCP\IUser; use OCP\IUser;
class ResourceProviderCard implements IProvider { class ResourceProviderCard implements IProvider {
public const RESOURCE_TYPE = 'deck-card';
const RESOURCE_TYPE = 'deck-card';
/** @var CardMapper */ /** @var CardMapper */
private $cardMapper; private $cardMapper;
@@ -101,7 +99,6 @@ class ResourceProviderCard implements IProvider {
'link' => $link, 'link' => $link,
'iconUrl' => $this->urlGenerator->imagePath('core', 'actions/toggle-pictures.svg') 'iconUrl' => $this->urlGenerator->imagePath('core', 'actions/toggle-pictures.svg')
]; ];
} }
/** /**

View File

@@ -38,7 +38,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
class UserExport extends Command { class UserExport extends Command {
protected $boardService; protected $boardService;
protected $cardMapper; protected $cardMapper;
private $userManager; private $userManager;
@@ -85,7 +84,6 @@ class UserExport extends Command {
* @throws \ReflectionException * @throws \ReflectionException
*/ */
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output) {
$userId = $input->getArgument('user-id'); $userId = $input->getArgument('user-id');
$this->boardService->setUserId($userId); $this->boardService->setUserId($userId);
@@ -110,5 +108,3 @@ class UserExport extends Command {
$output->writeln(json_encode($data, JSON_PRETTY_PRINT)); $output->writeln(json_encode($data, JSON_PRETTY_PRINT));
} }
} }

View File

@@ -25,12 +25,10 @@ namespace OCA\Deck\Controller;
use OCP\AppFramework\ApiController; use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\IRequest; use OCP\IRequest;
use OCA\Deck\Service\AttachmentService; use OCA\Deck\Service\AttachmentService;
class AttachmentApiController extends ApiController { class AttachmentApiController extends ApiController {
private $attachmentService; private $attachmentService;
public function __construct($appName, IRequest $request, AttachmentService $attachmentService) { public function __construct($appName, IRequest $request, AttachmentService $attachmentService) {

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Service\AttachmentService; use OCA\Deck\Service\AttachmentService;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\IRequest; use OCP\IRequest;

View File

@@ -39,7 +39,6 @@ use Sabre\HTTP\Util;
* @package OCA\Deck\Controller * @package OCA\Deck\Controller
*/ */
class BoardApiController extends ApiController { class BoardApiController extends ApiController {
private $boardService; private $boardService;
/** /**
@@ -175,5 +174,4 @@ class BoardApiController extends ApiController {
$acl = $this->boardService->deleteAcl($aclId); $acl = $this->boardService->deleteAcl($aclId);
return new DataResponse($acl, HTTP::STATUS_OK); return new DataResponse($acl, HTTP::STATUS_OK);
} }
} }

View File

@@ -28,9 +28,6 @@ use OCA\Deck\Service\BoardService;
use OCA\Deck\Service\PermissionService; use OCA\Deck\Service\PermissionService;
use OCP\AppFramework\ApiController; use OCP\AppFramework\ApiController;
use OCP\IRequest; use OCP\IRequest;
use OCP\AppFramework\Controller;
use OCP\IUserManager;
use OCP\IGroupManager;
class BoardController extends ApiController { class BoardController extends ApiController {
private $userId; private $userId;
@@ -158,5 +155,4 @@ class BoardController extends ApiController {
public function clone($boardId) { public function clone($boardId) {
return $this->boardService->clone($boardId); return $this->boardService->clone($boardId);
} }
} }

View File

@@ -29,7 +29,6 @@ use OCP\IRequest;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
class CardController extends Controller { class CardController extends Controller {
private $userId; private $userId;
private $cardService; private $cardService;
private $assignmentService; private $assignmentService;
@@ -166,7 +165,4 @@ class CardController extends Controller {
public function unassignUser($cardId, $userId, $type = 0) { public function unassignUser($cardId, $userId, $type = 0) {
return $this->assignmentService->unassignUser($cardId, $userId, $type); return $this->assignmentService->unassignUser($cardId, $userId, $type);
} }
} }

View File

@@ -23,13 +23,10 @@
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\BadRequestException;
use OCA\Deck\Service\CommentService; use OCA\Deck\Service\CommentService;
use OCA\Deck\StatusException; use OCA\Deck\StatusException;
use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCSController; use OCP\AppFramework\OCSController;
use OCP\IRequest; use OCP\IRequest;

View File

@@ -23,19 +23,15 @@
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Service\DefaultBoardService;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\NotFoundResponse; use OCP\AppFramework\Http\NotFoundResponse;
use OCP\IConfig; use OCP\IConfig;
use OCP\IGroup; use OCP\IGroup;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\IRequest; use OCP\IRequest;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\IL10N;
class ConfigController extends Controller { class ConfigController extends Controller {
private $config; private $config;
private $userId; private $userId;
private $groupManager; private $groupManager;
@@ -100,7 +96,7 @@ class ConfigController extends Controller {
private function getGroupLimit() { private function getGroupLimit() {
$groups = $this->getGroupLimitList(); $groups = $this->getGroupLimitList();
$groups = array_map(function($groupId) { $groups = array_map(function ($groupId) {
/** @var IGroup $groups */ /** @var IGroup $groups */
$group = $this->groupManager->get($groupId); $group = $this->groupManager->get($groupId);
if ($group === null) { if ($group === null) {
@@ -113,5 +109,4 @@ class ConfigController extends Controller {
}, $groups); }, $groups);
return array_filter($groups); return array_filter($groups);
} }
} }

View File

@@ -28,15 +28,13 @@ use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest; use OCP\IRequest;
use OCA\Deck\Service\LabelService; use OCA\Deck\Service\LabelService;
use OCA\Deck\Controller\Helper\ApiHelper;
/** /**
* Class BoardApiController * Class BoardApiController
* *
* @package OCA\Deck\Controller * @package OCA\Deck\Controller
*/ */
class LabelApiController extends ApiController { class LabelApiController extends ApiController {
private $labelService; private $labelService;
private $userId; private $userId;
@@ -103,5 +101,4 @@ class LabelApiController extends ApiController {
$label = $this->labelService->delete($this->request->getParam('labelId')); $label = $this->labelService->delete($this->request->getParam('labelId'));
return new DataResponse($label, HTTP::STATUS_OK); return new DataResponse($label, HTTP::STATUS_OK);
} }
} }

View File

@@ -27,9 +27,7 @@ use OCA\Deck\Service\LabelService;
use OCP\IRequest; use OCP\IRequest;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
class LabelController extends Controller { class LabelController extends Controller {
private $labelService; private $labelService;
public function __construct($appName, IRequest $request, LabelService $labelService) { public function __construct($appName, IRequest $request, LabelService $labelService) {
@@ -67,5 +65,4 @@ class LabelController extends Controller {
public function delete($labelId) { public function delete($labelId) {
return $this->labelService->delete($labelId); return $this->labelService->delete($labelId);
} }
} }

View File

@@ -32,7 +32,6 @@ use OCP\AppFramework\Controller;
use OCP\IL10N; use OCP\IL10N;
class PageController extends Controller { class PageController extends Controller {
private $permissionService; private $permissionService;
private $userId; private $userId;
private $l10n; private $l10n;
@@ -67,5 +66,4 @@ class PageController extends Controller {
return new TemplateResponse('deck', 'main'); return new TemplateResponse('deck', 'main');
} }
} }

View File

@@ -39,7 +39,6 @@ use Sabre\HTTP\Util;
* @package OCA\Deck\Controller * @package OCA\Deck\Controller
*/ */
class StackApiController extends ApiController { class StackApiController extends ApiController {
private $boardService; private $boardService;
private $stackService; private $stackService;

View File

@@ -29,7 +29,6 @@ use OCP\IRequest;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
class StackController extends Controller { class StackController extends Controller {
private $userId; private $userId;
private $stackService; private $stackService;
@@ -108,5 +107,4 @@ class StackController extends Controller {
public function deleted($boardId) { public function deleted($boardId) {
return $this->stackService->fetchDeleted($boardId); return $this->stackService->fetchDeleted($boardId);
} }
} }

View File

@@ -26,14 +26,7 @@ namespace OCA\Deck\Cron;
use OC\BackgroundJob\Job; use OC\BackgroundJob\Job;
use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Activity\ChangeSet;
use OCA\Deck\Db\AttachmentMapper;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\InvalidAttachmentType;
use OCA\Deck\Service\AttachmentService;
use OCA\Deck\Service\CardService;
class CardDescriptionActivity extends Job { class CardDescriptionActivity extends Job {
@@ -70,5 +63,4 @@ class CardDescriptionActivity extends Job {
$this->cardMapper->update($card, false); $this->cardMapper->update($card, false);
} }
} }
} }

View File

@@ -65,7 +65,5 @@ class DeleteCron extends Job {
} }
$this->attachmentMapper->delete($attachment); $this->attachmentMapper->delete($attachment);
} }
} }
} }

View File

@@ -66,5 +66,4 @@ class ScheduledNotifications extends Job {
} }
} }
} }
} }

View File

@@ -24,15 +24,14 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
class Acl extends RelationalEntity { class Acl extends RelationalEntity {
public const PERMISSION_READ = 0;
public const PERMISSION_EDIT = 1;
public const PERMISSION_SHARE = 2;
public const PERMISSION_MANAGE = 3;
const PERMISSION_READ = 0; public const PERMISSION_TYPE_USER = 0;
const PERMISSION_EDIT = 1; public const PERMISSION_TYPE_GROUP = 1;
const PERMISSION_SHARE = 2; public const PERMISSION_TYPE_CIRCLE = 7;
const PERMISSION_MANAGE = 3;
const PERMISSION_TYPE_USER = 0;
const PERMISSION_TYPE_GROUP = 1;
const PERMISSION_TYPE_CIRCLE = 7;
protected $participant; protected $participant;
protected $type; protected $type;
@@ -67,5 +66,4 @@ class Acl extends RelationalEntity {
} }
return false; return false;
} }
} }

View File

@@ -26,7 +26,6 @@ namespace OCA\Deck\Db;
use OCP\IDBConnection; use OCP\IDBConnection;
class AclMapper extends DeckMapper implements IPermissionMapper { class AclMapper extends DeckMapper implements IPermissionMapper {
public function __construct(IDBConnection $db) { public function __construct(IDBConnection $db) {
parent::__construct($db, 'deck_board_acl', Acl::class); parent::__construct($db, 'deck_board_acl', Acl::class);
} }
@@ -52,5 +51,4 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
$sql = 'SELECT * from *PREFIX*deck_board_acl WHERE type = ? AND participant = ?'; $sql = 'SELECT * from *PREFIX*deck_board_acl WHERE type = ? AND participant = ?';
return $this->findEntities($sql, [$type, $participant]); return $this->findEntities($sql, [$type, $participant]);
} }
} }

View File

@@ -26,7 +26,6 @@ namespace OCA\Deck\Db;
use JsonSerializable; use JsonSerializable;
class AssignedUsers extends RelationalEntity implements JsonSerializable { class AssignedUsers extends RelationalEntity implements JsonSerializable {
public $id; public $id;
protected $participant; protected $participant;
protected $cardId; protected $cardId;
@@ -42,5 +41,4 @@ class AssignedUsers extends RelationalEntity implements JsonSerializable {
$this->addType('type', 'integer'); $this->addType('type', 'integer');
$this->addResolvable('participant'); $this->addResolvable('participant');
} }
} }

View File

@@ -29,9 +29,7 @@ use OCP\IDBConnection;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\IUserManager; use OCP\IUserManager;
class AssignedUsersMapper extends DeckMapper implements IPermissionMapper { class AssignedUsersMapper extends DeckMapper implements IPermissionMapper {
private $cardMapper; private $cardMapper;
private $userManager; private $userManager;
/** /**
@@ -96,7 +94,7 @@ class AssignedUsersMapper extends DeckMapper implements IPermissionMapper {
public function mapParticipant(AssignedUsers &$assignment) { public function mapParticipant(AssignedUsers &$assignment) {
$self = $this; $self = $this;
$assignment->resolveRelation('participant', function() use (&$self, &$assignment) { $assignment->resolveRelation('participant', function () use (&$self, &$assignment) {
return $self->getOrigin($assignment); return $self->getOrigin($assignment);
}); });
} }
@@ -116,5 +114,4 @@ class AssignedUsersMapper extends DeckMapper implements IPermissionMapper {
} }
return null; return null;
} }
} }

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
class Attachment extends RelationalEntity { class Attachment extends RelationalEntity {
protected $cardId; protected $cardId;
protected $type; protected $type;
protected $data; protected $data;
@@ -43,5 +42,4 @@ class Attachment extends RelationalEntity {
$this->addResolvable('createdBy'); $this->addResolvable('createdBy');
$this->addRelation('extendedData'); $this->addRelation('extendedData');
} }
} }

View File

@@ -32,9 +32,7 @@ use OCP\IDBConnection;
use OCP\IUserManager; use OCP\IUserManager;
use PDO; use PDO;
class AttachmentMapper extends DeckMapper implements IPermissionMapper { class AttachmentMapper extends DeckMapper implements IPermissionMapper {
private $cardMapper; private $cardMapper;
private $userManager; private $userManager;
private $qb; private $qb;
@@ -67,14 +65,14 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
$cursor = $qb->execute(); $cursor = $qb->execute();
$row = $cursor->fetch(PDO::FETCH_ASSOC); $row = $cursor->fetch(PDO::FETCH_ASSOC);
if($row === false) { if ($row === false) {
$cursor->closeCursor(); $cursor->closeCursor();
throw new DoesNotExistException('Did expect one result but found none when executing' . $qb); throw new DoesNotExistException('Did expect one result but found none when executing' . $qb);
} }
$row2 = $cursor->fetch(); $row2 = $cursor->fetch();
$cursor->closeCursor(); $cursor->closeCursor();
if($row2 !== false ) { if ($row2 !== false) {
throw new MultipleObjectsReturnedException('Did not expect more than one result when executing' . $query); throw new MultipleObjectsReturnedException('Did not expect more than one result when executing' . $query);
} }
@@ -89,7 +87,7 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
->andWhere($qb->expr()->eq('data', $qb->createNamedParameter($data, IQueryBuilder::PARAM_STR))); ->andWhere($qb->expr()->eq('data', $qb->createNamedParameter($data, IQueryBuilder::PARAM_STR)));
$cursor = $qb->execute(); $cursor = $qb->execute();
$row = $cursor->fetch(PDO::FETCH_ASSOC); $row = $cursor->fetch(PDO::FETCH_ASSOC);
if($row === false) { if ($row === false) {
$cursor->closeCursor(); $cursor->closeCursor();
throw new DoesNotExistException('Did expect one result but found none when executing' . $qb); throw new DoesNotExistException('Did expect one result but found none when executing' . $qb);
} }
@@ -113,7 +111,7 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
$entities = []; $entities = [];
$cursor = $qb->execute(); $cursor = $qb->execute();
while($row = $cursor->fetch()){ while ($row = $cursor->fetch()) {
$entities[] = $this->mapRowToEntity($row); $entities[] = $this->mapRowToEntity($row);
} }
$cursor->closeCursor(); $cursor->closeCursor();
@@ -143,7 +141,7 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
$entities = []; $entities = [];
$cursor = $qb->execute(); $cursor = $qb->execute();
while($row = $cursor->fetch()){ while ($row = $cursor->fetch()) {
$entities[] = $this->mapRowToEntity($row); $entities[] = $this->mapRowToEntity($row);
} }
$cursor->closeCursor(); $cursor->closeCursor();

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
class Board extends RelationalEntity { class Board extends RelationalEntity {
protected $title; protected $title;
protected $owner; protected $owner;
protected $color; protected $color;

View File

@@ -24,14 +24,12 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\QueryException;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\ILogger; use OCP\ILogger;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\IGroupManager; use OCP\IGroupManager;
class BoardMapper extends DeckMapper implements IPermissionMapper { class BoardMapper extends DeckMapper implements IPermissionMapper {
private $labelMapper; private $labelMapper;
private $aclMapper; private $aclMapper;
private $stackMapper; private $stackMapper;
@@ -143,7 +141,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
if (!$this->circlesEnabled) { if (!$this->circlesEnabled) {
return []; return [];
} }
$circles = array_map(function($circle) { $circles = array_map(function ($circle) {
return $circle->getUniqueId(); return $circle->getUniqueId();
}, \OCA\Circles\Api\v1\Circles::joinedCircles('', true)); }, \OCA\Circles\Api\v1\Circles::joinedCircles('', true));
if (count($circles) === 0) { if (count($circles) === 0) {
@@ -215,7 +213,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
public function mapAcl(Acl &$acl) { public function mapAcl(Acl &$acl) {
$userManager = $this->userManager; $userManager = $this->userManager;
$groupManager = $this->groupManager; $groupManager = $this->groupManager;
$acl->resolveRelation('participant', function($participant) use (&$acl, &$userManager, &$groupManager) { $acl->resolveRelation('participant', function ($participant) use (&$acl, &$userManager, &$groupManager) {
if ($acl->getType() === Acl::PERMISSION_TYPE_USER) { if ($acl->getType() === Acl::PERMISSION_TYPE_USER) {
$user = $userManager->get($participant); $user = $userManager->get($participant);
if ($user !== null) { if ($user !== null) {
@@ -255,7 +253,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
*/ */
public function mapOwner(Board &$board) { public function mapOwner(Board &$board) {
$userManager = $this->userManager; $userManager = $this->userManager;
$board->resolveRelation('owner', function($owner) use (&$userManager) { $board->resolveRelation('owner', function ($owner) use (&$userManager) {
$user = $userManager->get($owner); $user = $userManager->get($owner);
if ($user !== null) { if ($user !== null) {
return new User($user); return new User($user);
@@ -263,6 +261,4 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
return null; return null;
}); });
} }
} }

View File

@@ -26,7 +26,6 @@ namespace OCA\Deck\Db;
use DateTime; use DateTime;
class Card extends RelationalEntity { class Card extends RelationalEntity {
protected $title; protected $title;
protected $description; protected $description;
protected $descriptionPrev; protected $descriptionPrev;
@@ -49,10 +48,10 @@ class Card extends RelationalEntity {
private $databaseType = 'sqlite'; private $databaseType = 'sqlite';
const DUEDATE_FUTURE = 0; public const DUEDATE_FUTURE = 0;
const DUEDATE_NEXT = 1; public const DUEDATE_NEXT = 1;
const DUEDATE_NOW = 2; public const DUEDATE_NOW = 2;
const DUEDATE_OVERDUE = 3; public const DUEDATE_OVERDUE = 3;
public function __construct() { public function __construct() {
$this->addType('id', 'integer'); $this->addType('id', 'integer');
@@ -118,5 +117,4 @@ class Card extends RelationalEntity {
unset($json['descriptionPrev']); unset($json['descriptionPrev']);
return $json; return $json;
} }
} }

View File

@@ -28,7 +28,6 @@ use OCP\IDBConnection;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\Notification\IManager; use OCP\Notification\IManager;
class CardMapper extends DeckMapper implements IPermissionMapper { class CardMapper extends DeckMapper implements IPermissionMapper {
/** @var LabelMapper */ /** @var LabelMapper */
@@ -164,7 +163,6 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
foreach ($cards as $card) { foreach ($cards as $card) {
$this->delete($card); $this->delete($card);
} }
} }
public function assignLabel($card, $label) { public function assignLabel($card, $label) {
@@ -199,7 +197,7 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
public function mapOwner(Card &$card) { public function mapOwner(Card &$card) {
$userManager = $this->userManager; $userManager = $this->userManager;
$card->resolveRelation('owner', function($owner) use (&$userManager) { $card->resolveRelation('owner', function ($owner) use (&$userManager) {
$user = $userManager->get($owner); $user = $userManager->get($owner);
if ($user !== null) { if ($user !== null) {
return new User($user); return new User($user);
@@ -207,6 +205,4 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
return null; return null;
}); });
} }
} }

View File

@@ -23,18 +23,13 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\ICache;
use OCP\ICacheFactory; use OCP\ICacheFactory;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IRequest; use OCP\IRequest;
use OCP\IUserManager;
use OCP\IGroupManager;
class ChangeHelper { class ChangeHelper {
public const TYPE_BOARD = 'boardChanged';
const TYPE_BOARD = 'boardChanged'; public const TYPE_CARD = 'cardChanged';
const TYPE_CARD = 'cardChanged';
private $db; private $db;
@@ -100,5 +95,4 @@ class ChangeHelper {
} }
return $entry; return $entry;
} }
} }

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
use OCP\Share\IShare; use OCP\Share\IShare;
class Circle extends RelationalObject { class Circle extends RelationalObject {

View File

@@ -48,5 +48,4 @@ abstract class DeckMapper extends Mapper {
protected function execute($sql, array $params = [], $limit = null, $offset = null) { protected function execute($sql, array $params = [], $limit = null, $offset = null) {
return parent::execute($sql, $params, $limit, $offset); return parent::execute($sql, $params, $limit, $offset);
} }
} }

View File

@@ -27,7 +27,6 @@ use OCP\IGroup;
use OCP\Share\IShare; use OCP\Share\IShare;
class Group extends RelationalObject { class Group extends RelationalObject {
public function __construct(IGroup $group) { public function __construct(IGroup $group) {
$primaryKey = IShare::TYPE_GROUP . ':' . $group->getGID(); $primaryKey = IShare::TYPE_GROUP . ':' . $group->getGID();
parent::__construct($primaryKey, $group); parent::__construct($primaryKey, $group);

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
interface IPermissionMapper { interface IPermissionMapper {
/** /**
@@ -43,6 +42,4 @@ interface IPermissionMapper {
* @return int|null id of Board * @return int|null id of Board
*/ */
public function findBoardId($id); public function findBoardId($id);
} }

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
class Label extends RelationalEntity { class Label extends RelationalEntity {
protected $title; protected $title;
protected $color; protected $color;
protected $boardId; protected $boardId;

View File

@@ -26,9 +26,7 @@ namespace OCA\Deck\Db;
use OCP\AppFramework\Db\Entity; use OCP\AppFramework\Db\Entity;
use OCP\IDBConnection; use OCP\IDBConnection;
class LabelMapper extends DeckMapper implements IPermissionMapper { class LabelMapper extends DeckMapper implements IPermissionMapper {
public function __construct(IDBConnection $db) { public function __construct(IDBConnection $db) {
parent::__construct($db, 'deck_labels', Label::class); parent::__construct($db, 'deck_labels', Label::class);
} }
@@ -70,10 +68,10 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
public function getAssignedLabelsForBoard($boardId) { public function getAssignedLabelsForBoard($boardId) {
$labels = $this->findAssignedLabelsForBoard($boardId); $labels = $this->findAssignedLabelsForBoard($boardId);
$result = array(); $result = [];
foreach ($labels as $label) { foreach ($labels as $label) {
if (!array_key_exists($label->getCardId(), $result)) { if (!array_key_exists($label->getCardId(), $result)) {
$result[$label->getCardId()] = array(); $result[$label->getCardId()] = [];
} }
$result[$label->getCardId()][] = $label; $result[$label->getCardId()][] = $label;
} }

View File

@@ -26,8 +26,7 @@ namespace OCA\Deck\Db;
use OCP\AppFramework\Db\Entity; use OCP\AppFramework\Db\Entity;
class RelationalEntity extends Entity implements \JsonSerializable { class RelationalEntity extends Entity implements \JsonSerializable {
private $_relations = [];
private $_relations = array();
private $_resolvedProperties = []; private $_resolvedProperties = [];
/** /**
@@ -137,5 +136,4 @@ class RelationalEntity extends Entity implements \JsonSerializable {
} }
return parent::__call($methodName, $args); return parent::__call($methodName, $args);
} }
} }

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
class RelationalObject implements \JsonSerializable { class RelationalObject implements \JsonSerializable {
protected $primaryKey; protected $primaryKey;
protected $object; protected $object;
@@ -58,5 +57,4 @@ class RelationalObject implements \JsonSerializable {
throw new \Exception('jsonSerialize is not implemented on ' . get_class($this)); throw new \Exception('jsonSerialize is not implemented on ' . get_class($this));
} }
} }
} }

View File

@@ -24,12 +24,11 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
class Stack extends RelationalEntity { class Stack extends RelationalEntity {
protected $title; protected $title;
protected $boardId; protected $boardId;
protected $deletedAt = 0; protected $deletedAt = 0;
protected $lastModified = 0; protected $lastModified = 0;
protected $cards = array(); protected $cards = [];
protected $order; protected $order;
public function __construct() { public function __construct() {

View File

@@ -26,9 +26,7 @@ namespace OCA\Deck\Db;
use OCP\AppFramework\Db\Entity; use OCP\AppFramework\Db\Entity;
use OCP\IDBConnection; use OCP\IDBConnection;
class StackMapper extends DeckMapper implements IPermissionMapper { class StackMapper extends DeckMapper implements IPermissionMapper {
private $cardMapper; private $cardMapper;
public function __construct(IDBConnection $db, CardMapper $cardMapper) { public function __construct(IDBConnection $db, CardMapper $cardMapper) {

View File

@@ -27,7 +27,6 @@ use OCP\IUser;
use OCP\Share\IShare; use OCP\Share\IShare;
class User extends RelationalObject { class User extends RelationalObject {
public function __construct(IUser $user) { public function __construct(IUser $user) {
$primaryKey = IShare::TYPE_USER . ':' . $user->getUID(); $primaryKey = IShare::TYPE_USER . ':' . $user->getUID();
parent::__construct($primaryKey, $user); parent::__construct($primaryKey, $user);

View File

@@ -23,9 +23,7 @@
namespace OCA\Deck\Event; namespace OCA\Deck\Event;
use OCP\EventDispatcher\Event; use OCP\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\GenericEvent;
/** /**
* This is a class to keep compatibility for currently used events in full text search integration * This is a class to keep compatibility for currently used events in full text search integration
@@ -43,13 +41,11 @@ class FTSEvent extends Event {
$this->arguments = $arguments; $this->arguments = $arguments;
} }
public function getArgument($key) public function getArgument($key) {
{
if ($this->hasArgument($key)) { if ($this->hasArgument($key)) {
return $this->arguments[$key]; return $this->arguments[$key];
} }
throw new \InvalidArgumentException(sprintf('Argument "%s" not found.', $key)); throw new \InvalidArgumentException(sprintf('Argument "%s" not found.', $key));
} }
} }

View File

@@ -26,7 +26,6 @@ namespace OCA\Deck\Exceptions;
use OCA\Deck\StatusException; use OCA\Deck\StatusException;
class ConflictException extends StatusException { class ConflictException extends StatusException {
private $data; private $data;
public function __construct($message, $data = null) { public function __construct($message, $data = null) {

View File

@@ -23,15 +23,12 @@
namespace OCA\Deck; namespace OCA\Deck;
class InvalidAttachmentType extends \Exception { class InvalidAttachmentType extends \Exception {
/** /**
* InvalidAttachmentType constructor. * InvalidAttachmentType constructor.
*/ */
public function __construct($type) { public function __construct($type) {
parent::__construct('No matching IAttachmentService implementation found for type ' . $type); parent::__construct('No matching IAttachmentService implementation found for type ' . $type);
} }
} }

View File

@@ -59,5 +59,4 @@ class DefaultBoardMiddleware extends Middleware {
$this->logger->logException($e); $this->logger->logException($e);
} }
} }
} }

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Middleware; namespace OCA\Deck\Middleware;
use OCA\Deck\Controller\PageController;
use OCA\Deck\StatusException; use OCA\Deck\StatusException;
use OCA\Deck\Exceptions\ConflictException; use OCA\Deck\Exceptions\ConflictException;
use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\DoesNotExistException;
@@ -35,7 +34,6 @@ use OCP\ILogger;
use OCP\Util; use OCP\Util;
use OCP\IConfig; use OCP\IConfig;
class ExceptionMiddleware extends Middleware { class ExceptionMiddleware extends Middleware {
/** @var ILogger */ /** @var ILogger */
@@ -116,5 +114,4 @@ class ExceptionMiddleware extends Middleware {
throw $exception; throw $exception;
} }
} }

View File

@@ -34,7 +34,6 @@ use OCP\Migration\IRepairStep;
use OCP\Migration\IOutput; use OCP\Migration\IOutput;
class UnknownUsers implements IRepairStep { class UnknownUsers implements IRepairStep {
private $userManager; private $userManager;
private $groupManager; private $groupManager;
private $aclMapper; private $aclMapper;
@@ -76,7 +75,6 @@ class UnknownUsers implements IRepairStep {
$this->aclMapper->delete($acl); $this->aclMapper->delete($acl);
} }
} }
} }
} }
} }

View File

@@ -323,5 +323,4 @@ class Version1000Date20200306161713 extends SimpleMigrationStep {
} }
return $schema; return $schema;
} }
} }

View File

@@ -23,9 +23,7 @@
namespace OCA\Deck; namespace OCA\Deck;
class NoPermissionException extends StatusException { class NoPermissionException extends StatusException {
public function __construct($message, $controller = null, $method = null) { public function __construct($message, $controller = null, $method = null) {
parent::__construct($message); parent::__construct($message);
if ($controller && $method) { if ($controller && $method) {

View File

@@ -23,9 +23,7 @@
namespace OCA\Deck; namespace OCA\Deck;
class NotFoundException extends StatusException { class NotFoundException extends StatusException {
public function __construct($message = '') { public function __construct($message = '') {
parent::__construct($message); parent::__construct($message);
} }

View File

@@ -189,5 +189,4 @@ class NotificationHelper {
->setSubject('board-shared', [$board->getTitle(), $this->currentUser]); ->setSubject('board-shared', [$board->getTitle(), $this->currentUser]);
return $notification; return $notification;
} }
} }

View File

@@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@@ -28,7 +29,6 @@ declare(strict_types=1);
namespace OCA\Deck\Provider; namespace OCA\Deck\Provider;
use OC\FullTextSearch\Model\IndexDocument; use OC\FullTextSearch\Model\IndexDocument;
use OC\FullTextSearch\Model\SearchTemplate; use OC\FullTextSearch\Model\SearchTemplate;
use OCA\Deck\Service\FullTextSearchService; use OCA\Deck\Service\FullTextSearchService;
@@ -46,16 +46,13 @@ use OCP\FullTextSearch\Model\ISearchTemplate;
use OCP\IL10N; use OCP\IL10N;
use OCP\IURLGenerator; use OCP\IURLGenerator;
/** /**
* Class DeckProvider * Class DeckProvider
* *
* @package OCA\Deck\Provider * @package OCA\Deck\Provider
*/ */
class DeckProvider implements IFullTextSearchProvider { class DeckProvider implements IFullTextSearchProvider {
public const DECK_PROVIDER_ID = 'deck';
const DECK_PROVIDER_ID = 'deck';
/** @var IL10N */ /** @var IL10N */
@@ -276,6 +273,4 @@ class DeckProvider implements IFullTextSearchProvider {
$this->runner->setInfo($info, $value); $this->runner->setInfo($info, $value);
} }
} }

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Service; namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\BadRequestException; use OCA\Deck\BadRequestException;
use OCA\Deck\Db\Acl; use OCA\Deck\Db\Acl;
@@ -40,8 +39,6 @@ use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity; use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException; use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class AssignmentService { class AssignmentService {
@@ -110,7 +107,6 @@ class AssignmentService {
* @throws DoesNotExistException * @throws DoesNotExistException
*/ */
public function assignUser($cardId, $userId, int $type = AssignedUsers::TYPE_USER) { public function assignUser($cardId, $userId, int $type = AssignedUsers::TYPE_USER) {
if (is_numeric($cardId) === false) { if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Service; namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\AppInfo\Application; use OCA\Deck\AppInfo\Application;
use OCA\Deck\BadRequestException; use OCA\Deck\BadRequestException;
@@ -42,7 +41,6 @@ use OCP\ICacheFactory;
use OCP\IL10N; use OCP\IL10N;
class AttachmentService { class AttachmentService {
private $attachmentMapper; private $attachmentMapper;
private $cardMapper; private $cardMapper;
private $permissionService; private $permissionService;
@@ -116,7 +114,6 @@ class AttachmentService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function findAll($cardId, $withDeleted = false) { public function findAll($cardId, $withDeleted = false) {
if (is_numeric($cardId) === false) { if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }
@@ -144,7 +141,6 @@ class AttachmentService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function count($cardId) { public function count($cardId) {
if (is_numeric($cardId) === false) { if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }
@@ -167,7 +163,6 @@ class AttachmentService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function create($cardId, $type, $data) { public function create($cardId, $type, $data) {
if (is_numeric($cardId) === false) { if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }
@@ -228,7 +223,6 @@ class AttachmentService {
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
*/ */
public function display($cardId, $attachmentId) { public function display($cardId, $attachmentId) {
if (is_numeric($cardId) === false) { if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }
@@ -261,7 +255,6 @@ class AttachmentService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function update($cardId, $attachmentId, $data) { public function update($cardId, $attachmentId, $data) {
if (is_numeric($cardId) === false) { if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }
@@ -312,7 +305,6 @@ class AttachmentService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function delete($cardId, $attachmentId) { public function delete($cardId, $attachmentId) {
if (is_numeric($cardId) === false) { if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }
@@ -343,7 +335,6 @@ class AttachmentService {
} }
public function restore($cardId, $attachmentId) { public function restore($cardId, $attachmentId) {
if (is_numeric($cardId) === false) { if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }

View File

@@ -26,7 +26,6 @@ namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Activity\ChangeSet; use OCA\Deck\Activity\ChangeSet;
use OCA\Deck\Collaboration\Resources\ResourceProvider;
use OCA\Deck\Db\Acl; use OCA\Deck\Db\Acl;
use OCA\Deck\Db\AclMapper; use OCA\Deck\Db\AclMapper;
use OCA\Deck\Db\AssignedUsersMapper; use OCA\Deck\Db\AssignedUsersMapper;
@@ -48,9 +47,7 @@ use OCA\Deck\BadRequestException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Component\EventDispatcher\GenericEvent;
class BoardService { class BoardService {
private $boardMapper; private $boardMapper;
private $stackMapper; private $stackMapper;
private $labelMapper; private $labelMapper;
@@ -154,8 +151,7 @@ class BoardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function find($boardId) { public function find($boardId) {
if (is_numeric($boardId) === false) {
if ( is_numeric($boardId) === false ) {
throw new BadRequestException('board id must be a number'); throw new BadRequestException('board id must be a number');
} }
@@ -202,7 +198,6 @@ class BoardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function isArchived($mapper, $id) { public function isArchived($mapper, $id) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number'); throw new BadRequestException('id must be a number');
} }
@@ -232,7 +227,6 @@ class BoardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function isDeleted($mapper, $id) { public function isDeleted($mapper, $id) {
if ($mapper === false || $mapper === null) { if ($mapper === false || $mapper === null) {
throw new BadRequestException('mapper must be provided'); throw new BadRequestException('mapper must be provided');
} }
@@ -265,7 +259,6 @@ class BoardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function create($title, $userId, $color) { public function create($title, $userId, $color) {
if ($title === false || $title === null) { if ($title === false || $title === null) {
throw new BadRequestException('title must be provided'); throw new BadRequestException('title must be provided');
} }
@@ -334,7 +327,6 @@ class BoardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function delete($id) { public function delete($id) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('board id must be a number'); throw new BadRequestException('board id must be a number');
} }
@@ -364,7 +356,6 @@ class BoardService {
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
*/ */
public function deleteUndo($id) { public function deleteUndo($id) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('board id must be a number'); throw new BadRequestException('board id must be a number');
} }
@@ -419,7 +410,6 @@ class BoardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function update($id, $title, $color, $archived) { public function update($id, $title, $color, $archived) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('board id must be a number'); throw new BadRequestException('board id must be a number');
} }
@@ -432,7 +422,7 @@ class BoardService {
throw new BadRequestException('color must be provided'); throw new BadRequestException('color must be provided');
} }
if ( is_bool($archived) === false ) { if (is_bool($archived) === false) {
throw new BadRequestException('archived must be a boolean'); throw new BadRequestException('archived must be a boolean');
} }
@@ -479,7 +469,6 @@ class BoardService {
* @throws \OCA\Deck\NoPermissionException * @throws \OCA\Deck\NoPermissionException
*/ */
public function addAcl($boardId, $type, $participant, $edit, $share, $manage) { public function addAcl($boardId, $type, $participant, $edit, $share, $manage) {
if (is_numeric($boardId) === false) { if (is_numeric($boardId) === false) {
throw new BadRequestException('board id must be a number'); throw new BadRequestException('board id must be a number');
} }
@@ -529,7 +518,8 @@ class BoardService {
try { try {
$resourceProvider = \OC::$server->query(\OCA\Deck\Collaboration\Resources\ResourceProvider::class); $resourceProvider = \OC::$server->query(\OCA\Deck\Collaboration\Resources\ResourceProvider::class);
$resourceProvider->invalidateAccessCache($boardId); $resourceProvider->invalidateAccessCache($boardId);
} catch (\Exception $e) {} } catch (\Exception $e) {
}
} }
$this->eventDispatcher->dispatch( $this->eventDispatcher->dispatch(
@@ -551,7 +541,6 @@ class BoardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function updateAcl($id, $edit, $share, $manage) { public function updateAcl($id, $edit, $share, $manage) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number'); throw new BadRequestException('id must be a number');
} }
@@ -596,7 +585,6 @@ class BoardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function deleteAcl($id) { public function deleteAcl($id) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number'); throw new BadRequestException('id must be a number');
} }
@@ -619,7 +607,8 @@ class BoardService {
try { try {
$resourceProvider = \OC::$server->query(\OCA\Deck\Collaboration\Resources\ResourceProvider::class); $resourceProvider = \OC::$server->query(\OCA\Deck\Collaboration\Resources\ResourceProvider::class);
$resourceProvider->invalidateAccessCache($acl->getBoardId()); $resourceProvider->invalidateAccessCache($acl->getBoardId());
} catch (\Exception $e) {} } catch (\Exception $e) {
}
} }
$delete = $this->aclMapper->delete($acl); $delete = $this->aclMapper->delete($acl);
@@ -639,7 +628,6 @@ class BoardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function clone($id) { public function clone($id) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('board id must be a number'); throw new BadRequestException('board id must be a number');
} }
@@ -683,7 +671,7 @@ class BoardService {
private function enrichWithStacks($board, $since = -1) { private function enrichWithStacks($board, $since = -1) {
$stacks = $this->stackMapper->findAll($board->getId(), null, null, $since); $stacks = $this->stackMapper->findAll($board->getId(), null, null, $since);
if(\count($stacks) === 0) { if (\count($stacks) === 0) {
return; return;
} }
@@ -693,7 +681,7 @@ class BoardService {
private function enrichWithLabels($board, $since = -1) { private function enrichWithLabels($board, $since = -1) {
$labels = $this->labelMapper->findAll($board->getId(), null, null, $since); $labels = $this->labelMapper->findAll($board->getId(), null, null, $since);
if(\count($labels) === 0) { if (\count($labels) === 0) {
return; return;
} }
@@ -702,10 +690,9 @@ class BoardService {
private function enrichWithUsers($board, $since = -1) { private function enrichWithUsers($board, $since = -1) {
$boardUsers = $this->permissionService->findUsers($board->getId()); $boardUsers = $this->permissionService->findUsers($board->getId());
if(\count($boardUsers) === 0) { if (\count($boardUsers) === 0) {
return; return;
} }
$board->setUsers(array_values($boardUsers)); $board->setUsers(array_values($boardUsers));
} }
} }

View File

@@ -28,7 +28,6 @@ namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Activity\ChangeSet; use OCA\Deck\Activity\ChangeSet;
use OCA\Deck\Db\AssignedUsers;
use OCA\Deck\Db\AssignedUsersMapper; use OCA\Deck\Db\AssignedUsersMapper;
use OCA\Deck\Db\Card; use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
@@ -39,19 +38,13 @@ use OCA\Deck\Event\FTSEvent;
use OCA\Deck\Notification\NotificationHelper; use OCA\Deck\Notification\NotificationHelper;
use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\LabelMapper; use OCA\Deck\Db\LabelMapper;
use OCA\Deck\NotFoundException;
use OCA\Deck\StatusException; use OCA\Deck\StatusException;
use OCA\Deck\BadRequestException; use OCA\Deck\BadRequestException;
use OCP\Activity\IEvent;
use OCP\Comments\ICommentsManager; use OCP\Comments\ICommentsManager;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventDispatcher;
use OCP\IUserManager; use OCP\IUserManager;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class CardService { class CardService {
private $cardMapper; private $cardMapper;
private $stackMapper; private $stackMapper;
private $boardMapper; private $boardMapper;
@@ -132,7 +125,6 @@ class CardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function find($cardId) { public function find($cardId) {
if (is_numeric($cardId) === false) { if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }
@@ -218,7 +210,6 @@ class CardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function delete($id) { public function delete($id) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }
@@ -257,7 +248,6 @@ class CardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function update($id, $title, $stackId, $type, $order = 0, $description = '', $owner, $duedate = null, $deletedAt = null, $archived = null) { public function update($id, $title, $stackId, $type, $order = 0, $description = '', $owner, $duedate = null, $deletedAt = null, $archived = null) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }
@@ -347,7 +337,6 @@ class CardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function rename($id, $title) { public function rename($id, $title) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number'); throw new BadRequestException('id must be a number');
} }
@@ -387,7 +376,6 @@ class CardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function reorder($id, $stackId, $order) { public function reorder($id, $stackId, $order) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }
@@ -448,7 +436,6 @@ class CardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function archive($id) { public function archive($id) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number'); throw new BadRequestException('id must be a number');
} }
@@ -481,7 +468,6 @@ class CardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function unarchive($id) { public function unarchive($id) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number'); throw new BadRequestException('id must be a number');
} }
@@ -513,7 +499,6 @@ class CardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function assignLabel($cardId, $labelId) { public function assignLabel($cardId, $labelId) {
if (is_numeric($cardId) === false) { if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }
@@ -550,7 +535,6 @@ class CardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function removeLabel($cardId, $labelId) { public function removeLabel($cardId, $labelId) {
if (is_numeric($cardId) === false) { if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number'); throw new BadRequestException('card id must be a number');
} }
@@ -576,5 +560,4 @@ class CardService {
'\OCA\Deck\Card::onUpdate', new FTSEvent(null, ['id' => $cardId, 'card' => $card]) '\OCA\Deck\Card::onUpdate', new FTSEvent(null, ['id' => $cardId, 'card' => $card])
); );
} }
} }

View File

@@ -23,14 +23,12 @@
namespace OCA\Deck\Service; namespace OCA\Deck\Service;
use OCA\Deck\AppInfo\Application; use OCA\Deck\AppInfo\Application;
use OCA\Deck\BadRequestException; use OCA\Deck\BadRequestException;
use OCA\Deck\Db\Acl; use OCA\Deck\Db\Acl;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\NoPermissionException; use OCA\Deck\NoPermissionException;
use OCA\Deck\NotFoundException; use OCA\Deck\NotFoundException;
use OCA\Deck\StatusException;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\Comments\IComment; use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager; use OCP\Comments\ICommentsManager;
@@ -39,7 +37,6 @@ use OCP\Comments\NotFoundException as CommentNotFoundException;
use OCP\ILogger; use OCP\ILogger;
use OCP\IUserManager; use OCP\IUserManager;
use OutOfBoundsException; use OutOfBoundsException;
use Sabre\DAV\Exception\Forbidden;
use function is_numeric; use function is_numeric;
class CommentService { class CommentService {
@@ -125,7 +122,6 @@ class CommentService {
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ); $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
try { try {
$comment = $this->commentsManager->get($commentId); $comment = $this->commentsManager->get($commentId);
} catch (CommentNotFoundException $e) { } catch (CommentNotFoundException $e) {
throw new NotFoundException('No comment found.'); throw new NotFoundException('No comment found.');
} }
@@ -147,7 +143,6 @@ class CommentService {
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ); $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
try { try {
$comment = $this->commentsManager->get($commentId); $comment = $this->commentsManager->get($commentId);
} catch (CommentNotFoundException $e) { } catch (CommentNotFoundException $e) {
throw new NotFoundException('No comment found.'); throw new NotFoundException('No comment found.');
} }
@@ -170,7 +165,7 @@ class CommentService {
'actorType' => $comment->getActorType(), 'actorType' => $comment->getActorType(),
'actorDisplayName' => $actorDisplayName, 'actorDisplayName' => $actorDisplayName,
'creationDateTime' => $comment->getCreationDateTime()->format(\DateTime::ATOM), 'creationDateTime' => $comment->getCreationDateTime()->format(\DateTime::ATOM),
'mentions' => array_map(function($mention) { 'mentions' => array_map(function ($mention) {
try { try {
$displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']); $displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']);
} catch (OutOfBoundsException $e) { } catch (OutOfBoundsException $e) {
@@ -187,5 +182,4 @@ class CommentService {
}, $comment->getMentions()), }, $comment->getMentions()),
]; ];
} }
} }

View File

@@ -31,7 +31,6 @@ use OCA\Deck\BadRequestException;
use OCP\PreConditionNotMetException; use OCP\PreConditionNotMetException;
class DefaultBoardService { class DefaultBoardService {
private $boardMapper; private $boardMapper;
private $boardService; private $boardService;
private $stackService; private $stackService;
@@ -47,7 +46,6 @@ class DefaultBoardService {
CardService $cardService, CardService $cardService,
IConfig $config IConfig $config
) { ) {
$this->boardService = $boardService; $this->boardService = $boardService;
$this->stackService = $stackService; $this->stackService = $stackService;
$this->cardService = $cardService; $this->cardService = $cardService;
@@ -90,7 +88,6 @@ class DefaultBoardService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function createDefaultBoard(string $title, string $userId, string $color) { public function createDefaultBoard(string $title, string $userId, string $color) {
if ($title === false || $title === null) { if ($title === false || $title === null) {
throw new BadRequestException('title must be provided'); throw new BadRequestException('title must be provided');
} }

View File

@@ -23,17 +23,13 @@
namespace OCA\Deck\Service; namespace OCA\Deck\Service;
use OC\Security\CSP\ContentSecurityPolicyManager;
use OCA\Deck\Db\Attachment; use OCA\Deck\Db\Attachment;
use OCA\Deck\Db\AttachmentMapper; use OCA\Deck\Db\AttachmentMapper;
use OCA\Deck\StatusException; use OCA\Deck\StatusException;
use OCA\Deck\Exceptions\ConflictException; use OCA\Deck\Exceptions\ConflictException;
use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\EmptyContentSecurityPolicy;
use OCP\AppFramework\Http\FileDisplayResponse; use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\AppFramework\Http\StreamResponse; use OCP\AppFramework\Http\StreamResponse;
use OCP\Files\Cache\IScanner;
use OCP\Files\Folder;
use OCP\Files\IAppData; use OCP\Files\IAppData;
use OCP\Files\IRootFolder; use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException; use OCP\Files\NotFoundException;
@@ -45,9 +41,7 @@ use OCP\IL10N;
use OCP\ILogger; use OCP\ILogger;
use OCP\IRequest; use OCP\IRequest;
class FileService implements IAttachmentService { class FileService implements IAttachmentService {
private $l10n; private $l10n;
private $appData; private $appData;
private $request; private $request;
@@ -122,7 +116,7 @@ class FileService implements IAttachmentService {
* @return array * @return array
* @throws StatusException * @throws StatusException
*/ */
private function getUploadedFile () { private function getUploadedFile() {
$file = $this->request->getUploadedFile('file'); $file = $this->request->getUploadedFile('file');
$error = null; $error = null;
$phpFileUploadErrors = [ $phpFileUploadErrors = [

View File

@@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
@@ -28,7 +29,6 @@ declare(strict_types=1);
namespace OCA\Deck\Service; namespace OCA\Deck\Service;
use OC\FullTextSearch\Model\DocumentAccess; use OC\FullTextSearch\Model\DocumentAccess;
use OC\FullTextSearch\Model\IndexDocument; use OC\FullTextSearch\Model\IndexDocument;
use OCA\Deck\Db\Board; use OCA\Deck\Db\Board;
@@ -47,7 +47,6 @@ use OCP\FullTextSearch\Model\IDocumentAccess;
use OCP\FullTextSearch\Model\IIndex; use OCP\FullTextSearch\Model\IIndex;
use OCP\FullTextSearch\Model\IIndexDocument; use OCP\FullTextSearch\Model\IIndexDocument;
/** /**
* Class FullTextSearchService * Class FullTextSearchService
* *
@@ -142,7 +141,7 @@ class FullTextSearchService {
$boardId = (int)$e->getArgument('boardId'); $boardId = (int)$e->getArgument('boardId');
$cards = array_map( $cards = array_map(
function(Card $item) { function (Card $item) {
return $item->getId(); return $item->getId();
}, },
$this->getCardsFromBoard($boardId) $this->getCardsFromBoard($boardId)
@@ -266,7 +265,6 @@ class FullTextSearchService {
*/ */
private function getStacksFromBoard(int $boardId): array { private function getStacksFromBoard(int $boardId): array {
return $this->stackMapper->findAll($boardId, null, null); return $this->stackMapper->findAll($boardId, null, null);
} }
@@ -278,7 +276,4 @@ class FullTextSearchService {
private function getBoardsFromUser(string $userId): array { private function getBoardsFromUser(string $userId): array {
return $this->boardMapper->findAllByUser($userId, null, null, -1); return $this->boardMapper->findAllByUser($userId, null, null, -1);
} }
} }

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Service; namespace OCA\Deck\Service;
use OCA\Deck\Db\Attachment; use OCA\Deck\Db\Attachment;
use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\Response;
@@ -95,5 +94,4 @@ interface IAttachmentService {
* @param Attachment $attachment * @param Attachment $attachment
*/ */
public function markAsDeleted(Attachment $attachment); public function markAsDeleted(Attachment $attachment);
} }

View File

@@ -30,7 +30,6 @@ use OCA\Deck\Db\LabelMapper;
use OCA\Deck\StatusException; use OCA\Deck\StatusException;
use OCA\Deck\BadRequestException; use OCA\Deck\BadRequestException;
class LabelService { class LabelService {
/** @var LabelMapper */ /** @var LabelMapper */
@@ -77,7 +76,6 @@ class LabelService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function create($title, $color, $boardId) { public function create($title, $color, $boardId) {
if ($title === false || $title === null) { if ($title === false || $title === null) {
throw new BadRequestException('title must be provided'); throw new BadRequestException('title must be provided');
} }
@@ -94,7 +92,7 @@ class LabelService {
$boardLabels = $this->labelMapper->findAll($boardId); $boardLabels = $this->labelMapper->findAll($boardId);
if (\is_array($boardLabels)) { if (\is_array($boardLabels)) {
foreach($boardLabels as $boardLabel) { foreach ($boardLabels as $boardLabel) {
if ($boardLabel->getTitle() === $title) { if ($boardLabel->getTitle() === $title) {
throw new BadRequestException('title must be unique'); throw new BadRequestException('title must be unique');
break; break;
@@ -123,7 +121,6 @@ class LabelService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function delete($id) { public function delete($id) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('label id must be a number'); throw new BadRequestException('label id must be a number');
} }
@@ -149,7 +146,6 @@ class LabelService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function update($id, $title, $color) { public function update($id, $title, $color) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('label id must be a number'); throw new BadRequestException('label id must be a number');
} }
@@ -168,7 +164,7 @@ class LabelService {
$boardLabels = $this->labelMapper->findAll($label->getBoardId()); $boardLabels = $this->labelMapper->findAll($label->getBoardId());
if (\is_array($boardLabels)) { if (\is_array($boardLabels)) {
foreach($boardLabels as $boardLabel) { foreach ($boardLabels as $boardLabel) {
if ($boardLabel->getId() === $label->getId()) { if ($boardLabel->getId() === $label->getId()) {
continue; continue;
} }
@@ -188,5 +184,4 @@ class LabelService {
$this->changeHelper->boardChanged($label->getBoardId()); $this->changeHelper->boardChanged($label->getBoardId());
return $this->labelMapper->update($label); return $this->labelMapper->update($label);
} }
} }

View File

@@ -33,14 +33,12 @@ use OCA\Deck\NoPermissionException;
use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity; use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException; use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\AppFramework\QueryException;
use OCP\IConfig; use OCP\IConfig;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\ILogger; use OCP\ILogger;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\Share\IManager; use OCP\Share\IManager;
class PermissionService { class PermissionService {
/** @var BoardMapper */ /** @var BoardMapper */

View File

@@ -39,9 +39,7 @@ use OCA\Deck\StatusException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Component\EventDispatcher\GenericEvent;
class StackService { class StackService {
private $stackMapper; private $stackMapper;
private $cardMapper; private $cardMapper;
private $boardMapper; private $boardMapper;
@@ -166,7 +164,6 @@ class StackService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function findAllArchived($boardId) { public function findAllArchived($boardId) {
if (is_numeric($boardId) === false) { if (is_numeric($boardId) === false) {
throw new BadRequestException('board id must be a number'); throw new BadRequestException('board id must be a number');
} }
@@ -200,7 +197,6 @@ class StackService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function create($title, $boardId, $order) { public function create($title, $boardId, $order) {
if ($title === false || $title === null) { if ($title === false || $title === null) {
throw new BadRequestException('title must be provided'); throw new BadRequestException('title must be provided');
} }
@@ -245,7 +241,6 @@ class StackService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function delete($id) { public function delete($id) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('stack id must be a number'); throw new BadRequestException('stack id must be a number');
} }
@@ -284,7 +279,6 @@ class StackService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function update($id, $title, $boardId, $order, $deletedAt) { public function update($id, $title, $boardId, $order, $deletedAt) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRequestException('stack id must be a number'); throw new BadRequestException('stack id must be a number');
} }
@@ -336,7 +330,6 @@ class StackService {
* @throws BadRequestException * @throws BadRequestException
*/ */
public function reorder($id, $order) { public function reorder($id, $order) {
if (is_numeric($id) === false) { if (is_numeric($id) === false) {
throw new BadRquestException('id must be a number'); throw new BadRquestException('id must be a number');
} }

View File

@@ -23,9 +23,7 @@
namespace OCA\Deck; namespace OCA\Deck;
class StatusException extends \Exception { class StatusException extends \Exception {
public function __construct($message) { public function __construct($message) {
parent::__construct($message); parent::__construct($message);
} }

View File

@@ -21,7 +21,6 @@
* *
*/ */
use OCP\Util;
style('deck', 'globalstyles'); style('deck', 'globalstyles');
script('deck', 'deck'); script('deck', 'deck');

View File

@@ -0,0 +1 @@
C:37:"PHPUnit\Runner\DefaultTestResultCache":3426:{a:2:{s:7:"defects";a:5:{s:89:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcessNotRememberedLogin";i:4;s:71:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcess";i:3;s:102:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcessNotRemeberedLoginWithAutologout";i:4;s:52:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareLink";i:4;s:64:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareLinkPublicUpload";i:3;}s:5:"times";a:38:{s:89:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcessNotRememberedLogin";d:0.008;s:71:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcess";d:0.001;s:102:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcessNotRemeberedLoginWithAutologout";d:0.001;s:52:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareLink";d:0.19;s:56:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareUserFile";d:0.485;s:58:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareUserFolder";d:0.226;s:57:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareGroupFile";d:0.244;s:59:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareGroupFolder";d:0.222;s:64:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareLinkPublicUpload";d:0.121;s:56:"OCA\Files_Sharing\Tests\ApiTest::testEnforceLinkPassword";d:0.576;s:53:"OCA\Files_Sharing\Tests\ApiTest::testSharePermissions";d:0.167;s:49:"OCA\Files_Sharing\Tests\ApiTest::testGetAllShares";d:0.129;s:55:"OCA\Files_Sharing\Tests\ApiTest::testGetAllSharesWithMe";d:0.182;s:50:"OCA\Files_Sharing\Tests\ApiTest::testPublicLinkUrl";d:0.133;s:55:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromSource";d:0.135;s:67:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromSourceWithReshares";d:0.162;s:51:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromId";d:0.13;s:55:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromFolder";d:0.165;s:63:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromFolderWithFile";d:0.125;s:63:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromFolderReshares";d:0.185;s:66:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromSubFolderReShares";d:0.183;s:65:"OCA\Files_Sharing\Tests\ApiTest::testGetShareMultipleSharedFolder";d:0.263;s:63:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromFileReReShares";d:0.203;s:58:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromUnknownId";d:0.11;s:48:"OCA\Files_Sharing\Tests\ApiTest::testUpdateShare";d:0.391;s:54:"OCA\Files_Sharing\Tests\ApiTest::testUpdateShareUpload";d:0.142;s:58:"OCA\Files_Sharing\Tests\ApiTest::testUpdateShareExpireDate";d:0.146;s:48:"OCA\Files_Sharing\Tests\ApiTest::testDeleteShare";d:0.159;s:50:"OCA\Files_Sharing\Tests\ApiTest::testDeleteReshare";d:0.177;s:63:"OCA\Files_Sharing\Tests\ApiTest::testShareFolderWithAMountPoint";d:0.236;s:59:"OCA\Files_Sharing\Tests\ApiTest::testShareStorageMountPoint";d:0.165;s:74:"OCA\Files_Sharing\Tests\ApiTest::testPublicLinkExpireDate with data set #0";d:0.088;s:74:"OCA\Files_Sharing\Tests\ApiTest::testPublicLinkExpireDate with data set #1";d:0.111;s:74:"OCA\Files_Sharing\Tests\ApiTest::testPublicLinkExpireDate with data set #2";d:0.119;s:68:"OCA\Files_Sharing\Tests\ApiTest::testCreatePublicLinkExpireDateValid";d:0.135;s:76:"OCA\Files_Sharing\Tests\ApiTest::testCreatePublicLinkExpireDateInvalidFuture";d:0.119;s:56:"OCA\Files_Sharing\Tests\ApiTest::testInvisibleSharesUser";d:0.154;s:57:"OCA\Files_Sharing\Tests\ApiTest::testInvisibleSharesGroup";d:0.165;}}}

View File

@@ -21,17 +21,14 @@
* *
*/ */
use OCP\AppFramework\App;
use Test\TestCase; use Test\TestCase;
/** /**
* This test shows how to make a small Integration Test. Query your class * This test shows how to make a small Integration Test. Query your class
* directly from the container, only pass in mocks if needed and run your tests * directly from the container, only pass in mocks if needed and run your tests
* against the database * against the database
*/ */
class AppTest extends TestCase { class AppTest extends TestCase {
private $container; private $container;
private $app; private $app;
@@ -50,5 +47,4 @@ class AppTest extends TestCase {
$this->app->registerNavigationEntry(); $this->app->registerNavigationEntry();
$this->assertTrue(true); $this->assertTrue(true);
} }
} }

View File

@@ -33,7 +33,6 @@ use OCA\Deck\Service\CardService;
* @coversDefaultClass OCA\Deck\Db\AssignedUsersMapper * @coversDefaultClass OCA\Deck\Db\AssignedUsersMapper
*/ */
class AssignedUsersMapperTest extends \Test\TestCase { class AssignedUsersMapperTest extends \Test\TestCase {
private const TEST_USER1 = 'test-share-user1'; private const TEST_USER1 = 'test-share-user1';
private const TEST_USER3 = 'test-share-user3'; private const TEST_USER3 = 'test-share-user3';
private const TEST_USER2 = 'test-share-user2'; private const TEST_USER2 = 'test-share-user2';

View File

@@ -24,13 +24,12 @@
/** /**
* @group DB * @group DB
*/ */
class BoardDatabaseTest extends \Test\TestCase class BoardDatabaseTest extends \Test\TestCase {
{ public const TEST_USER1 = "test-share-user1";
const TEST_USER1 = "test-share-user1"; public const TEST_USER2 = "test-share-user2";
const TEST_USER2 = "test-share-user2"; public const TEST_USER3 = "test-share-user3";
const TEST_USER3 = "test-share-user3"; public const TEST_USER4 = "test-share-user4";
const TEST_USER4 = "test-share-user4"; public const TEST_GROUP1 = "test-share-group1";
const TEST_GROUP1 = "test-share-group1";
/** @var \OCA\Deck\Service\BoardService */ /** @var \OCA\Deck\Service\BoardService */
private $boardService; private $boardService;

View File

@@ -32,7 +32,6 @@ use GuzzleHttp\Message\ResponseInterface;
require __DIR__ . '/../../vendor/autoload.php'; require __DIR__ . '/../../vendor/autoload.php';
trait BasicStructure { trait BasicStructure {
use Auth; use Auth;
/** @var string */ /** @var string */
@@ -104,7 +103,7 @@ trait BasicStructure {
*/ */
public function usingServer($server) { public function usingServer($server) {
$previousServer = $this->currentServer; $previousServer = $this->currentServer;
if ($server === 'LOCAL'){ if ($server === 'LOCAL') {
$this->baseUrl = $this->localBaseUrl; $this->baseUrl = $this->localBaseUrl;
$this->currentServer = 'LOCAL'; $this->currentServer = 'LOCAL';
return $previousServer; return $previousServer;
@@ -139,8 +138,10 @@ trait BasicStructure {
* @param array $arrayOfArrays * @param array $arrayOfArrays
* @return array * @return array
*/ */
public function simplifyArray($arrayOfArrays){ public function simplifyArray($arrayOfArrays) {
$a = array_map(function($subArray) { return $subArray[0]; }, $arrayOfArrays); $a = array_map(function ($subArray) {
return $subArray[0];
}, $arrayOfArrays);
return $a; return $a;
} }
@@ -211,7 +212,7 @@ trait BasicStructure {
} }
} }
public function isExpectedUrl($possibleUrl, $finalPart){ public function isExpectedUrl($possibleUrl, $finalPart) {
$baseUrlChopped = substr($this->baseUrl, 0, -4); $baseUrlChopped = substr($this->baseUrl, 0, -4);
$endCharacter = strlen($baseUrlChopped) + strlen($finalPart); $endCharacter = strlen($baseUrlChopped) + strlen($finalPart);
return (substr($possibleUrl,0,$endCharacter) == "$baseUrlChopped" . "$finalPart"); return (substr($possibleUrl,0,$endCharacter) == "$baseUrlChopped" . "$finalPart");
@@ -328,7 +329,7 @@ trait BasicStructure {
} }
} }
public static function removeFile($path, $filename){ public static function removeFile($path, $filename) {
if (file_exists("$path" . "$filename")) { if (file_exists("$path" . "$filename")) {
unlink("$path" . "$filename"); unlink("$path" . "$filename");
} }
@@ -352,7 +353,7 @@ trait BasicStructure {
fclose($file); fclose($file);
} }
public function createFileWithText($name, $text){ public function createFileWithText($name, $text) {
$file = fopen("work/" . "$name", 'w'); $file = fopen("work/" . "$name", 'w');
fwrite($file, $text); fwrite($file, $text);
fclose($file); fclose($file);
@@ -387,8 +388,8 @@ trait BasicStructure {
/** /**
* @BeforeSuite * @BeforeSuite
*/ */
public static function addFilesToSkeleton(){ public static function addFilesToSkeleton() {
for ($i=0; $i<5; $i++){ for ($i=0; $i<5; $i++) {
file_put_contents("../../core/skeleton/" . "textfile" . "$i" . ".txt", "Nextcloud test text file\n"); file_put_contents("../../core/skeleton/" . "textfile" . "$i" . ".txt", "Nextcloud test text file\n");
} }
if (!file_exists("../../core/skeleton/FOLDER")) { if (!file_exists("../../core/skeleton/FOLDER")) {
@@ -407,8 +408,8 @@ trait BasicStructure {
/** /**
* @AfterSuite * @AfterSuite
*/ */
public static function removeFilesFromSkeleton(){ public static function removeFilesFromSkeleton() {
for ($i=0; $i<5; $i++){ for ($i=0; $i<5; $i++) {
self::removeFile("../../core/skeleton/", "textfile" . "$i" . ".txt"); self::removeFile("../../core/skeleton/", "textfile" . "$i" . ".txt");
} }
if (is_dir("../../core/skeleton/FOLDER")) { if (is_dir("../../core/skeleton/FOLDER")) {
@@ -427,11 +428,11 @@ trait BasicStructure {
/** /**
* @BeforeScenario @local_storage * @BeforeScenario @local_storage
*/ */
public static function removeFilesFromLocalStorageBefore(){ public static function removeFilesFromLocalStorageBefore() {
$dir = "./work/local_storage/"; $dir = "./work/local_storage/";
$di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS); $di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
$ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST); $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
foreach ( $ri as $file ) { foreach ($ri as $file) {
$file->isDir() ? rmdir($file) : unlink($file); $file->isDir() ? rmdir($file) : unlink($file);
} }
} }
@@ -439,11 +440,11 @@ trait BasicStructure {
/** /**
* @AfterScenario @local_storage * @AfterScenario @local_storage
*/ */
public static function removeFilesFromLocalStorageAfter(){ public static function removeFilesFromLocalStorageAfter() {
$dir = "./work/local_storage/"; $dir = "./work/local_storage/";
$di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS); $di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
$ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST); $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
foreach ( $ri as $file ) { foreach ($ri as $file) {
$file->isDir() ? rmdir($file) : unlink($file); $file->isDir() ? rmdir($file) : unlink($file);
} }
} }

View File

@@ -3,20 +3,18 @@
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\TableNode; use Behat\Gherkin\Node\TableNode;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use Behat\Behat\Tester\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode; use Behat\Gherkin\Node\PyStringNode;
use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ClientException;
require_once __DIR__ . '/../../vendor/autoload.php'; require_once __DIR__ . '/../../vendor/autoload.php';
class FeatureContext implements Context { class FeatureContext implements Context {
use WebDav; use WebDav;
/** @var string */ /** @var string */
private $mappedUserId; private $mappedUserId;
private $lastInsertIds = array(); private $lastInsertIds = [];
/** /**
* @BeforeSuite * @BeforeSuite
@@ -118,7 +116,7 @@ class FeatureContext implements Context {
public function theResponseShouldBeAJsonArrayWithALengthOf($length) { public function theResponseShouldBeAJsonArrayWithALengthOf($length) {
$realResponseArray = json_decode($this->response->getBody()->getContents(), true); $realResponseArray = json_decode($this->response->getBody()->getContents(), true);
PHPUnit_Framework_Assert::assertEquals($realResponseArray, "foo"); PHPUnit_Framework_Assert::assertEquals($realResponseArray, "foo");
if((int)count($realResponseArray) !== (int)$length) { if ((int)count($realResponseArray) !== (int)$length) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
sprintf( sprintf(
'Expected %d as length got %d', 'Expected %d as length got %d',
@@ -135,8 +133,7 @@ class FeatureContext implements Context {
* @param PyStringNode $string * @param PyStringNode $string
* @throws \Exception * @throws \Exception
*/ */
public function iShouldGet(PyStringNode $string) public function iShouldGet(PyStringNode $string) {
{
if ((string) $string !== trim($this->cliOutput)) { if ((string) $string !== trim($this->cliOutput)) {
throw new Exception(sprintf( throw new Exception(sprintf(
'Expected "%s" but received "%s".', 'Expected "%s" but received "%s".',
@@ -172,7 +169,6 @@ class FeatureContext implements Context {
* @Given /^creates a board named "([^"]*)" with color "([^"]*)"$/ * @Given /^creates a board named "([^"]*)" with color "([^"]*)"$/
*/ */
public function createsABoardNamedWithColor($title, $color) { public function createsABoardNamedWithColor($title, $color) {
$this->sendJSONrequest('POST', '/index.php/apps/deck/boards', [ $this->sendJSONrequest('POST', '/index.php/apps/deck/boards', [
'title' => $title, 'title' => $title,
'color' => $color 'color' => $color
@@ -190,5 +186,4 @@ class FeatureContext implements Context {
$id = $this->lastInsertIds[$boardName]; $id = $this->lastInsertIds[$boardName];
$this->sendJSONrequest('GET', '/index.php/apps/deck/boards/'.$id, []); $this->sendJSONrequest('GET', '/index.php/apps/deck/boards/'.$id, []);
} }
} }

View File

@@ -91,7 +91,9 @@ class ActivityManagerTest extends TestCase {
$managerClass = new \ReflectionClass(ActivityManager::class); $managerClass = new \ReflectionClass(ActivityManager::class);
$this->l10n->expects($this->any()) $this->l10n->expects($this->any())
->method('t') ->method('t')
->will($this->returnCallback(function ($s) { return $s; })); ->will($this->returnCallback(function ($s) {
return $s;
}));
foreach ($managerClass->getConstants() as $constant => $value) { foreach ($managerClass->getConstants() as $constant => $value) {
if (strpos($constant, 'SUBJECT') === 0) { if (strpos($constant, 'SUBJECT') === 0) {
@@ -111,7 +113,6 @@ class ActivityManagerTest extends TestCase {
} }
} }
} }
} }
public function testCreateEvent() { public function testCreateEvent() {
@@ -342,12 +343,10 @@ class ActivityManagerTest extends TestCase {
], $this->invokePrivate($this->activityManager, 'findDetailsForAttachment', [777])); ], $this->invokePrivate($this->activityManager, 'findDetailsForAttachment', [777]));
} }
public function invokePrivate(&$object, $methodName, array $parameters = array()) public function invokePrivate(&$object, $methodName, array $parameters = []) {
{
$reflection = new \ReflectionClass(get_class($object)); $reflection = new \ReflectionClass(get_class($object));
$method = $reflection->getMethod($methodName); $method = $reflection->getMethod($methodName);
$method->setAccessible(true); $method->setAccessible(true);
return $method->invokeArgs($object, $parameters); return $method->invokeArgs($object, $parameters);
} }
} }

View File

@@ -25,9 +25,7 @@ namespace OCA\Deck\Activity;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class ChangeSetTest extends TestCase { class ChangeSetTest extends TestCase {
public function setUp(): void { public function setUp(): void {
} }
@@ -54,5 +52,4 @@ class ChangeSetTest extends TestCase {
$changeSet->enableDiff(); $changeSet->enableDiff();
$this->assertTrue($changeSet->getDiff()); $this->assertTrue($changeSet->getDiff());
} }
} }

View File

@@ -23,27 +23,12 @@
namespace OCA\Deck\Activity; namespace OCA\Deck\Activity;
use OCA\Deck\Db\AclMapper;
use OCA\Deck\Db\AssignedUsers;
use OCA\Deck\Db\Attachment;
use OCA\Deck\Db\AttachmentMapper;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card; use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\Label;
use OCA\Deck\Db\Stack;
use OCA\Deck\Db\StackMapper;
use OCA\Deck\Notification\NotificationHelper; use OCA\Deck\Notification\NotificationHelper;
use OCA\Deck\Service\PermissionService;
use OCP\Activity\IEvent;
use OCP\Activity\IManager;
use OCP\Comments\CommentsEvent; use OCP\Comments\CommentsEvent;
use OCP\Comments\IComment; use OCP\Comments\IComment;
use OCP\IL10N;
use OCP\IUser;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
class CommentEventHandlerTest extends TestCase { class CommentEventHandlerTest extends TestCase {
@@ -109,12 +94,10 @@ class CommentEventHandlerTest extends TestCase {
$this->commentEventHandler->handle($commentsEvent); $this->commentEventHandler->handle($commentsEvent);
} }
public function invokePrivate(&$object, $methodName, array $parameters = array()) public function invokePrivate(&$object, $methodName, array $parameters = []) {
{
$reflection = new \ReflectionClass(get_class($object)); $reflection = new \ReflectionClass(get_class($object));
$method = $reflection->getMethod($methodName); $method = $reflection->getMethod($methodName);
$method->setAccessible(true); $method->setAccessible(true);
return $method->invokeArgs($object, $parameters); return $method->invokeArgs($object, $parameters);
} }
} }

View File

@@ -81,20 +81,20 @@ class DeckProviderTest extends TestCase {
$event->expects($this->any())->method('getObjectName')->willReturn($objectName); $event->expects($this->any())->method('getObjectName')->willReturn($objectName);
$event->expects($this->any())->method('getAuthor')->willReturn('admin'); $event->expects($this->any())->method('getAuthor')->willReturn('admin');
$event->expects($this->any())->method('getMessage')->willReturn(''); $event->expects($this->any())->method('getMessage')->willReturn('');
$event->expects($this->any())->method('setIcon')->will($this->returnCallback(function($icon) use (&$data, $event) { $event->expects($this->any())->method('setIcon')->will($this->returnCallback(function ($icon) use (&$data, $event) {
$data['icon'] = $icon; $data['icon'] = $icon;
return $event; return $event;
})); }));
$event->expects($this->any())->method('setParsedSubject')->will($this->returnCallback(function($subject) use (&$data, $event) { $event->expects($this->any())->method('setParsedSubject')->will($this->returnCallback(function ($subject) use (&$data, $event) {
$data['parsedSubject'] = $subject; $data['parsedSubject'] = $subject;
return $event; return $event;
})); }));
$event->expects($this->any())->method('setRichSubject')->will($this->returnCallback(function($subject) use (&$data, $event) { $event->expects($this->any())->method('setRichSubject')->will($this->returnCallback(function ($subject) use (&$data, $event) {
$data['richSubject'] = $subject; $data['richSubject'] = $subject;
return $event; return $event;
})); }));
$event->expects($this->any())->method('getIcon')->will( $event->expects($this->any())->method('getIcon')->will(
$this->returnCallback(function() use (&$data) { $this->returnCallback(function () use (&$data) {
return array_key_exists('icon', $data) ? $data['icon'] : 'noicon'; return array_key_exists('icon', $data) ? $data['icon'] : 'noicon';
}) })
); );
@@ -133,12 +133,12 @@ class DeckProviderTest extends TestCase {
->willReturn('test string {board}'); ->willReturn('test string {board}');
$this->urlGenerator->expects($this->any()) $this->urlGenerator->expects($this->any())
->method('imagePath') ->method('imagePath')
->will($this->returnCallback(function($a, $i) { ->will($this->returnCallback(function ($a, $i) {
return $a . '/' . $i; return $a . '/' . $i;
})); }));
$this->urlGenerator->expects($this->any()) $this->urlGenerator->expects($this->any())
->method('getAbsoluteURL') ->method('getAbsoluteURL')
->will($this->returnCallback(function($url) { ->will($this->returnCallback(function ($url) {
return $url; return $url;
})); }));
$this->provider->parse('en_US', $event); $this->provider->parse('en_US', $event);
@@ -159,7 +159,7 @@ class DeckProviderTest extends TestCase {
public function testParseObjectTypeBoard() { public function testParseObjectTypeBoard() {
$this->urlGenerator->expects($this->any()) $this->urlGenerator->expects($this->any())
->method('imagePath') ->method('imagePath')
->will($this->returnCallback(function($a, $i) { ->will($this->returnCallback(function ($a, $i) {
return $a . '/' . $i; return $a . '/' . $i;
})); }));
$this->activityManager->expects($this->once()) $this->activityManager->expects($this->once())
@@ -200,7 +200,7 @@ class DeckProviderTest extends TestCase {
public function testParseObjectTypeCard() { public function testParseObjectTypeCard() {
$this->urlGenerator->expects($this->any()) $this->urlGenerator->expects($this->any())
->method('imagePath') ->method('imagePath')
->will($this->returnCallback(function($a, $i) { ->will($this->returnCallback(function ($a, $i) {
return $a . '/' . $i; return $a . '/' . $i;
})); }));
$this->activityManager->expects($this->once()) $this->activityManager->expects($this->once())
@@ -238,13 +238,12 @@ class DeckProviderTest extends TestCase {
$this->assertEquals('test string Card', $event->getParsedSubject()); $this->assertEquals('test string Card', $event->getParsedSubject());
$this->assertEquals('test string {card}', $event->getRichSubject()); $this->assertEquals('test string {card}', $event->getRichSubject());
$this->assertEquals('', $event->getMessage()); $this->assertEquals('', $event->getMessage());
} }
public function testParseObjectTypeCardWithDiff() { public function testParseObjectTypeCardWithDiff() {
$this->urlGenerator->expects($this->any()) $this->urlGenerator->expects($this->any())
->method('imagePath') ->method('imagePath')
->will($this->returnCallback(function($a, $i) { ->will($this->returnCallback(function ($a, $i) {
return $a . '/' . $i; return $a . '/' . $i;
})); }));
$this->activityManager->expects($this->once()) $this->activityManager->expects($this->once())
@@ -496,8 +495,7 @@ class DeckProviderTest extends TestCase {
$this->assertEquals($expected, $actual); $this->assertEquals($expected, $actual);
} }
public function invokePrivate(&$object, $methodName, array $parameters = array()) public function invokePrivate(&$object, $methodName, array $parameters = []) {
{
$reflection = new \ReflectionClass(get_class($object)); $reflection = new \ReflectionClass(get_class($object));
$method = $reflection->getMethod($methodName); $method = $reflection->getMethod($methodName);
$method->setAccessible(true); $method->setAccessible(true);

View File

@@ -77,5 +77,4 @@ class FilterTest extends TestCase {
public function testAllowedApps() { public function testAllowedApps() {
$this->assertEquals(['deck'], $this->filter->allowedApps()); $this->assertEquals(['deck'], $this->filter->allowedApps());
} }
} }

View File

@@ -35,7 +35,9 @@ class SettingTest extends TestCase {
public function setUp(): void { public function setUp(): void {
$this->l10n = $this->createMock(IL10N::class); $this->l10n = $this->createMock(IL10N::class);
$this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($s) { return $s; })); $this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($s) {
return $s;
}));
$this->setting = new Setting($this->l10n); $this->setting = new Setting($this->l10n);
} }
@@ -66,5 +68,4 @@ class SettingTest extends TestCase {
public function testIsDefaultEnabledMail() { public function testIsDefaultEnabledMail() {
$this->assertFalse($this->setting->isDefaultEnabledMail()); $this->assertFalse($this->setting->isDefaultEnabledMail());
} }
} }

View File

@@ -24,26 +24,19 @@
namespace OCA\Deck\Command; namespace OCA\Deck\Command;
use OCA\Deck\Db\AssignedUsersMapper; use OCA\Deck\Db\AssignedUsersMapper;
use OCA\Deck\Db\Attachment;
use OCA\Deck\Db\AttachmentMapper;
use OCA\Deck\Db\Board; use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card; use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\Stack; use OCA\Deck\Db\Stack;
use OCA\Deck\Db\StackMapper; use OCA\Deck\Db\StackMapper;
use OCA\Deck\InvalidAttachmentType;
use OCA\Deck\Service\AttachmentService;
use OCA\Deck\Service\BoardService; use OCA\Deck\Service\BoardService;
use OCA\Deck\Service\IAttachmentService;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager; use OCP\IUserManager;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
class UserExportTest extends \Test\TestCase { class UserExportTest extends \Test\TestCase {
protected $boardMapper; protected $boardMapper;
protected $boardService; protected $boardService;
protected $stackMapper; protected $stackMapper;

View File

@@ -23,8 +23,6 @@
namespace OCA\Deck\Cron; namespace OCA\Deck\Cron;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card; use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\Notification\NotificationHelper; use OCA\Deck\Notification\NotificationHelper;

View File

@@ -31,7 +31,6 @@ use Test\AppFramework\Db\MapperTestUtility;
* @group DB * @group DB
*/ */
class AclMapperTest extends MapperTestUtility { class AclMapperTest extends MapperTestUtility {
private $dbConnection; private $dbConnection;
private $aclMapper; private $aclMapper;
private $boardMapper; private $boardMapper;
@@ -122,5 +121,4 @@ class AclMapperTest extends MapperTestUtility {
$this->boardMapper->delete($board); $this->boardMapper->delete($board);
} }
} }
} }

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
class AclTest extends \Test\TestCase { class AclTest extends \Test\TestCase {
private function createAclUser() { private function createAclUser() {
$acl = new Acl(); $acl = new Acl();
$acl->setId(1); $acl->setId(1);
@@ -104,6 +103,5 @@ class AclTest extends \Test\TestCase {
$this->assertEquals(false, $acl->getPermission(Acl::PERMISSION_MANAGE)); $this->assertEquals(false, $acl->getPermission(Acl::PERMISSION_MANAGE));
$this->assertEquals(false, $acl->getPermission(Acl::PERMISSION_SHARE)); $this->assertEquals(false, $acl->getPermission(Acl::PERMISSION_SHARE));
$this->assertEquals(false, $acl->getPermission(5)); $this->assertEquals(false, $acl->getPermission(5));
} }
} }

View File

@@ -25,7 +25,6 @@ namespace OCA\Deck\Db;
use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\DoesNotExistException;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IUserManager; use OCP\IUserManager;
use Test\AppFramework\Db\MapperTestUtility; use Test\AppFramework\Db\MapperTestUtility;
@@ -144,5 +143,4 @@ class AttachmentMapperTest extends MapperTestUtility {
$this->attachmentMapper->delete($attachment); $this->attachmentMapper->delete($attachment);
} }
} }
} }

View File

@@ -123,7 +123,7 @@ class BoardMapperTest extends MapperTestUtility {
]; ];
foreach ($expected as $e) { foreach ($expected as $e) {
foreach ($actual as $a) { foreach ($actual as $a) {
if($e->getId() === $a->getId()) { if ($e->getId() === $a->getId()) {
$this->assertEquals($e->getTitle(), $a->getTitle()); $this->assertEquals($e->getTitle(), $a->getTitle());
} }
} }
@@ -171,5 +171,4 @@ class BoardMapperTest extends MapperTestUtility {
$this->boardMapper->delete($board); $this->boardMapper->delete($board);
} }
} }
} }

View File

@@ -23,12 +23,12 @@ class BoardTest extends TestCase {
'title' => "My Board", 'title' => "My Board",
'owner' => "admin", 'owner' => "admin",
'color' => "000000", 'color' => "000000",
'labels' => array(), 'labels' => [],
'permissions' => [], 'permissions' => [],
'stacks' => [], 'stacks' => [],
'deletedAt' => 0, 'deletedAt' => 0,
'lastModified' => 0, 'lastModified' => 0,
'acl' => array(), 'acl' => [],
'archived' => false, 'archived' => false,
'users' => ['user1', 'user2'], 'users' => ['user1', 'user2'],
], $board->jsonSerialize()); ], $board->jsonSerialize());
@@ -36,18 +36,18 @@ class BoardTest extends TestCase {
public function testSetLabels() { public function testSetLabels() {
$board = $this->createBoard(); $board = $this->createBoard();
$board->setLabels(array("foo", "bar")); $board->setLabels(["foo", "bar"]);
$this->assertEquals([ $this->assertEquals([
'id' => 1, 'id' => 1,
'title' => "My Board", 'title' => "My Board",
'owner' => "admin", 'owner' => "admin",
'color' => "000000", 'color' => "000000",
'labels' => array("foo", "bar"), 'labels' => ["foo", "bar"],
'permissions' => [], 'permissions' => [],
'stacks' => [], 'stacks' => [],
'deletedAt' => 0, 'deletedAt' => 0,
'lastModified' => 0, 'lastModified' => 0,
'acl' => array(), 'acl' => [],
'archived' => false, 'archived' => false,
'users' => [], 'users' => [],
], $board->jsonSerialize()); ], $board->jsonSerialize());
@@ -56,7 +56,7 @@ class BoardTest extends TestCase {
$acl = new Acl(); $acl = new Acl();
$acl->setId(1); $acl->setId(1);
$board = $this->createBoard(); $board = $this->createBoard();
$board->setAcl(array($acl)); $board->setAcl([$acl]);
$result = $board->getAcl()[0]; $result = $board->getAcl()[0];
$this->assertEquals($acl, $result); $this->assertEquals($acl, $result);
} }
@@ -68,12 +68,12 @@ class BoardTest extends TestCase {
'title' => "My Board", 'title' => "My Board",
'owner' => "admin", 'owner' => "admin",
'color' => "000000", 'color' => "000000",
'labels' => array(), 'labels' => [],
'permissions' => [], 'permissions' => [],
'stacks' => [], 'stacks' => [],
'deletedAt' => 0, 'deletedAt' => 0,
'lastModified' => 0, 'lastModified' => 0,
'acl' => array(), 'acl' => [],
'archived' => false, 'archived' => false,
'shared' => 1, 'shared' => 1,
'users' => [], 'users' => [],

View File

@@ -88,7 +88,7 @@ class CardTest extends TestCase {
} }
public function testJsonSerializeLabels() { public function testJsonSerializeLabels() {
$card = $this->createCard(); $card = $this->createCard();
$card->setLabels(array()); $card->setLabels([]);
$this->assertEquals([ $this->assertEquals([
'id' => 1, 'id' => 1,
'title' => "My Card", 'title' => "My Card",
@@ -99,7 +99,7 @@ class CardTest extends TestCase {
'owner' => 'admin', 'owner' => 'admin',
'order' => 12, 'order' => 12,
'stackId' => 1, 'stackId' => 1,
'labels' => array(), 'labels' => [],
'duedate' => null, 'duedate' => null,
'overdue' => 0, 'overdue' => 0,
'archived' => false, 'archived' => false,
@@ -123,7 +123,7 @@ class CardTest extends TestCase {
public function testJsonSerializeAsignedUsers() { public function testJsonSerializeAsignedUsers() {
$card = $this->createCard(); $card = $this->createCard();
$card->setAssignedUsers([ 'user1' ]); $card->setAssignedUsers([ 'user1' ]);
$card->setLabels(array()); $card->setLabels([]);
$this->assertEquals([ $this->assertEquals([
'id' => 1, 'id' => 1,
'title' => "My Card", 'title' => "My Card",
@@ -134,7 +134,7 @@ class CardTest extends TestCase {
'owner' => 'admin', 'owner' => 'admin',
'order' => 12, 'order' => 12,
'stackId' => 1, 'stackId' => 1,
'labels' => array(), 'labels' => [],
'duedate' => null, 'duedate' => null,
'overdue' => 0, 'overdue' => 0,
'archived' => false, 'archived' => false,
@@ -146,5 +146,4 @@ class CardTest extends TestCase {
'lastEditor' => null, 'lastEditor' => null,
], $card->jsonSerialize()); ], $card->jsonSerialize());
} }
} }

View File

@@ -26,7 +26,6 @@ namespace OCA\Deck\Db;
use OCP\IGroup; use OCP\IGroup;
class GroupTest extends \Test\TestCase { class GroupTest extends \Test\TestCase {
public function testGroupObjectSerialize() { public function testGroupObjectSerialize() {
/** @var IGroup $group */ /** @var IGroup $group */
$group = $this->createMock(IGroup::class); $group = $this->createMock(IGroup::class);

View File

@@ -44,7 +44,6 @@ class LabelTest extends TestCase {
'lastModified' => null, 'lastModified' => null,
'color' => '000000' 'color' => '000000'
], $label->jsonSerialize()); ], $label->jsonSerialize());
} }
public function testJsonSerializeCard() { public function testJsonSerializeCard() {
$label = $this->createLabel(); $label = $this->createLabel();
@@ -57,8 +56,5 @@ class LabelTest extends TestCase {
'lastModified' => null, 'lastModified' => null,
'color' => '000000' 'color' => '000000'
], $label->jsonSerialize()); ], $label->jsonSerialize());
} }
} }

View File

@@ -24,7 +24,6 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
class RelationalEntityTest extends \Test\TestCase { class RelationalEntityTest extends \Test\TestCase {
public function testRelation() { public function testRelation() {
$entity = new RelationalEntity(); $entity = new RelationalEntity();
$entity->foo = null; $entity->foo = null;
@@ -48,5 +47,4 @@ class RelationalEntityTest extends \Test\TestCase {
]; ];
$this->assertEquals($json, $entity->jsonSerialize()); $this->assertEquals($json, $entity->jsonSerialize());
} }
} }

Some files were not shown because too many files have changed in this diff Show More