@@ 13-32 (lines=20) @@ | ||
10 | use function React\Promise\reject; |
|
11 | use function React\Promise\resolve; |
|
12 | ||
13 | class Account extends BaseAccount |
|
14 | { |
|
15 | /** |
|
16 | * @return PromiseInterface |
|
17 | */ |
|
18 | public function refresh() : PromiseInterface |
|
19 | { |
|
20 | return $this->handleCommand(new SimpleRequestCommand('accounts'))->then(function ($json) { |
|
21 | foreach ($json['accounts'] as $account) { |
|
22 | if ($account['id'] != $this->id()) { |
|
23 | continue; |
|
24 | } |
|
25 | ||
26 | return resolve($this->handleCommand(new HydrateCommand('Account', $account))); |
|
27 | } |
|
28 | ||
29 | return reject(); |
|
30 | }); |
|
31 | } |
|
32 | } |
|
33 |
@@ 13-34 (lines=22) @@ | ||
10 | use function React\Promise\reject; |
|
11 | use function React\Promise\resolve; |
|
12 | ||
13 | class Annotation extends BaseAnnotation |
|
14 | { |
|
15 | /** |
|
16 | * @return PromiseInterface |
|
17 | */ |
|
18 | public function refresh() : PromiseInterface |
|
19 | { |
|
20 | return $this->handleCommand( |
|
21 | new SimpleRequestCommand('jobs/' . $this->jobId() . '/annotations') |
|
22 | )->then(function ($json) { |
|
23 | foreach ($json['annotations'] as $annotation) { |
|
24 | if ($annotation['id'] != $this->id()) { |
|
25 | continue; |
|
26 | } |
|
27 | ||
28 | return resolve($this->handleCommand(new HydrateCommand('Annotation', $annotation))); |
|
29 | } |
|
30 | ||
31 | return reject(); |
|
32 | }); |
|
33 | } |
|
34 | } |
|
35 |
@@ 12-33 (lines=22) @@ | ||
9 | use function React\Promise\reject; |
|
10 | use function React\Promise\resolve; |
|
11 | ||
12 | class Branch extends BaseBranch |
|
13 | { |
|
14 | /** |
|
15 | * @return PromiseInterface |
|
16 | */ |
|
17 | public function refresh() : PromiseInterface |
|
18 | { |
|
19 | return $this->handleCommand( |
|
20 | new SimpleRequestCommand('repos/' . $this->repositoryId() . '/branches') |
|
21 | )->then(function ($json) { |
|
22 | foreach ($json['branches'] as $branch) { |
|
23 | if ($branch['id'] != $this->id()) { |
|
24 | continue; |
|
25 | } |
|
26 | ||
27 | return resolve($this->handleCommand(new HydrateCommand('Branch', $branch))); |
|
28 | } |
|
29 | ||
30 | return reject(); |
|
31 | }); |
|
32 | } |
|
33 | } |
|
34 |
@@ 12-30 (lines=19) @@ | ||
9 | use function React\Promise\reject; |
|
10 | use function React\Promise\resolve; |
|
11 | ||
12 | class Broadcast extends BaseBroadcast |
|
13 | { |
|
14 | public function refresh() : PromiseInterface |
|
15 | { |
|
16 | return $this->handleCommand( |
|
17 | new SimpleRequestCommand('repos/' . $this->repositoryId() . '/branches') |
|
18 | )->then(function ($json) { |
|
19 | foreach ($json['broadcasts'] as $broadcast) { |
|
20 | if ($broadcast['id'] != $this->id()) { |
|
21 | continue; |
|
22 | } |
|
23 | ||
24 | return resolve($this->handleCommand(new HydrateCommand('Broadcast', $broadcast))); |
|
25 | } |
|
26 | ||
27 | return reject(); |
|
28 | }); |
|
29 | } |
|
30 | } |
|
31 |
@@ 13-31 (lines=19) @@ | ||
10 | use function React\Promise\reject; |
|
11 | use function React\Promise\resolve; |
|
12 | ||
13 | class Cache extends BaseCache |
|
14 | { |
|
15 | public function refresh() : PromiseInterface |
|
16 | { |
|
17 | return $this->handleCommand( |
|
18 | new SimpleRequestCommand('repos/' . $this->repositoryId() . '/caches') |
|
19 | )->then(function ($json) { |
|
20 | foreach ($json['caches'] as $cache) { |
|
21 | if ($cache['slug'] != $this->slug()) { |
|
22 | continue; |
|
23 | } |
|
24 | ||
25 | return resolve($this->handleCommand(new HydrateCommand('Cache', $cache))); |
|
26 | } |
|
27 | ||
28 | return reject(); |
|
29 | }); |
|
30 | } |
|
31 | } |
|
32 |
@@ 13-34 (lines=22) @@ | ||
10 | use function React\Promise\reject; |
|
11 | use function React\Promise\resolve; |
|
12 | ||
13 | class EnvironmentVariable extends BaseEnvironmentVariable |
|
14 | { |
|
15 | public function refresh() : PromiseInterface |
|
16 | { |
|
17 | return $this->handleCommand(new SimpleRequestCommand( |
|
18 | 'settings/env_vars?repository_id=' . $this->repositoryId() |
|
19 | ))->then(function ($json) { |
|
20 | foreach ($json['env_vars'] as $envVar) { |
|
21 | if ($envVar['id'] != $this->id()) { |
|
22 | continue; |
|
23 | } |
|
24 | ||
25 | return resolve($this->handleCommand(new HydrateCommand( |
|
26 | 'EnvironmentVariable', |
|
27 | $envVar |
|
28 | ))); |
|
29 | } |
|
30 | ||
31 | return reject(); |
|
32 | }); |
|
33 | } |
|
34 | } |
|
35 |
@@ 13-29 (lines=17) @@ | ||
10 | use function React\Promise\reject; |
|
11 | use function React\Promise\resolve; |
|
12 | ||
13 | class Hook extends BaseHook |
|
14 | { |
|
15 | public function refresh() : PromiseInterface |
|
16 | { |
|
17 | return $this->handleCommand(new SimpleRequestCommand('hooks'))->then(function ($json) { |
|
18 | foreach ($json['hooks'] as $hook) { |
|
19 | if ($hook['id'] != $this->id()) { |
|
20 | continue; |
|
21 | } |
|
22 | ||
23 | return resolve($this->handleCommand(new HydrateCommand('Hook', $hook))); |
|
24 | } |
|
25 | ||
26 | return reject(); |
|
27 | }); |
|
28 | } |
|
29 | } |
|
30 |