@@ -18,7 +18,7 @@ |
||
18 | 18 | /** |
19 | 19 | * @return CustomField[] |
20 | 20 | */ |
21 | - public function getCustomFields () { |
|
21 | + public function getCustomFields() { |
|
22 | 22 | return array_column($this->getCustomFieldSettings(), 'custom_field'); |
23 | 23 | } |
24 | 24 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param CustomField $customField |
37 | 37 | * @param array $data |
38 | 38 | */ |
39 | - public function __construct (CustomField $customField, array $data = []) { |
|
39 | + public function __construct(CustomField $customField, array $data = []) { |
|
40 | 40 | $this->customField = $customField; |
41 | 41 | parent::__construct($customField, $data); |
42 | 42 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return string |
48 | 48 | */ |
49 | - final public function __toString (): string { |
|
49 | + final public function __toString(): string { |
|
50 | 50 | return "enum_options/{$this->getGid()}"; |
51 | 51 | } |
52 | 52 | |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return string |
57 | 57 | */ |
58 | - final protected function _getDir (): string { |
|
58 | + final protected function _getDir(): string { |
|
59 | 59 | return "{$this->customField}/enum_options"; |
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @return CustomField |
64 | 64 | */ |
65 | - public function getCustomField () { |
|
65 | + public function getCustomField() { |
|
66 | 66 | return $this->customField; |
67 | 67 | } |
68 | 68 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param EnumOption $option |
76 | 76 | * @return $this |
77 | 77 | */ |
78 | - public function moveAbove (EnumOption $option) { |
|
78 | + public function moveAbove(EnumOption $option) { |
|
79 | 79 | $this->api->post("{$this->_getDir()}/insert", [ |
80 | 80 | 'before_enum_option' => $option->getGid(), |
81 | 81 | 'enum_option' => $this->getGid() |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param EnumOption $option |
94 | 94 | * @return $this |
95 | 95 | */ |
96 | - public function moveBelow (EnumOption $option) { |
|
96 | + public function moveBelow(EnumOption $option) { |
|
97 | 97 | $this->api->post("{$this->_getDir()}/insert", [ |
98 | 98 | 'after_enum_option' => $option->getGid(), |
99 | 99 | 'enum_option' => $this->getGid() |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @depends after-create |
109 | 109 | * @return $this |
110 | 110 | */ |
111 | - public function moveFirst () { |
|
111 | + public function moveFirst() { |
|
112 | 112 | $first = $this->customField->getEnumOptions()[0]; |
113 | 113 | if ($first !== $this) { |
114 | 114 | $this->moveAbove($first); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @depends after-create |
123 | 123 | * @return $this |
124 | 124 | */ |
125 | - public function moveLast () { |
|
125 | + public function moveLast() { |
|
126 | 126 | $options = $this->customField->getEnumOptions(); |
127 | 127 | $last = $options[count($options) - 1]; |
128 | 128 | if ($last !== $this) { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @return string |
39 | 39 | */ |
40 | - final public function __toString (): string { |
|
40 | + final public function __toString(): string { |
|
41 | 41 | return "users/{$this->getGid()}"; |
42 | 42 | } |
43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param Workspace $workspace |
46 | 46 | * @return $this |
47 | 47 | */ |
48 | - public function addToWorkspace (Workspace $workspace) { |
|
48 | + public function addToWorkspace(Workspace $workspace) { |
|
49 | 49 | return $this->_addWithPost("{$workspace}/addUser", [ |
50 | 50 | 'user' => $this->getGid() |
51 | 51 | ], 'workspaces', [$workspace]); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return Workspace |
58 | 58 | */ |
59 | - public function getDefaultWorkspace () { |
|
59 | + public function getDefaultWorkspace() { |
|
60 | 60 | return $this->getWorkspaces()[0]; |
61 | 61 | } |
62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param null|Workspace $workspace Falls back to the default workspace. |
65 | 65 | * @return Portfolio[] |
66 | 66 | */ |
67 | - public function getFavoritePortfolios (Workspace $workspace = null) { |
|
67 | + public function getFavoritePortfolios(Workspace $workspace = null) { |
|
68 | 68 | return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace); |
69 | 69 | } |
70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param null|Workspace $workspace Falls back to the default workspace. |
73 | 73 | * @return Project[] |
74 | 74 | */ |
75 | - public function getFavoriteProjects (Workspace $workspace = null) { |
|
75 | + public function getFavoriteProjects(Workspace $workspace = null) { |
|
76 | 76 | return $this->getFavorites(Project::class, Project::TYPE, $workspace); |
77 | 77 | } |
78 | 78 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param null|Workspace $workspace Falls back to the default workspace. |
81 | 81 | * @return Tag[] |
82 | 82 | */ |
83 | - public function getFavoriteTags (Workspace $workspace = null) { |
|
83 | + public function getFavoriteTags(Workspace $workspace = null) { |
|
84 | 84 | return $this->getFavorites(Tag::class, Tag::TYPE, $workspace); |
85 | 85 | } |
86 | 86 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param null|Workspace $workspace Falls back to the default workspace. |
89 | 89 | * @return Team[] |
90 | 90 | */ |
91 | - public function getFavoriteTeams (Workspace $workspace = null) { |
|
91 | + public function getFavoriteTeams(Workspace $workspace = null) { |
|
92 | 92 | return $this->getFavorites(Team::class, Team::TYPE, $workspace); |
93 | 93 | } |
94 | 94 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param null|Workspace $workspace Falls back to the default workspace. |
97 | 97 | * @return User[] |
98 | 98 | */ |
99 | - public function getFavoriteUsers (Workspace $workspace = null) { |
|
99 | + public function getFavoriteUsers(Workspace $workspace = null) { |
|
100 | 100 | return $this->getFavorites(self::class, self::TYPE, $workspace); |
101 | 101 | } |
102 | 102 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @param null|Workspace $workspace Falls back to the default workspace. |
107 | 107 | * @return array |
108 | 108 | */ |
109 | - protected function getFavorites (string $class, string $resourceType, Workspace $workspace = null) { |
|
109 | + protected function getFavorites(string $class, string $resourceType, Workspace $workspace = null) { |
|
110 | 110 | return $this->api->loadAll($this, $class, "{$this}/favorites", [ |
111 | 111 | 'resource_type' => $resourceType, |
112 | 112 | 'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid() |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | /** |
117 | 117 | * @return string[] |
118 | 118 | */ |
119 | - public function getPoolKeys () { |
|
119 | + public function getPoolKeys() { |
|
120 | 120 | $keys = parent::getPoolKeys(); |
121 | 121 | |
122 | 122 | // include email as a key if it's loaded |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param null|Workspace $workspace |
132 | 132 | * @return Portfolio[] |
133 | 133 | */ |
134 | - public function getPortfolios (Workspace $workspace = null) { |
|
134 | + public function getPortfolios(Workspace $workspace = null) { |
|
135 | 135 | return $this->api->loadAll($this, Portfolio::class, "portfolios", [ |
136 | 136 | 'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid(), |
137 | 137 | 'owner' => $this->getGid() |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param null|Workspace $workspace Falls back to the default workspace. |
143 | 143 | * @return TaskList |
144 | 144 | */ |
145 | - public function getTaskList (Workspace $workspace = null) { |
|
145 | + public function getTaskList(Workspace $workspace = null) { |
|
146 | 146 | return $this->api->load($this, TaskList::class, "{$this}/user_task_list", [ |
147 | 147 | 'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid() |
148 | 148 | ]); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param string[] $filter `workspace` falls back to the default. |
155 | 155 | * @return Task[] |
156 | 156 | */ |
157 | - public function getTasks (array $filter = Task::GET_INCOMPLETE) { |
|
157 | + public function getTasks(array $filter = Task::GET_INCOMPLETE) { |
|
158 | 158 | $filter['assignee'] = $this->getGid(); |
159 | 159 | $filter += ['workspace' => $this->api->getDefaultWorkspace()->getGid()]; |
160 | 160 | return $this->api->loadAll($this, Task::class, 'tasks', $filter); |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | * @param null|Workspace $organization Falls back to the default workspace. |
169 | 169 | * @return Team[] |
170 | 170 | */ |
171 | - public function getTeams (Workspace $organization = null) { |
|
171 | + public function getTeams(Workspace $organization = null) { |
|
172 | 172 | return $this->api->loadAll($this, Team::class, "{$this}/teams", [ |
173 | 173 | 'organization' => ($organization ?? $this->getDefaultWorkspace())->getGid() |
174 | 174 | ]); |
175 | 175 | } |
176 | 176 | |
177 | - public function getUrl (): string { |
|
177 | + public function getUrl(): string { |
|
178 | 178 | return "https://app.asana.com/0/{$this->getGid()}/list"; |
179 | 179 | } |
180 | 180 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @param Workspace $workspace |
183 | 183 | * @return $this |
184 | 184 | */ |
185 | - public function removeFromWorkspace (Workspace $workspace) { |
|
185 | + public function removeFromWorkspace(Workspace $workspace) { |
|
186 | 186 | return $this->_removeWithPost("{$workspace}/removeUser", [ |
187 | 187 | 'user' => $this->getGid() |
188 | 188 | ], 'workspaces', [$workspace]); |
@@ -46,14 +46,14 @@ |
||
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 |
@@ -33,7 +33,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -63,7 +63,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -41,11 +41,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param Api|Data $caller |
47 | 47 | * @param array $data |
48 | 48 | */ |
49 | - public function __construct ($caller, array $data = []) { |
|
49 | + public function __construct($caller, array $data = []) { |
|
50 | 50 | if ($caller instanceof self) { |
51 | 51 | $this->api = $caller->api; |
52 | 52 | } |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * @param array $args |
70 | 70 | * @return mixed |
71 | 71 | */ |
72 | - public function __call (string $method, array $args) { |
|
72 | + public function __call(string $method, array $args) { |
|
73 | 73 | static $magic = []; |
74 | - if (!$call =& $magic[$method]) { |
|
74 | + if (!$call = & $magic[$method]) { |
|
75 | 75 | preg_match('/^(get|has|is|select|set)(.+)$/', $method, $call); |
76 | 76 | if ('_select' !== $call[1] = '_' . $call[1]) { // _select() calls getters |
77 | 77 | $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return array |
87 | 87 | * @internal pool, `var_export()` |
88 | 88 | */ |
89 | - final public function __debugInfo (): array { |
|
89 | + final public function __debugInfo(): array { |
|
90 | 90 | return $this->data; |
91 | 91 | } |
92 | 92 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return null|Data|mixed |
96 | 96 | * @internal for `array_column()` |
97 | 97 | */ |
98 | - final public function __get ($field) { |
|
98 | + final public function __get($field) { |
|
99 | 99 | return $this->_get($field); |
100 | 100 | } |
101 | 101 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @return bool |
105 | 105 | * @internal for `array_column()` |
106 | 106 | */ |
107 | - final public function __isset ($field) { |
|
107 | + final public function __isset($field) { |
|
108 | 108 | return true; // fields may be lazy-loaded or coalesced to null. |
109 | 109 | } |
110 | 110 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param string $field |
117 | 117 | * @return mixed |
118 | 118 | */ |
119 | - protected function _get (string $field) { |
|
119 | + protected function _get(string $field) { |
|
120 | 120 | return $this->data[$field] ?? null; |
121 | 121 | } |
122 | 122 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param string $field |
132 | 132 | * @return bool |
133 | 133 | */ |
134 | - protected function _has (string $field): bool { |
|
134 | + protected function _has(string $field): bool { |
|
135 | 135 | $value = $this->_get($field); |
136 | 136 | if (isset($value)) { |
137 | 137 | if (is_countable($value)) { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @param mixed $item |
150 | 150 | * @return mixed |
151 | 151 | */ |
152 | - protected function _hydrate (string $class, $item) { |
|
152 | + protected function _hydrate(string $class, $item) { |
|
153 | 153 | if (!isset($item) or $item instanceof self) { |
154 | 154 | return $item; |
155 | 155 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @param string $field |
179 | 179 | * @return bool |
180 | 180 | */ |
181 | - protected function _is (string $field): bool { |
|
181 | + protected function _is(string $field): bool { |
|
182 | 182 | return (bool)$this->_get($field); |
183 | 183 | } |
184 | 184 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @param array $args |
197 | 197 | * @return array |
198 | 198 | */ |
199 | - protected function _select ($subject, callable $filter, ...$args) { |
|
199 | + protected function _select($subject, callable $filter, ...$args) { |
|
200 | 200 | if (is_string($subject)) { |
201 | 201 | $subject = $this->{'get' . $subject}(...$args) ?? []; |
202 | 202 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @param mixed $value |
219 | 219 | * @return $this |
220 | 220 | */ |
221 | - protected function _set (string $field, $value) { |
|
221 | + protected function _set(string $field, $value) { |
|
222 | 222 | $this->data[$field] = $value; |
223 | 223 | $this->diff[$field] = true; |
224 | 224 | return $this; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @param array $data |
231 | 231 | */ |
232 | - protected function _setData (array $data): void { |
|
232 | + protected function _setData(array $data): void { |
|
233 | 233 | $this->data = $this->diff = []; |
234 | 234 | foreach ($data as $field => $value) { |
235 | 235 | $this->_setField($field, $value); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param string $field |
243 | 243 | * @param mixed $value |
244 | 244 | */ |
245 | - protected function _setField (string $field, $value): void { |
|
245 | + protected function _setField(string $field, $value): void { |
|
246 | 246 | if (isset(static::MAP[$field])) { |
247 | 247 | $class = static::MAP[$field]; |
248 | 248 | if (is_array($class)) { |
@@ -263,14 +263,14 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @return bool |
265 | 265 | */ |
266 | - final public function isDiff (): bool { |
|
266 | + final public function isDiff(): bool { |
|
267 | 267 | return (bool)$this->diff; |
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
271 | 271 | * @return array |
272 | 272 | */ |
273 | - public function jsonSerialize (): array { |
|
273 | + public function jsonSerialize(): array { |
|
274 | 274 | $data = $this->toArray(); |
275 | 275 | ksort($data); |
276 | 276 | return $data; |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @return string |
283 | 283 | */ |
284 | - public function serialize (): string { |
|
285 | - return json_encode($this, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
|
284 | + public function serialize(): string { |
|
285 | + return json_encode($this, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @param bool $diff |
292 | 292 | * @return array |
293 | 293 | */ |
294 | - public function toArray (bool $diff = false): array { |
|
294 | + public function toArray(bool $diff = false): array { |
|
295 | 295 | $dehydrate = function($each) use (&$dehydrate, $diff) { |
296 | 296 | // convert entities to gids |
297 | 297 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | /** |
318 | 318 | * @param $serialized |
319 | 319 | */ |
320 | - public function unserialize ($serialized): void { |
|
320 | + public function unserialize($serialized): void { |
|
321 | 321 | $this->data = json_decode($serialized, true); |
322 | 322 | } |
323 | 323 | } |
324 | 324 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
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 |
||
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 |
||
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 |