Completed
Push — master ( deb9d0...9a5284 )
by Julius
9s
created
lib/Db/AclMapper.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -28,25 +28,25 @@
 block discarded – undo
28 28
 
29 29
 class AclMapper extends DeckMapper implements IPermissionMapper {
30 30
 
31
-    public function __construct(IDBConnection $db) {
32
-        parent::__construct($db, 'deck_board_acl', '\OCA\Deck\Db\Acl');
33
-    }
34
-
35
-    public function findAll($boardId, $limit = null, $offset = null) {
36
-        $sql = 'SELECT id, board_id, type, participant, permission_edit, permission_share, permission_manage FROM `*PREFIX*deck_board_acl` WHERE `board_id` = ? ';
37
-        return $this->findEntities($sql, [$boardId], $limit, $offset);
38
-    }
39
-
40
-    public function isOwner($userId, $aclId) {
41
-        $sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_board_acl` WHERE id = ?)';
42
-        $stmt = $this->execute($sql, [$aclId]);
43
-        $row = $stmt->fetch();
44
-        return ($row['owner'] === $userId);
45
-    }
46
-
47
-    public function findBoardId($aclId) {
48
-        $entity = $this->find($aclId);
49
-        return $entity->getBoardId();
50
-    }
31
+	public function __construct(IDBConnection $db) {
32
+		parent::__construct($db, 'deck_board_acl', '\OCA\Deck\Db\Acl');
33
+	}
34
+
35
+	public function findAll($boardId, $limit = null, $offset = null) {
36
+		$sql = 'SELECT id, board_id, type, participant, permission_edit, permission_share, permission_manage FROM `*PREFIX*deck_board_acl` WHERE `board_id` = ? ';
37
+		return $this->findEntities($sql, [$boardId], $limit, $offset);
38
+	}
39
+
40
+	public function isOwner($userId, $aclId) {
41
+		$sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_board_acl` WHERE id = ?)';
42
+		$stmt = $this->execute($sql, [$aclId]);
43
+		$row = $stmt->fetch();
44
+		return ($row['owner'] === $userId);
45
+	}
46
+
47
+	public function findBoardId($aclId) {
48
+		$entity = $this->find($aclId);
49
+		return $entity->getBoardId();
50
+	}
51 51
 
52 52
 }
Please login to merge, or discard this patch.
lib/Db/StackMapper.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -29,46 +29,46 @@
 block discarded – undo
29 29
 
30 30
 class StackMapper extends DeckMapper implements IPermissionMapper {
31 31
 
32
-    private $cardMapper;
32
+	private $cardMapper;
33 33
 
34
-    public function __construct(IDBConnection $db, CardMapper $cardMapper) {
35
-        parent::__construct($db, 'deck_stacks', '\OCA\Deck\Db\Stack');
36
-        $this->cardMapper = $cardMapper;
37
-    }
34
+	public function __construct(IDBConnection $db, CardMapper $cardMapper) {
35
+		parent::__construct($db, 'deck_stacks', '\OCA\Deck\Db\Stack');
36
+		$this->cardMapper = $cardMapper;
37
+	}
38 38
 
39 39
 
40 40
 	/**
41 41
 	 * @param $id
42 42
 	 * @return Entity if not found
43 43
 	 */
44
-    public function find($id) {
45
-        $sql = 'SELECT * FROM `*PREFIX*deck_stacks` ' .
46
-            'WHERE `id` = ?';
47
-        return $this->findEntity($sql, [$id]);
48
-    }
44
+	public function find($id) {
45
+		$sql = 'SELECT * FROM `*PREFIX*deck_stacks` ' .
46
+			'WHERE `id` = ?';
47
+		return $this->findEntity($sql, [$id]);
48
+	}
49 49
 
50 50
 
51
-    public function findAll($boardId, $limit = null, $offset = null) {
52
-        $sql = 'SELECT * FROM `*PREFIX*deck_stacks` WHERE `board_id` = ?  ORDER BY `order`';
53
-        return $this->findEntities($sql, [$boardId], $limit, $offset);
54
-    }
51
+	public function findAll($boardId, $limit = null, $offset = null) {
52
+		$sql = 'SELECT * FROM `*PREFIX*deck_stacks` WHERE `board_id` = ?  ORDER BY `order`';
53
+		return $this->findEntities($sql, [$boardId], $limit, $offset);
54
+	}
55 55
     
56 56
 
57
-    public function delete(Entity $entity) {
58
-        // delete cards on stack
57
+	public function delete(Entity $entity) {
58
+		// delete cards on stack
59 59
 		$this->cardMapper->deleteByStack($entity->getId());
60
-        return parent::delete($entity);
61
-    }
60
+		return parent::delete($entity);
61
+	}
62 62
 
63
-    public function isOwner($userId, $stackId) {
64
-        $sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_stacks` WHERE id = ?)';
65
-        $stmt = $this->execute($sql, [$stackId]);
66
-        $row = $stmt->fetch();
67
-        return ($row['owner'] === $userId);
68
-    }
63
+	public function isOwner($userId, $stackId) {
64
+		$sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_stacks` WHERE id = ?)';
65
+		$stmt = $this->execute($sql, [$stackId]);
66
+		$row = $stmt->fetch();
67
+		return ($row['owner'] === $userId);
68
+	}
69 69
 
