Passed
Push — master ( 2c0ae5...dd4d64 )
by y
01:41
created
src/Api/Laravel/Facade/Asana.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,14 +46,14 @@
 block discarded – undo
46 46
     /**
47 47
      * @return Api
48 48
      */
49
-    public static function getApi () {
49
+    public static function getApi() {
50 50
         return static::getFacadeRoot();
51 51
     }
52 52
 
53 53
     /**
54 54
      * @return string
55 55
      */
56
-    public static function getFacadeAccessor () {
56
+    public static function getFacadeAccessor() {
57 57
         return AsanaServiceProvider::NAME;
58 58
     }
59 59
 
Please login to merge, or discard this patch.
src/Api/SimpleCachePool.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * @param PSR16 $psr
35 35
      */
36
-    public function __construct (PSR16 $psr) {
36
+    public function __construct(PSR16 $psr) {
37 37
         $this->psr = $psr;
38 38
     }
39 39
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param AbstractEntity $entity
42 42
      * @throws CacheException
43 43
      */
44
-    protected function _add (AbstractEntity $entity): void {
44
+    protected function _add(AbstractEntity $entity): void {
45 45
         $this->psr->set("asana/{$entity->getGid()}", $entity, $this->_getTtl($entity));
46 46
         parent::_add($entity);
47 47
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * @param string[] $keys
52 52
      * @throws CacheException
53 53
      */
54
-    protected function _addKeys (AbstractEntity $entity, ...$keys): void {
54
+    protected function _addKeys(AbstractEntity $entity, ...$keys): void {
55 55
         $gid = $entity->getGid();
56 56
         $ttl = $this->_getTtl($entity);
57 57
         foreach ($keys as $key) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @return null|AbstractEntity
69 69
      * @throws CacheException
70 70
      */
71
-    protected function _get (string $key, $caller) {
71
+    protected function _get(string $key, $caller) {
72 72
         if (!$entity = parent::_get($key, $caller) and $entity = $this->psr->get("asana/{$key}")) {
73 73
             if (is_string($entity)) { // gid ref
74 74
                 if (!$entity = $this->_get($entity, $caller)) {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      * @param AbstractEntity $entity
89 89
      * @return int
90 90
      */
91
-    protected function _getTtl (AbstractEntity $entity): int {
91
+    protected function _getTtl(AbstractEntity $entity): int {
92 92
         if ($entity instanceof ImmutableInterface) {
93 93
             return strtotime('tomorrow') - time();
94 94
         }
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
      * @return bool
101 101
      * @throws CacheException
102 102
      */
103
-    protected function _has (string $key): bool {
103
+    protected function _has(string $key): bool {
104 104
         return parent::_has($key) or $this->psr->has("asana/{$key}");
105 105
     }
106 106
 
107 107
     /**
108 108
      * @return int
109 109
      */
110
-    public function getTtl (): int {
110
+    public function getTtl(): int {
111 111
         return $this->ttl;
112 112
     }
113 113
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      * @param string[] $keys
116 116
      * @throws CacheException
117 117
      */
118
-    public function remove (array $keys): void {
118
+    public function remove(array $keys): void {
119 119
         parent::remove($keys);
120 120
         foreach ($keys as $key) {
121 121
             $this->psr->delete("asana/{$key}");
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @param int $ttl
127 127
      * @return $this
128 128
      */
129
-    public function setTtl (int $ttl) {
129
+    public function setTtl(int $ttl) {
130 130
         $this->ttl = $ttl;
131 131
         return $this;
132 132
     }
Please login to merge, or discard this patch.
src/Portfolio.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return string
65 65
      */
66
-    final public function __toString (): string {
66
+    final public function __toString(): string {
67 67
         return "portfolios/{$this->getGid()}";
68 68
     }
69 69
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      *
73 73
      * @return string
74 74
      */
75
-    final protected function _getDir (): string {
75
+    final protected function _getDir(): string {
76 76
         return 'portfolios';
77 77
     }
78 78
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @param Project $item
82 82
      * @return $this
83 83
      */
84
-    public function addItem (Project $item) {
84
+    public function addItem(Project $item) {
85 85
         $this->api->post("{$this}/addItem", ['item' => $item->getGid()]);
86 86
         return $this;
87 87
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @param User $user
91 91
      * @return $this
92 92
      */
93
-    public function addMember (User $user) {
93
+    public function addMember(User $user) {
94 94
         return $this->addMembers([$user]);
95 95
     }
96 96
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      * @param User[] $users
99 99
      * @return $this
100 100
      */
101
-    public function addMembers (array $users) {
101
+    public function addMembers(array $users) {
102 102
         return $this->_addWithPost("{$this}/addMembers", [
103 103
             'members' => array_column($users, 'gid')
104 104
         ], 'members', $users);
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
      * @depends after-create
109 109
      * @return Project[]
110 110
      */
111
-    public function getItems () {
111
+    public function getItems() {
112 112
         return iterator_to_array($this);
113 113
     }
114 114
 
115 115
     /**
116 116
      * @return Traversable|Project[]
117 117
      */
118
-    public function getIterator () {
118
+    public function getIterator() {
119 119
         return $this->api->loadEach($this, Project::class, "{$this}/items");
120 120
     }
121 121
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @param Project $item
125 125
      * @return $this
126 126
      */
127
-    public function removeItem (Project $item) {
127
+    public function removeItem(Project $item) {
128 128
         $this->api->post("{$this}/removeItem", ['item' => $item->getGid()]);
129 129
         return $this;
130 130
     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      * @param User $user
134 134
      * @return $this
135 135
      */
136
-    public function removeMember (User $user) {
136
+    public function removeMember(User $user) {
137 137
         return $this->removeMembers([$user]);
138 138
     }
139 139
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      * @param User[] $users
142 142
      * @return $this
143 143
      */
144
-    public function removeMembers (array $users) {
144
+    public function removeMembers(array $users) {
145 145
         return $this->_removeWithPost("{$this}/removeMembers", [
146 146
             'members' => array_column($users, 'gid')
147 147
         ], 'members', $users);
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      * @param callable $filter `fn( Project $project ): bool`
152 152
      * @return Project[]
153 153
      */
154
-    public function selectItems (callable $filter) {
154
+    public function selectItems(callable $filter) {
155 155
         return $this->_select($this, $filter);
156 156
     }
157 157
 }
158 158
\ No newline at end of file
Please login to merge, or discard this patch.
src/Event.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
  */
42 42
 class Event extends Data {
43 43
 
44
-    const ACTION_CHANGED = 'changed';       // no parent
45
-    const ACTION_ADDED = 'added';           // relational, no change
46
-    const ACTION_REMOVED = 'removed';       // relational, no change
47
-    const ACTION_DELETED = 'deleted';       // no parent or change
48
-    const ACTION_UNDELETED = 'undeleted';   // no parent or change
44
+    const ACTION_CHANGED = 'changed'; // no parent
45
+    const ACTION_ADDED = 'added'; // relational, no change
46
+    const ACTION_REMOVED = 'removed'; // relational, no change
47
+    const ACTION_DELETED = 'deleted'; // no parent or change
48
+    const ACTION_UNDELETED = 'undeleted'; // no parent or change
49 49
 
50 50
     const GRAPH = [
51 51
         User::TYPE => User::class,
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         'user' => User::class
64 64
     ];
65 65
 
66
-    protected function _setData (array $data): void {
66
+    protected function _setData(array $data): void {
67 67
         if (isset($data['parent'])) {
68 68
             $type = $data['parent']['resource_type'];
69 69
             $data['parent'] = $this->_hydrate(static::GRAPH[$type], $data['parent']);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @return null|Project|Section|Task
82 82
      */
83
-    public function getParent () {
83
+    public function getParent() {
84 84
         return $this->data['parent'] ?? null;
85 85
     }
86 86
 
@@ -89,42 +89,42 @@  discard block
 block discarded – undo
89 89
      *
90 90
      * @return User|Project|Section|Task|CustomField|Attachment|Story|Like
91 91
      */
92
-    public function getResource () {
92
+    public function getResource() {
93 93
         return $this->data['resource'];
94 94
     }
95 95
 
96 96
     /**
97 97
      * @return bool
98 98
      */
99
-    final public function wasAddition (): bool {
99
+    final public function wasAddition(): bool {
100 100
         return $this->getAction() === self::ACTION_ADDED;
101 101
     }
102 102
 
103 103
     /**
104 104
      * @return bool
105 105
      */
106
-    final public function wasChange (): bool {
106
+    final public function wasChange(): bool {
107 107
         return $this->getAction() === self::ACTION_CHANGED;
108 108
     }
109 109
 
110 110
     /**
111 111
      * @return bool
112 112
      */
113
-    final public function wasDeletion (): bool {
113
+    final public function wasDeletion(): bool {
114 114
         return $this->getAction() === self::ACTION_DELETED;
115 115
     }
116 116
 
117 117
     /**
118 118
      * @return bool
119 119
      */
120
-    final public function wasRemoval (): bool {
120
+    final public function wasRemoval(): bool {
121 121
         return $this->getAction() === self::ACTION_REMOVED;
122 122
     }
123 123
 
124 124
     /**
125 125
      * @return bool
126 126
      */
127
-    final public function wasUndeletion (): bool {
127
+    final public function wasUndeletion(): bool {
128 128
         return $this->getAction() === self::ACTION_UNDELETED;
129 129
     }
130 130
 }
131 131
\ No newline at end of file
Please login to merge, or discard this patch.
src/Base/AbstractEntity/DateTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      * @param null|string|DateTimeInterface $date
23 23
      * @return $this
24 24
      */
25
-    private function _setYmd (string $field, $date) {
25
+    private function _setYmd(string $field, $date) {
26 26
         if ($date instanceof DateTimeInterface) {
27 27
             $date = $date->format('Y-m-d');
28 28
         }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param null|string|DateTimeInterface $date
34 34
      * @return $this
35 35
      */
36
-    public function setDueOn ($date) {
36
+    public function setDueOn($date) {
37 37
         return $this->_setYmd('due_on', $date);
38 38
     }
39 39
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param null|string|DateTimeInterface $date
42 42
      * @return $this
43 43
      */
44
-    public function setStartOn ($date) {
44
+    public function setStartOn($date) {
45 45
         return $this->_setYmd('start_on', $date);
46 46
     }
47 47
 
Please login to merge, or discard this patch.
src/Base/AbstractEntity/PostMutatorTrait.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      * @param array $diff
20 20
      * @return $this
21 21
      */
22
-    private function _addWithPost (string $addPath, array $data, string $field, array $diff) {
22
+    private function _addWithPost(string $addPath, array $data, string $field, array $diff) {
23 23
         if ($this->hasGid()) {
24 24
             return $this->_setWithPost($addPath, $data, $field);
25 25
         }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param array|Closure $diff An array to diff, or a filter closure.
34 34
      * @return $this
35 35
      */
36
-    private function _removeWithPost (string $rmPath, array $data, string $field, $diff) {
36
+    private function _removeWithPost(string $rmPath, array $data, string $field, $diff) {
37 37
         if ($this->hasGid()) {
38 38
             return $this->_setWithPost($rmPath, $data, $field);
39 39
         }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @return $this
54 54
      * @internal
55 55
      */
56
-    private function _setWithPost (string $path, array $data, string $field, $value = null) {
56
+    private function _setWithPost(string $path, array $data, string $field, $value = null) {
57 57
         if ($this->hasGid()) {
58 58
             /** @var array $remote */
59 59
             $remote = $this->api->post($path, $data, ['fields' => static::OPT_FIELDS[$field] ?? $field]);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@
 block discarded – undo
36 36
     private function _removeWithPost (string $rmPath, array $data, string $field, $diff) {
37 37
         if ($this->hasGid()) {
38 38
             return $this->_setWithPost($rmPath, $data, $field);
39
-        }
40
-        elseif (is_array($diff)) {
39
+        } elseif (is_array($diff)) {
41 40
             return $this->_set($field, array_values(array_diff($this->data[$field] ?? [], $diff)));
42 41
         }
43 42
         return $this->_set($field, array_values(array_filter($this->data[$field] ?? [], $diff)));
Please login to merge, or discard this patch.
src/Project/Status.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      * @param Project $project
51 51
      * @param array $data
52 52
      */
53
-    public function __construct (Project $project, array $data = []) {
53
+    public function __construct(Project $project, array $data = []) {
54 54
         $this->project = $project;
55 55
         parent::__construct($project, $data);
56 56
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      *
61 61
      * @return string
62 62
      */
63
-    final public function __toString (): string {
63
+    final public function __toString(): string {
64 64
         return "project_statuses/{$this->getGid()}";
65 65
     }
66 66
 
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @return string
71 71
      */
72
-    final protected function _getDir (): string {
72
+    final protected function _getDir(): string {
73 73
         return "{$this->project}/project_statuses";
74 74
     }
75 75
 
76
-    protected function _setData (array $data): void {
76
+    protected function _setData(array $data): void {
77 77
         // redundant, prefer created_by
78 78
         unset($data['author']);
79 79
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     /**
84 84
      * @return Project
85 85
      */
86
-    public function getProject () {
86
+    public function getProject() {
87 87
         return $this->project;
88 88
     }
89 89
 }
90 90
\ No newline at end of file
Please login to merge, or discard this patch.
src/Project/Section.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @return string
38 38
      */
39
-    final public function __toString (): string {
39
+    final public function __toString(): string {
40 40
         return "sections/{$this->getGid()}";
41 41
     }
42 42
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      *
46 46
      * @return string
47 47
      */
48
-    final protected function _getDir (): string {
48
+    final protected function _getDir(): string {
49 49
         return "{$this->getProject()}/sections";
50 50
     }
51 51
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param array $filter
54 54
      * @return Traversable|Task[]
55 55
      */
56
-    public function getIterator (array $filter = Task::GET_INCOMPLETE) {
56
+    public function getIterator(array $filter = Task::GET_INCOMPLETE) {
57 57
         $filter['section'] = $this->getGid();
58 58
         return $this->api->loadEach($this, Task::class, 'tasks', $filter);
59 59
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      * @param array $filter
63 63
      * @return Task[]
64 64
      */
65
-    public function getTasks (array $filter = Task::GET_INCOMPLETE) {
65
+    public function getTasks(array $filter = Task::GET_INCOMPLETE) {
66 66
         return iterator_to_array($this->getIterator($filter));
67 67
     }
68 68
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @depends after-create
73 73
      * @return Task
74 74
      */
75
-    public function newTask () {
75
+    public function newTask() {
76 76
         /** @var Task $task */
77 77
         $task = $this->api->factory($this, Task::class);
78 78
         return $task->addToProject($this);
Please login to merge, or discard this patch.
src/CustomField.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return string
50 50
      */
51
-    final public function __toString (): string {
51
+    final public function __toString(): string {
52 52
         return "custom_fields/{$this->getGid()}";
53 53
     }
54 54
 
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return string
59 59
      */
60
-    final protected function _getDir (): string {
60
+    final protected function _getDir(): string {
61 61
         return 'custom_fields';
62 62
     }
63 63
 
64
-    protected function _setData (array $data): void {
64
+    protected function _setData(array $data): void {
65 65
         // strip out field entry values if present.
66 66
         $data = array_intersect_key($data, array_flip([
67 67
             'gid',
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @param string $name
83 83
      * @return EnumOption
84 84
      */
85
-    public function addEnumOption (string $name) {
85
+    public function addEnumOption(string $name) {
86 86
         /** @var EnumOption $option */
87 87
         $option = $this->api->factory($this, EnumOption::class);
88 88
         $option->setName($name);
@@ -98,35 +98,35 @@  discard block
 block discarded – undo
98 98
     /**
99 99
      * @return bool
100 100
      */
101
-    final public function hasNotificationsEnabled (): bool {
101
+    final public function hasNotificationsEnabled(): bool {
102 102
         return $this->_is('has_notifications_enabled');
103 103
     }
104 104
 
105 105
     /**
106 106
      * @return bool
107 107
      */
108
-    final public function isEnum (): bool {
108
+    final public function isEnum(): bool {
109 109
         return $this->getResourceSubtype() === self::TYPE_ENUM;
110 110
     }
111 111
 
112 112
     /**
113 113
      * @return bool
114 114
      */
115
-    final public function isGlobalToWorkspace (): bool {
115
+    final public function isGlobalToWorkspace(): bool {
116 116
         return $this->_is('is_global_to_workspace');
117 117
     }
118 118
 
119 119
     /**
120 120
      * @return bool
121 121
      */
122
-    final public function isNumber (): bool {
122
+    final public function isNumber(): bool {
123 123
         return $this->getResourceSubtype() === self::TYPE_NUMBER;
124 124
     }
125 125
 
126 126
     /**
127 127
      * @return bool
128 128
      */
129
-    final public function isText (): bool {
129
+    final public function isText(): bool {
130 130
         return $this->getResourceSubtype() === self::TYPE_TEXT;
131 131
     }
132 132
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      * @param bool $flag
135 135
      * @return $this
136 136
      */
137
-    final public function setGlobalToWorkspace (bool $flag) {
137
+    final public function setGlobalToWorkspace(bool $flag) {
138 138
         return $this->_set('is_global_to_workspace', $flag);
139 139
     }
140 140
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      * @param bool $flag
143 143
      * @return $this
144 144
      */
145
-    final public function setNotificationsEnabled (bool $flag) {
145
+    final public function setNotificationsEnabled(bool $flag) {
146 146
         return $this->_set('has_notifications_enabled', $flag);
147 147
     }
148 148
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      * @param callable $cmp `fn( EnumOption $a, EnumOption $b ): int`
151 151
      * @return $this
152 152
      */
153
-    public function sortEnumOptions (callable $cmp) {
153
+    public function sortEnumOptions(callable $cmp) {
154 154
         if ($options = $this->getEnumOptions()) {
155 155
             $prev = $options[0]; // first option on remote
156 156
             usort($options, $cmp);
Please login to merge, or discard this patch.