@@ -15,14 +15,14 @@ |
||
| 15 | 15 | * |
| 16 | 16 | * @return string |
| 17 | 17 | */ |
| 18 | - abstract protected function _getDir (): string; |
|
| 18 | + abstract protected function _getDir(): string; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * `POST` |
| 22 | 22 | * |
| 23 | 23 | * @return $this |
| 24 | 24 | */ |
| 25 | - public function create () { |
|
| 25 | + public function create() { |
|
| 26 | 26 | /** @var Api $api */ |
| 27 | 27 | $api = $this->api; |
| 28 | 28 | $remote = $api->post($this->_getDir(), $this->getDiff(), ['expand' => 'this']); |
@@ -31,15 +31,15 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | const TYPE = 'portfolio'; |
| 33 | 33 | |
| 34 | - final public function __toString (): string { |
|
| 34 | + final public function __toString(): string { |
|
| 35 | 35 | return "portfolios/{$this->getGid()}"; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - final protected function _getDir (): string { |
|
| 38 | + final protected function _getDir(): string { |
|
| 39 | 39 | return 'portfolios'; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - protected function _getMap (): array { |
|
| 42 | + protected function _getMap(): array { |
|
| 43 | 43 | return [ |
| 44 | 44 | 'created_by' => User::class, |
| 45 | 45 | 'custom_fields' => [CustomField::class], |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param Project $item |
| 55 | 55 | * @return $this |
| 56 | 56 | */ |
| 57 | - public function addItem (Project $item) { |
|
| 57 | + public function addItem(Project $item) { |
|
| 58 | 58 | $this->api->post("{$this}/addItem", ['item' => $item->getGid()]); |
| 59 | 59 | return $this; |
| 60 | 60 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param User $user |
| 64 | 64 | * @return $this |
| 65 | 65 | */ |
| 66 | - public function addMember (User $user) { |
|
| 66 | + public function addMember(User $user) { |
|
| 67 | 67 | return $this->addMembers([$user]); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @param User[] $users |
| 72 | 72 | * @return $this |
| 73 | 73 | */ |
| 74 | - public function addMembers (array $users) { |
|
| 74 | + public function addMembers(array $users) { |
|
| 75 | 75 | if ($this->hasGid()) { |
| 76 | 76 | $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]); |
| 77 | 77 | $this->_merge('members', $users); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @depends after-create |
| 87 | 87 | * @return Project[] |
| 88 | 88 | */ |
| 89 | - public function getItems () { |
|
| 89 | + public function getItems() { |
|
| 90 | 90 | return $this->loadAll(Project::class, "{$this}/items"); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param Project $item |
| 96 | 96 | * @return $this |
| 97 | 97 | */ |
| 98 | - public function removeItem (Project $item) { |
|
| 98 | + public function removeItem(Project $item) { |
|
| 99 | 99 | $this->api->post("{$this}/removeItem", ['item' => $item->getGid()]); |
| 100 | 100 | return $this; |
| 101 | 101 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @param User $user |
| 105 | 105 | * @return $this |
| 106 | 106 | */ |
| 107 | - public function removeMember (User $user) { |
|
| 107 | + public function removeMember(User $user) { |
|
| 108 | 108 | return $this->removeMembers([$user]); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @param User[] $users |
| 113 | 113 | * @return $this |
| 114 | 114 | */ |
| 115 | - public function removeMembers (array $users) { |
|
| 115 | + public function removeMembers(array $users) { |
|
| 116 | 116 | if ($this->hasGid()) { |
| 117 | 117 | $this->api->post("{$this}/removeMembers", ['members' => static::_getGids($users)]); |
| 118 | 118 | } |
@@ -57,15 +57,15 @@ discard block |
||
| 57 | 57 | const LAYOUT_BOARD = 'board'; |
| 58 | 58 | const LAYOUT_LIST = 'list'; |
| 59 | 59 | |
| 60 | - final public function __toString (): string { |
|
| 60 | + final public function __toString(): string { |
|
| 61 | 61 | return "projects/{$this->getGid()}"; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - final protected function _getDir (): string { |
|
| 64 | + final protected function _getDir(): string { |
|
| 65 | 65 | return 'projects'; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - protected function _getMap (): array { |
|
| 68 | + protected function _getMap(): array { |
|
| 69 | 69 | return [ |
| 70 | 70 | 'current_status' => Status::class, |
| 71 | 71 | 'custom_fields' => [CustomField::class], |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @param User $user |
| 83 | 83 | * @return $this |
| 84 | 84 | */ |
| 85 | - public function addMember (User $user) { |
|
| 85 | + public function addMember(User $user) { |
|
| 86 | 86 | return $this->addMembers([$user]); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @param User[] $users |
| 92 | 92 | * @return $this |
| 93 | 93 | */ |
| 94 | - public function addMembers (array $users) { |
|
| 94 | + public function addMembers(array $users) { |
|
| 95 | 95 | $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]); |
| 96 | 96 | $this->_merge('members', $users); |
| 97 | 97 | return $this; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @param string $target |
| 103 | 103 | * @return ProjectWebhook |
| 104 | 104 | */ |
| 105 | - public function addWebhook (string $target) { |
|
| 105 | + public function addWebhook(string $target) { |
|
| 106 | 106 | /** @var ProjectWebhook $webhook */ |
| 107 | 107 | $webhook = $this->factory(ProjectWebhook::class); |
| 108 | 108 | return $webhook->create($this, $target); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @param array $schedule |
| 128 | 128 | * @return Job |
| 129 | 129 | */ |
| 130 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 130 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 131 | 131 | $data = ['name' => $name]; |
| 132 | 132 | if ($team) { |
| 133 | 133 | $data['team'] = $team->getGid(); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @param null|string $token |
| 150 | 150 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
| 151 | 151 | */ |
| 152 | - public function getEvents (&$token) { |
|
| 152 | + public function getEvents(&$token) { |
|
| 153 | 153 | return $this->api->sync($this, $token); |
| 154 | 154 | } |
| 155 | 155 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @depends after-create |
| 158 | 158 | * @return Section[] |
| 159 | 159 | */ |
| 160 | - public function getSections () { |
|
| 160 | + public function getSections() { |
|
| 161 | 161 | return $this->loadAll(Section::class, "{$this}/sections"); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @depends after-create |
| 166 | 166 | * @return Status[] |
| 167 | 167 | */ |
| 168 | - public function getStatuses () { |
|
| 168 | + public function getStatuses() { |
|
| 169 | 169 | return $this->loadAll(Status::class, "{$this}/project_statuses"); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @param array $query |
| 175 | 175 | * @return Task[] |
| 176 | 176 | */ |
| 177 | - public function getTasks (array $query = []) { |
|
| 177 | + public function getTasks(array $query = []) { |
|
| 178 | 178 | $query['project'] = $this->getGid(); |
| 179 | 179 | return $this->loadAll(Task::class, "tasks", $query); |
| 180 | 180 | } |
@@ -183,25 +183,25 @@ discard block |
||
| 183 | 183 | * @depends after-create |
| 184 | 184 | * @return string |
| 185 | 185 | */ |
| 186 | - public function getUrl (): string { |
|
| 186 | + public function getUrl(): string { |
|
| 187 | 187 | return "https://app.asana.com/0/{$this->getGid()}"; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
| 191 | 191 | * @return ProjectWebhook[] |
| 192 | 192 | */ |
| 193 | - public function getWebhooks () { |
|
| 193 | + public function getWebhooks() { |
|
| 194 | 194 | return $this->loadAll(ProjectWebhook::class, 'webhooks', [ |
| 195 | 195 | 'workspace' => $this->getWorkspace()->getGid(), |
| 196 | 196 | 'resource' => $this->getGid() |
| 197 | 197 | ]); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - public function isBoard (): bool { |
|
| 200 | + public function isBoard(): bool { |
|
| 201 | 201 | return $this->getLayout() === self::LAYOUT_BOARD; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - public function isList (): bool { |
|
| 204 | + public function isList(): bool { |
|
| 205 | 205 | return $this->getLayout() === self::LAYOUT_LIST; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @depends after-create |
| 210 | 210 | * @return Section |
| 211 | 211 | */ |
| 212 | - public function newSection () { |
|
| 212 | + public function newSection() { |
|
| 213 | 213 | return $this->factory(Section::class, ['projects' => [$this]]); |
| 214 | 214 | } |
| 215 | 215 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * @depends after-create |
| 218 | 218 | * @return Status |
| 219 | 219 | */ |
| 220 | - public function newStatus () { |
|
| 220 | + public function newStatus() { |
|
| 221 | 221 | return $this->factory(Status::class); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * @depends after-create |
| 228 | 228 | * @return Task |
| 229 | 229 | */ |
| 230 | - public function newTask () { |
|
| 230 | + public function newTask() { |
|
| 231 | 231 | return $this->getSections()[0]->newTask(); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @param User $user |
| 237 | 237 | * @return $this |
| 238 | 238 | */ |
| 239 | - public function removeMember (User $user) { |
|
| 239 | + public function removeMember(User $user) { |
|
| 240 | 240 | return $this->removeMembers([$user]); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @param User[] $users |
| 246 | 246 | * @return $this |
| 247 | 247 | */ |
| 248 | - public function removeMembers (array $users) { |
|
| 248 | + public function removeMembers(array $users) { |
|
| 249 | 249 | $this->api->post("{$this}/removeMembers", ['members' => static::_getGids($users)]); |
| 250 | 250 | $this->_remove('members', $users); |
| 251 | 251 | return $this; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @param null|Team $team |
| 257 | 257 | * @return $this |
| 258 | 258 | */ |
| 259 | - public function setTeam (?Team $team) { |
|
| 259 | + public function setTeam(?Team $team) { |
|
| 260 | 260 | assert(!$this->hasGid()); |
| 261 | 261 | if ($team and !$this->hasWorkspace()) { |
| 262 | 262 | $this->setWorkspace($team->getOrganization()); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param Api|Data $caller |
| 31 | 31 | * @param array $data |
| 32 | 32 | */ |
| 33 | - public function __construct ($caller, array $data = []) { |
|
| 33 | + public function __construct($caller, array $data = []) { |
|
| 34 | 34 | $this->api = $caller instanceof self ? $caller->api : $caller; |
| 35 | 35 | $this->_setData($data); |
| 36 | 36 | } |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | * @param array $args |
| 47 | 47 | * @return mixed |
| 48 | 48 | */ |
| 49 | - public function __call (string $method, array $args) { |
|
| 49 | + public function __call(string $method, array $args) { |
|
| 50 | 50 | static $cache = []; |
| 51 | - if (!$call =& $cache[$method]) { |
|
| 51 | + if (!$call = & $cache[$method]) { |
|
| 52 | 52 | preg_match('/^(get|has|is|set)(.+)$/', $method, $call); |
| 53 | 53 | $call[1] = '_' . $call[1]; |
| 54 | 54 | $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) { |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | return $this->{$call[1]}($call[2], ...$args); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function __debugInfo (): array { |
|
| 61 | + public function __debugInfo(): array { |
|
| 62 | 62 | return $this->data; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @param string $key |
| 71 | 71 | * @return mixed |
| 72 | 72 | */ |
| 73 | - protected function _get (string $key) { |
|
| 73 | + protected function _get(string $key) { |
|
| 74 | 74 | return $this->data[$key] ?? null; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @return array |
| 84 | 84 | */ |
| 85 | - protected function _getMap (): array { |
|
| 85 | + protected function _getMap(): array { |
|
| 86 | 86 | return []; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @param null|self|array $value |
| 92 | 92 | * @return null|Data|Data[] |
| 93 | 93 | */ |
| 94 | - protected function _getMapped ($class, $value) { |
|
| 94 | + protected function _getMapped($class, $value) { |
|
| 95 | 95 | // use empty|Data|Data[] as-is |
| 96 | 96 | if (!$value or $value instanceof self or current($value) instanceof self) { |
| 97 | 97 | return $value; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @param string $key |
| 130 | 130 | * @return bool |
| 131 | 131 | */ |
| 132 | - protected function _has (string $key): bool { |
|
| 132 | + protected function _has(string $key): bool { |
|
| 133 | 133 | $value = $this->_get($key); |
| 134 | 134 | if (isset($value)) { |
| 135 | 135 | if (is_countable($value)) { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @param string $key |
| 153 | 153 | * @return bool |
| 154 | 154 | */ |
| 155 | - protected function _is (string $key): bool { |
|
| 155 | + protected function _is(string $key): bool { |
|
| 156 | 156 | return !empty($this->_get($key)); |
| 157 | 157 | } |
| 158 | 158 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param mixed $value |
| 166 | 166 | * @return $this |
| 167 | 167 | */ |
| 168 | - protected function _set (string $key, $value) { |
|
| 168 | + protected function _set(string $key, $value) { |
|
| 169 | 169 | $this->data[$key] = $value; |
| 170 | 170 | $this->diff[$key] = true; |
| 171 | 171 | return $this; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param array $data |
| 178 | 178 | * @return $this |
| 179 | 179 | */ |
| 180 | - protected function _setData (array $data) { |
|
| 180 | + protected function _setData(array $data) { |
|
| 181 | 181 | $map = $this->_getMap(); |
| 182 | 182 | /** @var null|self|array $value */ |
| 183 | 183 | foreach (array_intersect_key($data, $map) as $key => $value) { |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @param array $data |
| 196 | 196 | * @return mixed |
| 197 | 197 | */ |
| 198 | - final protected function factory (string $class, array $data = []) { |
|
| 198 | + final protected function factory(string $class, array $data = []) { |
|
| 199 | 199 | return $this->api->factory($class, $this, $data); |
| 200 | 200 | } |
| 201 | 201 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * |
| 205 | 205 | * @return array |
| 206 | 206 | */ |
| 207 | - public function getDiff (): array { |
|
| 207 | + public function getDiff(): array { |
|
| 208 | 208 | $convert = function($each) use (&$convert) { |
| 209 | 209 | // convert existing entities to gids |
| 210 | 210 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @return bool |
| 231 | 231 | */ |
| 232 | - final public function isDiff (): bool { |
|
| 232 | + final public function isDiff(): bool { |
|
| 233 | 233 | return (bool)$this->diff; |
| 234 | 234 | } |
| 235 | 235 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * @see toArray() |
| 238 | 238 | * @return array |
| 239 | 239 | */ |
| 240 | - public function jsonSerialize (): array { |
|
| 240 | + public function jsonSerialize(): array { |
|
| 241 | 241 | return $this->toArray(); |
| 242 | 242 | } |
| 243 | 243 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * @param array $query |
| 252 | 252 | * @return null|mixed|AbstractEntity |
| 253 | 253 | */ |
| 254 | - final protected function load (string $class, string $path, array $query = []) { |
|
| 254 | + final protected function load(string $class, string $path, array $query = []) { |
|
| 255 | 255 | return $this->api->load($class, $this, $path, $query); |
| 256 | 256 | } |
| 257 | 257 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | * @param int $pages |
| 267 | 267 | * @return array|AbstractEntity[] |
| 268 | 268 | */ |
| 269 | - final protected function loadAll (string $class, string $path, array $query = [], int $pages = 0) { |
|
| 269 | + final protected function loadAll(string $class, string $path, array $query = [], int $pages = 0) { |
|
| 270 | 270 | return $this->api->loadAll($class, $this, $path, $query, $pages); |
| 271 | 271 | } |
| 272 | 272 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @return string |
| 277 | 277 | */ |
| 278 | - public function serialize (): string { |
|
| 278 | + public function serialize(): string { |
|
| 279 | 279 | return serialize($this->toArray()); |
| 280 | 280 | } |
| 281 | 281 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * |
| 285 | 285 | * @return array |
| 286 | 286 | */ |
| 287 | - public function toArray (): array { |
|
| 287 | + public function toArray(): array { |
|
| 288 | 288 | if (!$this->api) { |
| 289 | 289 | return $this->data; |
| 290 | 290 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | * |
| 309 | 309 | * @param $serialized |
| 310 | 310 | */ |
| 311 | - public function unserialize ($serialized): void { |
|
| 311 | + public function unserialize($serialized): void { |
|
| 312 | 312 | $this->api = Api::getDefault(); |
| 313 | 313 | $this->data = unserialize($serialized); |
| 314 | 314 | } |
@@ -52,24 +52,24 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @return Cache |
| 54 | 54 | */ |
| 55 | - public static function getCache () { |
|
| 55 | + public static function getCache() { |
|
| 56 | 56 | return static::$cache ?? static::$cache = new Cache(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * @return Api |
| 61 | 61 | */ |
| 62 | - public static function getDefault () { |
|
| 62 | + public static function getDefault() { |
|
| 63 | 63 | return self::$default; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * @return LoggerInterface |
| 68 | 68 | */ |
| 69 | - public static function getLogger () { |
|
| 69 | + public static function getLogger() { |
|
| 70 | 70 | return static::$logger ?? static::$logger = new class implements LoggerInterface { |
| 71 | 71 | |
| 72 | - public function log (string $info, string $path, ?array $payload): void { |
|
| 72 | + public function log(string $info, string $path, ?array $payload): void { |
|
| 73 | 73 | // stub |
| 74 | 74 | } |
| 75 | 75 | |
@@ -79,28 +79,28 @@ discard block |
||
| 79 | 79 | /** |
| 80 | 80 | * @param Cache $cache |
| 81 | 81 | */ |
| 82 | - public static function setCache (Cache $cache) { |
|
| 82 | + public static function setCache(Cache $cache) { |
|
| 83 | 83 | static::$cache = $cache; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * @param Api $default |
| 88 | 88 | */ |
| 89 | - public static function setDefault (Api $default) { |
|
| 89 | + public static function setDefault(Api $default) { |
|
| 90 | 90 | self::$default = $default; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * @param LoggerInterface $logger |
| 95 | 95 | */ |
| 96 | - public static function setLogger (LoggerInterface $logger) { |
|
| 96 | + public static function setLogger(LoggerInterface $logger) { |
|
| 97 | 97 | static::$logger = $logger; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * @param string $token |
| 102 | 102 | */ |
| 103 | - public function __construct (string $token) { |
|
| 103 | + public function __construct(string $token) { |
|
| 104 | 104 | $this->token = $token; |
| 105 | 105 | if (!static::$default) { |
| 106 | 106 | static::$default = $this; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @param string $path |
| 114 | 114 | */ |
| 115 | - public function delete (string $path): void { |
|
| 115 | + public function delete(string $path): void { |
|
| 116 | 116 | $this->exec('DELETE', $path); |
| 117 | 117 | } |
| 118 | 118 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @return null|array |
| 124 | 124 | * @internal |
| 125 | 125 | */ |
| 126 | - protected function exec (string $method, string $path, array $opts = null) { |
|
| 126 | + protected function exec(string $method, string $path, array $opts = null) { |
|
| 127 | 127 | $ch = curl_init(); |
| 128 | 128 | curl_setopt_array($ch, [ |
| 129 | 129 | CURLOPT_CUSTOMREQUEST => $method, |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @param array $data |
| 175 | 175 | * @return mixed |
| 176 | 176 | */ |
| 177 | - public function factory (string $class, $caller, array $data = []) { |
|
| 177 | + public function factory(string $class, $caller, array $data = []) { |
|
| 178 | 178 | return new $class($caller, $data); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @param array $options |
| 187 | 187 | * @return null|array |
| 188 | 188 | */ |
| 189 | - public function get (string $path, array $query = [], array $options = []) { |
|
| 189 | + public function get(string $path, array $query = [], array $options = []) { |
|
| 190 | 190 | foreach ($options as $name => $value) { |
| 191 | 191 | $query["opt_{$name}"] = $value; |
| 192 | 192 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @param string $gid |
| 201 | 201 | * @return null|Attachment |
| 202 | 202 | */ |
| 203 | - public function getAttachment (string $gid) { |
|
| 203 | + public function getAttachment(string $gid) { |
|
| 204 | 204 | return $this->load(Attachment::class, $this, "attachments/{$gid}"); |
| 205 | 205 | } |
| 206 | 206 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @param string $gid |
| 211 | 211 | * @return null|CustomField |
| 212 | 212 | */ |
| 213 | - public function getCustomField (string $gid) { |
|
| 213 | + public function getCustomField(string $gid) { |
|
| 214 | 214 | return $this->load(CustomField::class, $this, "custom_fields/{$gid}"); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * |
| 220 | 220 | * @return User |
| 221 | 221 | */ |
| 222 | - public function getMe () { |
|
| 222 | + public function getMe() { |
|
| 223 | 223 | return $this->getUser('me'); |
| 224 | 224 | } |
| 225 | 225 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * @param array $query |
| 231 | 231 | * @return string |
| 232 | 232 | */ |
| 233 | - protected function getPath (string $path, array $query): string { |
|
| 233 | + protected function getPath(string $path, array $query): string { |
|
| 234 | 234 | return $query ? $path . '?' . http_build_query($query) : $path; |
| 235 | 235 | } |
| 236 | 236 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @param string $gid |
| 241 | 241 | * @return null|Portfolio |
| 242 | 242 | */ |
| 243 | - public function getPortfolio (string $gid) { |
|
| 243 | + public function getPortfolio(string $gid) { |
|
| 244 | 244 | return $this->load(Portfolio::class, $this, "portfolios/{$gid}"); |
| 245 | 245 | } |
| 246 | 246 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * @param string $gid |
| 251 | 251 | * @return null|Project |
| 252 | 252 | */ |
| 253 | - public function getProject (string $gid) { |
|
| 253 | + public function getProject(string $gid) { |
|
| 254 | 254 | return $this->load(Project::class, $this, "projects/{$gid}"); |
| 255 | 255 | } |
| 256 | 256 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * @param string $gid |
| 261 | 261 | * @return null|Section |
| 262 | 262 | */ |
| 263 | - public function getSection (string $gid) { |
|
| 263 | + public function getSection(string $gid) { |
|
| 264 | 264 | return $this->load(Section::class, $this, "sections/{$gid}"); |
| 265 | 265 | } |
| 266 | 266 | |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * @param string $gid |
| 271 | 271 | * @return null|Story |
| 272 | 272 | */ |
| 273 | - public function getStory (string $gid) { |
|
| 273 | + public function getStory(string $gid) { |
|
| 274 | 274 | return $this->load(Story::class, $this, "stories/{$gid}"); |
| 275 | 275 | } |
| 276 | 276 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | * @param string $gid |
| 281 | 281 | * @return null|Tag |
| 282 | 282 | */ |
| 283 | - public function getTag (string $gid) { |
|
| 283 | + public function getTag(string $gid) { |
|
| 284 | 284 | return $this->load(Tag::class, $this, "tags/{$gid}"); |
| 285 | 285 | } |
| 286 | 286 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * @param string $gid |
| 291 | 291 | * @return null|Task |
| 292 | 292 | */ |
| 293 | - public function getTask (string $gid) { |
|
| 293 | + public function getTask(string $gid) { |
|
| 294 | 294 | return $this->load(Task::class, $this, "tasks/{$gid}"); |
| 295 | 295 | } |
| 296 | 296 | |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param string $gid |
| 301 | 301 | * @return null|Team |
| 302 | 302 | */ |
| 303 | - public function getTeam (string $gid) { |
|
| 303 | + public function getTeam(string $gid) { |
|
| 304 | 304 | return $this->load(Team::class, $this, "teams/{$gid}"); |
| 305 | 305 | } |
| 306 | 306 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * @param string $gid |
| 311 | 311 | * @return null|User |
| 312 | 312 | */ |
| 313 | - public function getUser (string $gid) { |
|
| 313 | + public function getUser(string $gid) { |
|
| 314 | 314 | return $this->load(User::class, $this, "users/{$gid}"); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * @param array $data |
| 323 | 323 | * @return ProjectEvent|TaskEvent|StoryEvent |
| 324 | 324 | */ |
| 325 | - public function getWebhookEvent (array $data) { |
|
| 325 | + public function getWebhookEvent(array $data) { |
|
| 326 | 326 | static $classes = [ |
| 327 | 327 | Project::TYPE => ProjectEvent::class, |
| 328 | 328 | Task::TYPE => TaskEvent::class, |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | * @param string $gid |
| 336 | 336 | * @return null|Workspace |
| 337 | 337 | */ |
| 338 | - public function getWorkspace (string $gid) { |
|
| 338 | + public function getWorkspace(string $gid) { |
|
| 339 | 339 | return $this->load(Workspace::class, $this, "workspaces/{$gid}"); |
| 340 | 340 | } |
| 341 | 341 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | * @param string $name |
| 344 | 344 | * @return null|Workspace |
| 345 | 345 | */ |
| 346 | - public function getWorkspaceByName (string $name) { |
|
| 346 | + public function getWorkspaceByName(string $name) { |
|
| 347 | 347 | foreach ($this->getMe()->getWorkspaces() as $workspace) { |
| 348 | 348 | if ($workspace->getName() === $name) { |
| 349 | 349 | return $workspace; |
@@ -356,16 +356,16 @@ discard block |
||
| 356 | 356 | * @param string $json |
| 357 | 357 | * @return null|array |
| 358 | 358 | */ |
| 359 | - protected function jsonDecode (string $json) { |
|
| 360 | - return json_decode($json, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
| 359 | + protected function jsonDecode(string $json) { |
|
| 360 | + return json_decode($json, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
| 364 | 364 | * @param array $data |
| 365 | 365 | * @return string |
| 366 | 366 | */ |
| 367 | - protected function jsonEncode (array $data): string { |
|
| 368 | - return json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR); |
|
| 367 | + protected function jsonEncode(array $data): string { |
|
| 368 | + return json_encode($data, JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /** |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | * @param array $query |
| 380 | 380 | * @return null|mixed|AbstractEntity |
| 381 | 381 | */ |
| 382 | - public function load (string $class, $caller, string $path, array $query = []) { |
|
| 382 | + public function load(string $class, $caller, string $path, array $query = []) { |
|
| 383 | 383 | $key = $this->getPath($path, $query); |
| 384 | 384 | return $this->getCache()->get($key, $caller, function($caller) use ($class, $path, $query) { |
| 385 | 385 | $data = $this->get($path, $query, ['expand' => 'this']); |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | * @param int $pages If positive, stops after this many pages have been fetched. |
| 400 | 400 | * @return array|AbstractEntity[] |
| 401 | 401 | */ |
| 402 | - public function loadAll (string $class, $caller, string $path, array $query = [], int $pages = 0) { |
|
| 402 | + public function loadAll(string $class, $caller, string $path, array $query = [], int $pages = 0) { |
|
| 403 | 403 | $query['opt_expand'] = 'this'; |
| 404 | 404 | $query += ['limit' => 100]; |
| 405 | 405 | $path = $this->getPath($path, $query); |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | * @param array $options |
| 426 | 426 | * @return null|array |
| 427 | 427 | */ |
| 428 | - public function post (string $path, array $data = [], array $options = []) { |
|
| 428 | + public function post(string $path, array $data = [], array $options = []) { |
|
| 429 | 429 | $response = $this->exec('POST', $path, [ |
| 430 | 430 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
| 431 | 431 | CURLOPT_POSTFIELDS => $this->jsonEncode(['options' => $options, 'data' => $data]) |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | * @param array $options |
| 442 | 442 | * @return null|array |
| 443 | 443 | */ |
| 444 | - public function put (string $path, array $data = [], array $options = []) { |
|
| 444 | + public function put(string $path, array $data = [], array $options = []) { |
|
| 445 | 445 | $response = $this->exec('PUT', $path, [ |
| 446 | 446 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
| 447 | 447 | CURLOPT_POSTFIELDS => $this->jsonEncode(['options' => $options, 'data' => $data]) |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | * @param null|string $token |
| 461 | 461 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
| 462 | 462 | */ |
| 463 | - public function sync ($entity, ?string &$token) { |
|
| 463 | + public function sync($entity, ?string &$token) { |
|
| 464 | 464 | try { |
| 465 | 465 | $response = $this->exec('GET', $this->getPath('events', [ |
| 466 | 466 | 'resource' => $entity->getGid(), |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | * @param string $file |
| 496 | 496 | * @return null|array |
| 497 | 497 | */ |
| 498 | - public function upload (string $path, string $file) { |
|
| 498 | + public function upload(string $path, string $file) { |
|
| 499 | 499 | $response = $this->exec('POST', $path, [ |
| 500 | 500 | CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data |
| 501 | 501 | ]); |
@@ -24,15 +24,15 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | const TYPE = 'section'; |
| 26 | 26 | |
| 27 | - final public function __toString (): string { |
|
| 27 | + final public function __toString(): string { |
|
| 28 | 28 | return "sections/{$this->getGid()}"; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - final protected function _getDir (): string { |
|
| 31 | + final protected function _getDir(): string { |
|
| 32 | 32 | return "{$this->getProject()}/sections"; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - protected function _getMap (): array { |
|
| 35 | + protected function _getMap(): array { |
|
| 36 | 36 | return [ |
| 37 | 37 | 'project' => Project::class |
| 38 | 38 | ]; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * @return Task[] |
| 43 | 43 | */ |
| 44 | - public function getTasks () { |
|
| 44 | + public function getTasks() { |
|
| 45 | 45 | return $this->loadAll(Task::class, 'tasks', ['section' => $this->getGid()]); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @depends after-create |
| 52 | 52 | * @return Task |
| 53 | 53 | */ |
| 54 | - public function newTask () { |
|
| 54 | + public function newTask() { |
|
| 55 | 55 | /** @var Task $task */ |
| 56 | 56 | $task = $this->factory(Task::class); |
| 57 | 57 | return $task->addToProject($this); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | protected $task; |
| 41 | 41 | |
| 42 | - public function __construct (Task $task, array $fields) { |
|
| 42 | + public function __construct(Task $task, array $fields) { |
|
| 43 | 43 | parent::__construct($task); |
| 44 | 44 | $this->task = $task; |
| 45 | 45 | foreach ($fields as $field) { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * @return int |
| 62 | 62 | */ |
| 63 | - public function count () { |
|
| 63 | + public function count() { |
|
| 64 | 64 | return count($this->data); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param string $enumGid |
| 69 | 69 | * @return null|string |
| 70 | 70 | */ |
| 71 | - public function getCurrentOptionName (string $enumGid): ?string { |
|
| 71 | + public function getCurrentOptionName(string $enumGid): ?string { |
|
| 72 | 72 | return $this->optionNames[$enumGid][$this[$enumGid]] ?? null; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param string $fieldName |
| 77 | 77 | * @return null|string |
| 78 | 78 | */ |
| 79 | - public function getGid (string $fieldName) { |
|
| 79 | + public function getGid(string $fieldName) { |
|
| 80 | 80 | return $this->gids[$fieldName] ?? null; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @return string[] |
| 87 | 87 | */ |
| 88 | - public function getGids () { |
|
| 88 | + public function getGids() { |
|
| 89 | 89 | return $this->gids; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * @return Traversable |
| 94 | 94 | */ |
| 95 | - public function getIterator () { |
|
| 95 | + public function getIterator() { |
|
| 96 | 96 | return new ArrayIterator($this->data); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @param string $fieldGid |
| 101 | 101 | * @return null|string |
| 102 | 102 | */ |
| 103 | - public function getName (string $fieldGid): ?string { |
|
| 103 | + public function getName(string $fieldGid): ?string { |
|
| 104 | 104 | return array_search($fieldGid, $this->gids) ?: null; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @return string[] |
| 111 | 111 | */ |
| 112 | - public function getNames () { |
|
| 112 | + public function getNames() { |
|
| 113 | 113 | return array_flip($this->gids); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param string $optionName |
| 119 | 119 | * @return null|string |
| 120 | 120 | */ |
| 121 | - public function getOptionGid (string $enumGid, string $optionName) { |
|
| 121 | + public function getOptionGid(string $enumGid, string $optionName) { |
|
| 122 | 122 | return array_search($optionName, $this->optionNames[$enumGid]) ?: null; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @param string $enumGid |
| 129 | 129 | * @return string[] |
| 130 | 130 | */ |
| 131 | - public function getOptionGids (string $enumGid) { |
|
| 131 | + public function getOptionGids(string $enumGid) { |
|
| 132 | 132 | return array_flip($this->optionNames[$enumGid]); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param string $optionGid |
| 138 | 138 | * @return null|string |
| 139 | 139 | */ |
| 140 | - public function getOptionName (string $enumGid, string $optionGid): ?string { |
|
| 140 | + public function getOptionName(string $enumGid, string $optionGid): ?string { |
|
| 141 | 141 | return $this->optionNames[$enumGid][$optionGid] ?? null; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param string $enumGid |
| 148 | 148 | * @return string[] |
| 149 | 149 | */ |
| 150 | - public function getOptionNames (string $enumGid) { |
|
| 150 | + public function getOptionNames(string $enumGid) { |
|
| 151 | 151 | return $this->optionNames[$enumGid]; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param string $fieldGid |
| 156 | 156 | * @return null|number|string |
| 157 | 157 | */ |
| 158 | - public function getValue (string $fieldGid) { |
|
| 158 | + public function getValue(string $fieldGid) { |
|
| 159 | 159 | return $this->data[$fieldGid] ?? null; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param string $fieldGid |
| 164 | 164 | * @return bool |
| 165 | 165 | */ |
| 166 | - public function offsetExists ($fieldGid) { |
|
| 166 | + public function offsetExists($fieldGid) { |
|
| 167 | 167 | return array_key_exists($fieldGid, $this->data); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param string $fieldGid |
| 172 | 172 | * @return null|number|string |
| 173 | 173 | */ |
| 174 | - public function offsetGet ($fieldGid) { |
|
| 174 | + public function offsetGet($fieldGid) { |
|
| 175 | 175 | return $this->getValue($fieldGid); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @param string $fieldGid |
| 180 | 180 | * @param null|number|string $value |
| 181 | 181 | */ |
| 182 | - public function offsetSet ($fieldGid, $value) { |
|
| 182 | + public function offsetSet($fieldGid, $value) { |
|
| 183 | 183 | $this->setValue($fieldGid, $value); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @param string $fieldGid |
| 190 | 190 | */ |
| 191 | - public function offsetUnset ($fieldGid) { |
|
| 191 | + public function offsetUnset($fieldGid) { |
|
| 192 | 192 | $this->setValue($fieldGid, null); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @param null|number|string $value |
| 198 | 198 | * @return $this |
| 199 | 199 | */ |
| 200 | - public function setValue (string $fieldGid, $value) { |
|
| 200 | + public function setValue(string $fieldGid, $value) { |
|
| 201 | 201 | $this->data[$fieldGid] = $value; |
| 202 | 202 | $this->diff[$fieldGid] = true; |
| 203 | 203 | $this->task->diff['custom_fields'] = true; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | protected $task; |
| 26 | 26 | |
| 27 | - public function __construct (Task $task, array $data = []) { |
|
| 27 | + public function __construct(Task $task, array $data = []) { |
|
| 28 | 28 | parent::__construct($task, $data); |
| 29 | 29 | $this->task = $task; |
| 30 | 30 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param mixed $value |
| 37 | 37 | * @return $this |
| 38 | 38 | */ |
| 39 | - protected function _set (string $key, $value) { |
|
| 39 | + protected function _set(string $key, $value) { |
|
| 40 | 40 | $this->task->diff['external'] = true; |
| 41 | 41 | return parent::_set($key, $value); |
| 42 | 42 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | - abstract public function __toString (): string; |
|
| 19 | + abstract public function __toString(): string; |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * Resolves entities to GIDs. |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param AbstractEntity[] $entities |
| 25 | 25 | * @return string[] |
| 26 | 26 | */ |
| 27 | - protected static function _getGids (array $entities) { |
|
| 27 | + protected static function _getGids(array $entities) { |
|
| 28 | 28 | return array_map(function(AbstractEntity $entity) { |
| 29 | 29 | return $entity->getGid(); |
| 30 | 30 | }, $entities); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param string $key |
| 37 | 37 | * @return mixed |
| 38 | 38 | */ |
| 39 | - protected function _get (string $key) { |
|
| 39 | + protected function _get(string $key) { |
|
| 40 | 40 | if (!array_key_exists($key, $this->data) and isset($this->data['gid'])) { // can't use hasGid(), inf. loop |
| 41 | 41 | $this->reload($key); |
| 42 | 42 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @param bool $force |
| 52 | 52 | * @return $this |
| 53 | 53 | */ |
| 54 | - protected function _merge (string $key, array $entities, $force = false) { |
|
| 54 | + protected function _merge(string $key, array $entities, $force = false) { |
|
| 55 | 55 | if ($force or isset($this->data[$key])) { |
| 56 | 56 | foreach ($entities as $entity) { |
| 57 | 57 | $this->data[$key][] = $entity; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param AbstractEntity[] $entities |
| 75 | 75 | * @return $this |
| 76 | 76 | */ |
| 77 | - protected function _remove (string $key, array $entities) { |
|
| 77 | + protected function _remove(string $key, array $entities) { |
|
| 78 | 78 | if (isset($this->data[$key])) { |
| 79 | 79 | $this->data[$key] = array_values(array_diff($this->data[$key], $entities)); |
| 80 | 80 | $this->api->getCache()->add($this); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @param AbstractEntity $entity |
| 89 | 89 | * @return $this |
| 90 | 90 | */ |
| 91 | - public function merge (AbstractEntity $entity) { |
|
| 91 | + public function merge(AbstractEntity $entity) { |
|
| 92 | 92 | assert($entity->api); // hydrated |
| 93 | 93 | foreach ($entity->data as $key => $value) { |
| 94 | 94 | if (!array_key_exists($key, $this->data) and !isset($entity->diff[$key])) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @param string $key |
| 105 | 105 | * @return $this |
| 106 | 106 | */ |
| 107 | - public function reload (string $key = null) { |
|
| 107 | + public function reload(string $key = null) { |
|
| 108 | 108 | if (isset($key)) { |
| 109 | 109 | $value = $this->api->get($this, [], ['fields' => $key])[$key] ?? null; |
| 110 | 110 | $map = $this->_getMap(); |