70
-    public function findBoardId($stackId) {
71
-        $entity = $this->find($stackId);
72
-        return $entity->getBoardId();
73
-    }
70
+	public function findBoardId($stackId) {
71
+		$entity = $this->find($stackId);
72
+		return $entity->getBoardId();
73
+	}
74 74
 }
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Db/Card.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -28,41 +28,41 @@
 block discarded – undo
28 28
 
29 29
 class Card extends Entity implements JsonSerializable {
30 30
 
31
-    public $id;
32
-    protected $title;
33
-    protected $description;
34
-    protected $stackId;
35
-    protected $type;
36
-    protected $lastModified;
37
-    protected $createdAt;
38
-    protected $labels;
39
-    protected $owner;
40
-    protected $order;
41
-    protected $archived = false;
31
+	public $id;
32
+	protected $title;
33
+	protected $description;
34
+	protected $stackId;
35
+	protected $type;
36
+	protected $lastModified;
37
+	protected $createdAt;
38
+	protected $labels;
39
+	protected $owner;
40
+	protected $order;
41
+	protected $archived = false;
42 42
 
43
-    public function __construct() {
44
-        $this->addType('id', 'integer');
45
-        $this->addType('stackId', 'integer');
46
-        $this->addType('order', 'integer');
47
-        $this->addType('lastModified', 'integer');
48
-        $this->addType('createdAt', 'integer');
49
-        $this->addType('archived', 'boolean');
50
-        $this->addRelation('labels');
51
-    }
43
+	public function __construct() {
44
+		$this->addType('id', 'integer');
45
+		$this->addType('stackId', 'integer');
46
+		$this->addType('order', 'integer');
47
+		$this->addType('lastModified', 'integer');
48
+		$this->addType('createdAt', 'integer');
49
+		$this->addType('archived', 'boolean');
50
+		$this->addRelation('labels');
51
+	}
52 52
 
53
-    public function jsonSerialize() {
54
-        return [
55
-            'id' => $this->id,
56
-            'title' => $this->title,
57
-            'description' => $this->description,
58
-            'type' => $this->type,
59
-            'lastModified' => $this->lastModified,
60
-            'createdAt' => $this->createdAt,
61
-            'owner' => $this->owner,
62
-            'order' => $this->order,
63
-            'stackId' => $this->stackId,
64
-            'labels' => $this->labels,
65
-            'archived' => $this->archived,
66
-        ];
67
-    }
53
+	public function jsonSerialize() {
54
+		return [
55
+			'id' => $this->id,
56
+			'title' => $this->title,
57
+			'description' => $this->description,
58
+			'type' => $this->type,
59
+			'lastModified' => $this->lastModified,
60
+			'createdAt' => $this->createdAt,
61
+			'owner' => $this->owner,
62
+			'order' => $this->order,
63
+			'stackId' => $this->stackId,
64
+			'labels' => $this->labels,
65
+			'archived' => $this->archived,
66
+		];
67
+	}
68 68
 }
Please login to merge, or discard this patch.
lib/Db/Board.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -27,49 +27,49 @@
 block discarded – undo
27 27
 
