Completed
Pull Request — master (#58)
by Julius
02:34
created
lib/Db/Group.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,6 @@
 block discarded – undo
24 24
 namespace OCA\Deck\Db;
25 25
 
26 26
 use OCP\IGroup;
27
-use OCP\IUser;
28 27
 
29 28
 class Group extends RelationalObject {
30 29
 
Please login to merge, or discard this patch.
lib/Db/RelationalEntity.php 2 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -47,6 +47,9 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 	}
49 49
 
50
+	/**
51
+	 * @param string $property
52
+	 */
50 53
 	public function addResolvable($property) {
51 54
 		$this->_resolvedProperties[$property] = null;
52 55
 	}
@@ -63,6 +66,10 @@  discard block
 block discarded – undo
63 66
 		}
64 67
 	}
65 68
 
69
+	/**
70
+	 * @param string $property
71
+	 * @param \Closure $resolver
72
+	 */
66 73
 	public function resolveRelation($property, $resolver) {
67 74
 		if($property !== null && $this->$property !== null) {
68 75
 			$result = $resolver($this->$property);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -64,32 +64,32 @@
 block discarded – undo
64 64
 	}
65 65
 
66 66
 	public function resolveRelation($property, $resolver) {
67
-		if($property !== null && $this->$property !== null) {
67
+		if ($property !== null && $this->$property !== null) {
68 68
 			$result = $resolver($this->$property);
69 69
 		} else {
70 70
 			$result = null;
71 71
 		}
72 72
 
73
-		if($result instanceof RelationalObject || $result === null) {
73
+		if ($result instanceof RelationalObject || $result === null) {
74 74
 			$this->_resolvedProperties[$property] = $result;
75 75
 		} else {
76 76
 			throw new \Exception('resolver must return an instance of RelationalObject');
77 77
 		}
78 78
 	}
79 79
 
80
-	public function __call($methodName, $args){
81
-		$attr = lcfirst( substr($methodName, 7) );
82
-		if(strpos($methodName, 'resolve') === 0 && array_key_exists($attr, $this->_resolvedProperties)) {
83
-			if($this->_resolvedProperties[$attr] !== null) {
80
+	public function __call($methodName, $args) {
81
+		$attr = lcfirst(substr($methodName, 7));
82
+		if (strpos($methodName, 'resolve') === 0 && array_key_exists($attr, $this->_resolvedProperties)) {
83
+			if ($this->_resolvedProperties[$attr] !== null) {
84 84
 				return $this->_resolvedProperties[$attr];
85 85
 			} else {
86 86
 				return $this->getter($attr, $args);
87 87
 			}
88 88
 		}
89 89
 
90
-		$attr = lcfirst( substr($methodName, 3) );
91
-		if(strpos($methodName, 'set') === 0 && array_key_exists($attr, $this->_resolvedProperties)) {
92
-			if(!is_scalar($args[0])) {
90
+		$attr = lcfirst(substr($methodName, 3));
91
+		if (strpos($methodName, 'set') === 0 && array_key_exists($attr, $this->_resolvedProperties)) {
92
+			if (!is_scalar($args[0])) {
93 93
 				$args[0] = $args[0]['primaryKey'];
94 94
 				parent::setter($attr, $args);
95 95
 			}
Please login to merge, or discard this patch.
lib/Db/User.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,6 @@
 block discarded – undo
23 23
 
24 24
 namespace OCA\Deck\Db;
25 25
 
26
-use OCP\IGroup;
27 26
 use OCP\IUser;
28 27
 
29 28
 class User extends RelationalObject {
Please login to merge, or discard this patch.
lib/Service/BoardService.php 2 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -27,12 +27,9 @@
 block discarded – undo
27 27
 use OCA\Deck\Db\AclMapper;
28 28
 use OCA\Deck\Db\Group;
29 29
 use OCA\Deck\Db\Label;
30
-
31
-
32 30
 use OCA\Deck\Db\User;
33 31
 use OCP\IGroupManager;
34 32
 use OCP\IL10N;
35
-
36 33
 use OCA\Deck\Db\Board;
37 34
 use OCA\Deck\Db\BoardMapper;
38 35
 use OCA\Deck\Db\LabelMapper;
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 		$groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups']);
63 63
 		$complete = array_merge($userBoards, $groupBoards);
64 64
 		$result = [];
65
-		foreach($complete as &$item) {
66
-			if(!array_key_exists($item->getId(), $result)) {
65
+		foreach ($complete as &$item) {
66
+			if (!array_key_exists($item->getId(), $result)) {
67 67
 				$item = $this->mapOwner($item);
68
-				if($item->getAcl() !== null) {
68
+				if ($item->getAcl() !== null) {
69 69
 					foreach ($item->getAcl() as &$acl) {
70 70
 						$acl = $this->mapAcl($acl);
71 71
 					}
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
 		$board = $this->boardMapper->find($boardId, true, true);
82 82
 		$board = $this->mapOwner($board);
83 83
 		foreach ($board->getAcl() as &$acl) {
84
-			if($acl !== null) {
84
+			if ($acl !== null) {
85 85
 				$this->mapAcl($acl);
86 86
 			}
87 87
 		}
88 88
 		return $board;
89 89
 	}
90 90
 
91
-	private function mapAcl(Acl &$acl) {
91
+	private function mapAcl(Acl & $acl) {
92 92
 		$userManager = $this->userManager;
93 93
 		$groupManager = $this->groupManager;
94 94
 		$acl->resolveRelation('participant', function($value) use (&$acl, &$userManager, &$groupManager) {
95
-			if($acl->getType() === Acl::PERMISSION_TYPE_USER) {
95
+			if ($acl->getType() === Acl::PERMISSION_TYPE_USER) {
96 96
 				return new User($userManager->get($acl->getParticipant($value)));
97 97
 			}
98
-			if($acl->getType() === Acl::PERMISSION_TYPE_GROUP) {
98
+			if ($acl->getType() === Acl::PERMISSION_TYPE_GROUP) {
99 99
 				return new Group($groupManager->get($acl->getParticipant($value)));
100 100
 			}
101 101
 		});
Please login to merge, or discard this patch.
lib/Controller/ShareController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 	 * @return array
56 56
 	 */
57 57
 	public function searchUser($search) {
58
-		if($search==='%') {
58
+		if ($search === '%') {
59 59
 			$search = '';
60 60
 		}
61 61
 		$limit = 5;
Please login to merge, or discard this patch.