28 28
 class Board extends Entity implements JsonSerializable {
29 29
 
30
-    public $id;
31
-    protected $title;
32
-    protected $owner;
33
-    protected $color;
34
-    protected $archived = false;
35
-    protected $labels;
36
-    protected $acl;
37
-    protected $shared;
30
+	public $id;
31
+	protected $title;
32
+	protected $owner;
33
+	protected $color;
34
+	protected $archived = false;
35
+	protected $labels;
36
+	protected $acl;
37
+	protected $shared;
38 38
 
39
-    public function __construct() {
40
-        $this->addType('id', 'integer');
41
-        $this->addType('shared', 'integer');
42
-        $this->addType('archived', 'boolean');
43
-        $this->addRelation('labels');
44
-        $this->addRelation('acl');
45
-        $this->addRelation('shared');
46
-        $this->shared = -1;
47
-    }
39
+	public function __construct() {
40
+		$this->addType('id', 'integer');
41
+		$this->addType('shared', 'integer');
42
+		$this->addType('archived', 'boolean');
43
+		$this->addRelation('labels');
44
+		$this->addRelation('acl');
45
+		$this->addRelation('shared');
46
+		$this->shared = -1;
47
+	}
48 48
 
49
-    public function jsonSerialize() {
50
-        $result = [
51
-            'id' => $this->id,
52
-            'title' => $this->title,
53
-            'owner' => $this->owner,
54
-            'color' => $this->color,
55
-            'labels' => $this->labels,
56
-            'acl' => $this->acl,
57
-        ];
58
-        if ($this->shared !== -1) {
59
-            $result['shared'] = $this->shared;
60
-        }
61
-        return $result;
62
-    }
49
+	public function jsonSerialize() {
50
+		$result = [
51
+			'id' => $this->id,
52
+			'title' => $this->title,
53
+			'owner' => $this->owner,
54
+			'color' => $this->color,
55
+			'labels' => $this->labels,
56
+			'acl' => $this->acl,
57
+		];
58
+		if ($this->shared !== -1) {
59
+			$result['shared'] = $this->shared;
60
+		}
61
+		return $result;
62
+	}
63 63
 
64
-    public function setLabels($labels) {
65
-        foreach ($labels as $l) {
66
-            $this->labels[] = $l;
67
-        }
68
-    }
64
+	public function setLabels($labels) {
65
+		foreach ($labels as $l) {
66
+			$this->labels[] = $l;
67
+		}
68
+	}
69 69
 
70
-    public function setAcl($acl) {
71
-        foreach ($acl as $a) {
72
-            $this->acl[$a->id] = $a;
73
-        }
74
-    }
70
+	public function setAcl($acl) {
71
+		foreach ($acl as $a) {
72
+			$this->acl[$a->id] = $a;
73
+		}
74
+	}
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Controller/LabelController.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 
31 31
 class LabelController extends Controller {
32 32
 
33
-    private $labelService;
33
+	private $labelService;
34 34
 
35
-    public function __construct($appName, IRequest $request, LabelService $labelService) {
36
-        parent::__construct($appName, $request);
37
-        $this->labelService = $labelService;
38
-    }
35
+	public function __construct($appName, IRequest $request, LabelService $labelService) {
36
+		parent::__construct($appName, $request);
37
+		$this->labelService = $labelService;
38
+	}
39 39
 
40 40
 	/**
41 41
 	 * @NoAdminRequired
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	 * @param $boardId
45 45
 	 * @return \OCP\AppFramework\Db\Entity
46 46
 	 */
47
-    public function create($title, $color, $boardId) {
48
-        return $this->labelService->create($title, $color, $boardId);
49
-    }
47
+	public function create($title, $color, $boardId) {
48
+		return $this->labelService->create($title, $color, $boardId);
49
+	}
50 50
 
51 51
 	/**
52 52
 	 * @NoAdminRequired
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 	 * @param $color
56 56
 	 * @return \OCP\AppFramework\Db\Entity
57 57
 	 */
58
-    public function update($id, $title, $color) {
59
-        return $this->labelService->update($id, $title, $color);
60
-    }
58
+	public function update($id, $title, $color) {
59
+		return $this->labelService->update($id, $title, $color);
60
+	}
61 61
 
62 62
 	/**
63 63
 	 * @NoAdminRequired
64 64
 	 * @param $labelId
65 65
 	 * @return \OCP\AppFramework\Db\Entity
66 66
 	 */
67
-    public function delete($labelId) {
68
-        return $this->labelService->delete($labelId);
69
-    }
67
+	public function delete($labelId) {
68
+		return $this->labelService->delete($labelId);
69
+	}
70 70
 
71 71
 }
Please login to merge, or discard this patch.
lib/Controller/StackController.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -31,31 +31,31 @@  discard block
 block discarded – undo
31 31
 
32 32
 
33 33
 class StackController extends Controller {
34
-    private $userId;
35
-    private $stackService;
36
-    public function __construct($appName, IRequest $request, StackService $cardService, $userId) {
37
-        parent::__construct($appName, $request);
38
-        $this->userId = $userId;
39
-        $this->stackService = $cardService;
40
-    }
34
+	private $userId;
35
+	private $stackService;
36
+	public function __construct($appName, IRequest $request, StackService $cardService, $userId) {
37
+		parent::__construct($appName, $request);
38
+		$this->userId = $userId;
39
+		$this->stackService = $cardService;
40
+	}
41 41
 
42 42
 	/**
43 43
 	 * @NoAdminRequired
44 44
 	 * @param $boardId
45 45
 	 * @return array
46 46
 	 */
47
-    public function index($boardId) {
48
-            return $this->stackService->findAll($boardId);
49
-    }
47
+	public function index($boardId) {
48
+			return $this->stackService->findAll($boardId);
49
+	}
50 50
 
51 51
 	/**
52 52
 	 * @NoAdminRequired
53 53
 	 * @param $boardId
54 54
 	 * @return array
55 55
 	 */
56
-    public function archived($boardId) {
57
-            return $this->stackService->findAllArchived($boardId);
58
-    }
56
+	public function archived($boardId) {
57
+			return $this->stackService->findAllArchived($boardId);
58
+	}
59 59
 
60 60
 	/**
61 61
 	 * @NoAdminRequired
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 	 * @param int $order
65 65
 	 * @return \OCP\AppFramework\Db\Entity
66 66
 	 */
67
-    public function create($title, $boardId, $order = 999) {
68
-        return $this->stackService->create($title, $boardId, $order);
69
-    }
67
+	public function create($title, $boardId, $order = 999) {
68
+		return $this->stackService->create($title, $boardId, $order);
69
+	}
70 70
 
71 71
 	/**
72 72
 	 * @NoAdminRequired
@@ -76,16 +76,16 @@  discard block
 block discarded – undo
76 76
 	 * @param $order
77 77
 	 * @return \OCP\AppFramework\Db\Entity
78 78
 	 */
79
-    public function update($id, $title, $boardId, $order) {
80
-        return $this->stackService->update($id, $title, $boardId, $order);
81
-    }
79
+	public function update($id, $title, $boardId, $order) {
80
+		return $this->stackService->update($id, $title, $boardId, $order);
81
+	}
82 82
 
83 83
 	/**
84 84
 	 * @NoAdminRequired
85 85
 	 * @param $stackId
86 86
 	 * @return \OCP\AppFramework\Db\Entity
87 87
 	 */
88
-    public function delete($stackId) {
89
-        return $this->stackService->delete($stackId);
90
-    }
88
+	public function delete($stackId) {
89
+		return $this->stackService->delete($stackId);
90
+	}
91 91
 }
Please login to merge, or discard this patch.
lib/Controller/CardController.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -29,23 +29,23 @@  discard block
 block discarded – undo
29 29
 
30 30
 class CardController extends Controller {
31 31
 
32
-    private $userId;
33
-    private $cardService;
32
+	private $userId;
33
+	private $cardService;
34 34
 
35
-    public function __construct($appName, IRequest $request, CardService $cardService, $userId) {
36
-        parent::__construct($appName, $request);
37
-        $this->userId = $userId;
38
-        $this->cardService = $cardService;
39
-    }
35
+	public function __construct($appName, IRequest $request, CardService $cardService, $userId) {
36
+		parent::__construct($appName, $request);
37
+		$this->userId = $userId;
38
+		$this->cardService = $cardService;
39
+	}
40 40
 
41 41
 	/**
42 42
 	 * @NoAdminRequired
43 43
 	 * @param $cardId
44 44
 	 * @return \OCP\AppFramework\Db\Entity
45 45
 	 */
46
-    public function read($cardId) {
47
-        return $this->cardService->find($cardId);
48
-    }
46
+	public function read($cardId) {
47
+		return $this->cardService->find($cardId);
48
+	}
49 49
 
50 50
 	/**
51 51
 	 * @NoAdminRequired
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 * @param $order
55 55
 	 * @return array
56 56
 	 */
57
-    public function reorder($cardId, $stackId, $order) {
58
-        return $this->cardService->reorder($cardId, $stackId, $order);
59
-    }
57
+	public function reorder($cardId, $stackId, $order) {
58
+		return $this->cardService->reorder($cardId, $stackId, $order);
59
+	}
60 60
 
61 61
 	/**
62 62
 	 * @NoAdminRequired
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 	 * @param $title
65 65
 	 * @return \OCP\AppFramework\Db\Entity
66 66
 	 */
67
-    public function rename($cardId, $title) {
68
-        return $this->cardService->rename($cardId, $title);
69
-    }
67
+	public function rename($cardId, $title) {
68
+		return $this->cardService->rename($cardId, $title);
69
+	}
70 70
 
71 71
 	/**
72 72
 	 * @NoAdminRequired
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	 * @param int $order
77 77
 	 * @return \OCP\AppFramework\Db\Entity
78 78
 	 */
79
-    public function create($title, $stackId, $type, $order = 999) {
80
-        return $this->cardService->create($title, $stackId, $type, $order, $this->userId);
81
-    }
79
+	public function create($title, $stackId, $type, $order = 999) {
80
+		return $this->cardService->create($title, $stackId, $type, $order, $this->userId);
81
+	}
82 82
 
83 83
 	/**
84 84
 	 * @NoAdminRequired
@@ -90,53 +90,53 @@  discard block
 block discarded – undo
90 90
 	 * @param $description
91 91
 	 * @return \OCP\AppFramework\Db\Entity
92 92
 	 */
93
-    public function update($id, $title, $stackId, $type, $order, $description) {
94
-            return $this->cardService->update($id, $title, $stackId, $type, $order, $description, $this->userId);
95
-    }
93
+	public function update($id, $title, $stackId, $type, $order, $description) {
94
+			return $this->cardService->update($id, $title, $stackId, $type, $order, $description, $this->userId);
95
+	}
96 96
 
97 97
 	/**
98 98
 	 * @NoAdminRequired
99 99
 	 * @param $cardId
100 100
 	 * @return \OCP\AppFramework\Db\Entity
101 101
 	 */
102
-    public function delete($cardId) {
103
-        return $this->cardService->delete($cardId);
104
-    }
102
+	public function delete($cardId) {
103
+		return $this->cardService->delete($cardId);
104
+	}
105 105
 
106 106
 	/**
107 107
 	 * @NoAdminRequired
108 108
 	 * @param $cardId
109 109
 	 * @return \OCP\AppFramework\Db\Entity
110 110
 	 */
111
-    public function archive($cardId) {
112
-        return $this->cardService->archive($cardId);
113
-    }
111
+	public function archive($cardId) {
112
+		return $this->cardService->archive($cardId);
113
+	}
114 114
 
115 115
 	/**
116 116
 	 * @NoAdminRequired
117 117
 	 * @param $cardId
118 118
 	 * @return \OCP\AppFramework\Db\Entity
119 119
 	 */
120
-    public function unarchive($cardId) {
121
-        return $this->cardService->unarchive($cardId);
122
-    }
120
+	public function unarchive($cardId) {
121
+		return $this->cardService->unarchive($cardId);
122
+	}
123 123
 
124 124
 	/**
125 125
 	 * @NoAdminRequired
126 126
 	 * @param $cardId
127 127
 	 * @param $labelId
128 128
 	 */
129
-    public function assignLabel($cardId, $labelId) {
130
-        $this->cardService->assignLabel($cardId, $labelId);
131
-    }
129
+	public function assignLabel($cardId, $labelId) {
130
+		$this->cardService->assignLabel($cardId, $labelId);
131
+	}
132 132
 
133 133
 	/**
134 134
 	 * @NoAdminRequired
135 135
 	 * @param $cardId
136 136
 	 * @param $labelId
137 137
 	 */
138
-    public function removeLabel($cardId, $labelId) {
139
-        $this->cardService->removeLabel($cardId, $labelId);
140
-    }
138
+	public function removeLabel($cardId, $labelId) {
139
+		$this->cardService->removeLabel($cardId, $labelId);
140
+	}
141 141
 
142 142
 }
Please login to merge, or discard this patch.