Skip to content

Commit abe1a9f

Browse files
committed
Fixed all style violations
1 parent 32efc1b commit abe1a9f

File tree

182 files changed

+815
-823
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+815
-823
lines changed

src/ApiSettings.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final class ApiSettings
1818
{
1919
/**
2020
* Travis' Pusher App ID as found on: https://docs.travis-ci.com/api?http#external-apis
21-
* Will automate the retrieval of that key later in the PR
21+
* Will automate the retrieval of that key later in the PR.
2222
*/
2323
const PUSHER_KEY = '5df8ac576dcccf4fd076';
2424

@@ -50,11 +50,11 @@ final class ApiSettings
5050

5151
/**
5252
* Get client options based on $token, $suffix, and $suppliedOptions.
53-
* Will add auth middleware when $token isn't empty
53+
* Will add auth middleware when $token isn't empty.
5454
*
55-
* @param string $token
56-
* @param string $suffix
57-
* @param array $suppliedOptions
55+
* @param string $token
56+
* @param string $suffix
57+
* @param array $suppliedOptions
5858
* @return array
5959
*/
6060
public static function getOptions(

src/AsyncClient.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,19 @@ final class AsyncClient implements AsyncClientInterface
2222
private $client;
2323

2424
/**
25-
* Create a new AsyncClient based on the loop and other options pass
25+
* @param ClientInterface $client
26+
*/
27+
private function __construct(ClientInterface $client)
28+
{
29+
$this->client = $client;
30+
}
31+
32+
/**
33+
* Create a new AsyncClient based on the loop and other options pass.
2634
*
27-
* @param LoopInterface $loop
28-
* @param string $token Instructions to fetch the token: https://blog.travis-ci.com/2013-01-28-token-token-token/
29-
* @param array $options
35+
* @param LoopInterface $loop
36+
* @param string $token Instructions to fetch the token: https://blog.travis-ci.com/2013-01-28-token-token-token/
37+
* @param array $options
3038
* @return AsyncClient
3139
*/
3240
public static function create(
@@ -43,29 +51,22 @@ public static function create(
4351

4452
$options = ApiSettings::getOptions($token, 'Async', $options);
4553
$client = Factory::create($loop, $options);
54+
4655
return new self($client);
4756
}
4857

4958
/**
5059
* Create an AsyncClient from a ApiClients\Foundation\ClientInterface.
5160
* Be sure to pass in a client with the options from ApiSettings and the Async namespace suffix.
5261
*
53-
* @param ClientInterface $client
62+
* @param ClientInterface $client
5463
* @return AsyncClient
5564
*/
5665
public static function createFromClient(ClientInterface $client): self
5766
{
5867
return new self($client);
5968
}
6069

61-
/**
62-
* @param ClientInterface $client
63-
*/
64-
private function __construct(ClientInterface $client)
65-
{
66-
$this->client = $client;
67-
}
68-
6970
/**
7071
* {@inheritdoc}
7172
*/

src/AsyncClientInterface.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
namespace ApiClients\Client\Travis;
44

5-
use ApiClients\Client\Travis\CommandBus\Command;
65
use React\Promise\CancellablePromiseInterface;
76
use React\Promise\PromiseInterface;
87
use Rx\Observable;
98
use Rx\ObservableInterface;
10-
use function ApiClients\Tools\Rx\unwrapObservableFromPromise;
119
use function React\Promise\resolve;
1210

1311
interface AsyncClientInterface
@@ -16,29 +14,29 @@ interface AsyncClientInterface
1614
* Fetch the given repository.
1715
* This will resolve a Resource\Async\Repository object.
1816
*
19-
* @param string $repository
17+
* @param string $repository
2018
* @return CancellablePromiseInterface
2119
*/
2220
public function repository(string $repository): CancellablePromiseInterface;
2321

2422
/**
2523
* Fetch all the repositories linked to the authenticated user's account.
2624
* This will return a stream of Resource\Async\Repository objects.
27-
* (Requires auth token to be passed to the client!)
25+
* (Requires auth token to be passed to the client!).
2826
*
2927
* This function accepts an optional callable passed into a filter call
3028
* on the hooks observable before it fetches the repository information.
3129
* It could be used to only fetch new repositories.
3230
*
33-
* @param callable|null $filter
31+
* @param callable|null $filter
3432
* @return ObservableInterface
3533
*/
3634
public function repositories(callable $filter = null): ObservableInterface;
3735

3836
/**
3937
* Fetch information about the current authenticated user.
4038
* This will resolve a Resource\Async\User object.
41-
* (Requires auth token to be passed to the client!)
39+
* (Requires auth token to be passed to the client!).
4240
*
4341
* @return PromiseInterface
4442
*/
@@ -48,9 +46,9 @@ public function user(): PromiseInterface;
4846
* Fetch the SSH key for the given repository ID.
4947
* This will resolve a Resource\Async\SSHKey object.
5048
* (Requires auth token to be passed to the client!)
51-
* (Only available on Travis Pro: https://travis-ci.com/)
49+
* (Only available on Travis Pro: https://travis-ci.com/).
5250
*
53-
* @param int $id
51+
* @param int $id
5452
* @return PromiseInterface
5553
*/
5654
public function sshKey(int $id): PromiseInterface;
@@ -60,7 +58,7 @@ public function sshKey(int $id): PromiseInterface;
6058
* Hooks represent whether a repository is active or not,
6159
* their ID's match that of the repository they represent.
6260
* This will return a stream of Resource\Async\Hook objects.
63-
* (Requires auth token to be passed to the client!)
61+
* (Requires auth token to be passed to the client!).
6462
*
6563
* @return ObservableInterface
6664
*/
@@ -69,7 +67,7 @@ public function hooks(): ObservableInterface;
6967
/**
7068
* Fetch a stream of which users and orgs the currently authenticated user has access to.
7169
* This will return a stream of Resource\Async\Account objects.
72-
* (Requires auth token to be passed to the client!)
70+
* (Requires auth token to be passed to the client!).
7371
*
7472
* @return ObservableInterface
7573
*/
@@ -78,7 +76,7 @@ public function accounts(): ObservableInterface;
7876
/**
7977
* Fetch a list of currently active broadcast. Used by the Travis team to spread news on the site.
8078
* This will return a stream of Resource\Async\Broadcast objects.
81-
* (Requires auth token to be passed to the client!)
79+
* (Requires auth token to be passed to the client!).
8280
*
8381
* @return ObservableInterface
8482
*/

src/Client.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33

44
namespace ApiClients\Client\Travis;
55

6+
use ApiClients\Client\Travis\Resource\RepositoryInterface;
7+
use ApiClients\Client\Travis\Resource\SSHKeyInterface;
8+
use ApiClients\Client\Travis\Resource\UserInterface;
69
use ApiClients\Foundation\Factory;
710
use React\EventLoop\Factory as LoopFactory;
811
use React\EventLoop\LoopInterface;
912
use Rx\React\Promise;
10-
use ApiClients\Client\Travis\Resource\RepositoryInterface;
11-
use ApiClients\Client\Travis\Resource\SSHKeyInterface;
12-
use ApiClients\Client\Travis\Resource\UserInterface;
1313
use function Clue\React\Block\await;
14-
use function React\Promise\resolve;
1514

1615
final class Client implements ClientInterface
1716
{
@@ -26,10 +25,20 @@ final class Client implements ClientInterface
2625
private $asyncClient;
2726

2827
/**
29-
* Create a new AsyncClient based on the loop and other options pass
28+
* @param LoopInterface $loop
29+
* @param AsyncClientInterface $asyncClient
30+
*/
31+
private function __construct(LoopInterface $loop, AsyncClientInterface $asyncClient)
32+
{
33+
$this->loop = $loop;
34+
$this->asyncClient = $asyncClient;
35+
}
36+
37+
/**
38+
* Create a new AsyncClient based on the loop and other options pass.
3039
*
31-
* @param string $token Instructions to fetch the token: https://blog.travis-ci.com/2013-01-28-token-token-token/
32-
* @param array $options
40+
* @param string $token Instructions to fetch the token: https://blog.travis-ci.com/2013-01-28-token-token-token/
41+
* @param array $options
3342
* @return Client
3443
*/
3544
public static function create(
@@ -40,6 +49,7 @@ public static function create(
4049
$options = ApiSettings::getOptions($token, 'Sync', $options);
4150
$client = Factory::create($loop, $options);
4251
$asyncClient = AsyncClient::createFromClient($client);
52+
4353
return self::createFromClient($loop, $asyncClient);
4454
}
4555

@@ -48,25 +58,15 @@ public static function create(
4858
* Be sure to pass in a client with the options from ApiSettings and the Sync namespace suffix,
4959
* and pass in the same loop as associated with the AsyncClient you're passing in.
5060
*
51-
* @param LoopInterface $loop
52-
* @param AsyncClientInterface $asyncClient
61+
* @param LoopInterface $loop
62+
* @param AsyncClientInterface $asyncClient
5363
* @return Client
5464
*/
5565
public static function createFromClient(LoopInterface $loop, AsyncClientInterface $asyncClient): self
5666
{
5767
return new self($loop, $asyncClient);
5868
}
5969

60-
/**
61-
* @param LoopInterface $loop
62-
* @param AsyncClientInterface $asyncClient
63-
*/
64-
private function __construct(LoopInterface $loop, AsyncClientInterface $asyncClient)
65-
{
66-
$this->loop = $loop;
67-
$this->asyncClient = $asyncClient;
68-
}
69-
7070
/**
7171
* {@inheritdoc}
7272
*/

src/ClientInterface.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,17 @@
33

44
namespace ApiClients\Client\Travis;
55

6-
use ApiClients\Foundation\Factory;
7-
use React\EventLoop\Factory as LoopFactory;
8-
use React\EventLoop\LoopInterface;
9-
use Rx\React\Promise;
106
use ApiClients\Client\Travis\Resource\RepositoryInterface;
117
use ApiClients\Client\Travis\Resource\SSHKeyInterface;
128
use ApiClients\Client\Travis\Resource\UserInterface;
13-
use function Clue\React\Block\await;
14-
use function React\Promise\resolve;
159

1610
interface ClientInterface
1711
{
1812
/**
1913
* Fetch the given repository.
2014
* This will return a Resource\Async\Repository object.
2115
*
22-
* @param string $repository
16+
* @param string $repository
2317
* @return RepositoryInterface
2418
*/
2519
public function repository(string $repository): RepositoryInterface;
@@ -29,15 +23,15 @@ public function repository(string $repository): RepositoryInterface;
2923
* on the hooks observable before it fetches the repository information.
3024
* It could be used to only fetch new repositories.
3125
*
32-
* @param callable|null $filter
26+
* @param callable|null $filter
3327
* @return array
3428
*/
3529
public function repositories(callable $filter = null): array;
3630

3731
/**
3832
* Fetch information about the current authenticated user.
3933
* This will return a Resource\Sync\User object.
40-
* (Requires auth token to be passed to the client!)
34+
* (Requires auth token to be passed to the client!).
4135
*
4236
* @return UserInterface
4337
*/
@@ -47,9 +41,9 @@ public function user(): UserInterface;
4741
* Fetch the SSH key for the given repository ID.
4842
* This will return a Resource\Sync\SSHKey object.
4943
* (Requires auth token to be passed to the client!)
50-
* (Only available on Travis Pro: https://travis-ci.com/)
44+
* (Only available on Travis Pro: https://travis-ci.com/).
5145
*
52-
* @param int $id
46+
* @param int $id
5347
* @return SSHKeyInterface
5448
*/
5549
public function sshKey(int $id): SSHKeyInterface;
@@ -59,7 +53,7 @@ public function sshKey(int $id): SSHKeyInterface;
5953
* Hooks represent whether a repository is active or not,
6054
* their ID's match that of the repository they represent.
6155
* This will return an array of Resource\Sync\Hook objects.
62-
* (Requires auth token to be passed to the client!)
56+
* (Requires auth token to be passed to the client!).
6357
*
6458
* @return array
6559
*/
@@ -68,7 +62,7 @@ public function hooks(): array;
6862
/**
6963
* Fetch a stream of which users and orgs the currently authenticated user has access to.
7064
* This will return an array of Resource\Sync\Account objects.
71-
* (Requires auth token to be passed to the client!)
65+
* (Requires auth token to be passed to the client!).
7266
*
7367
* @return array
7468
*/
@@ -77,7 +71,7 @@ public function accounts(): array;
7771
/**
7872
* Fetch a list of currently active broadcast. Used by the Travis team to spread news on the site.
7973
* This will return an array of Resource\Sync\Broadcast objects.
80-
* (Requires auth token to be passed to the client!)
74+
* (Requires auth token to be passed to the client!).
8175
*
8276
* @return array
8377
*/

src/CommandBus/Handler/AccountsHandler.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use ApiClients\Tools\Services\Client\FetchAndIterateService;
88
use React\Promise\PromiseInterface;
99
use function React\Promise\resolve;
10-
use function WyriHaximus\React\futureFunctionPromise;
1110

1211
final class AccountsHandler
1312
{
@@ -25,9 +24,9 @@ public function __construct(FetchAndIterateService $fetchAndIterateService)
2524
}
2625

2726
/**
28-
* Fetch the given repository and hydrate it
27+
* Fetch the given repository and hydrate it.
2928
*
30-
* @param AccountsCommand $command
29+
* @param AccountsCommand $command
3130
* @return PromiseInterface
3231
*/
3332
public function handle(AccountsCommand $command): PromiseInterface

src/CommandBus/Handler/AnnotationsHandler.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use ApiClients\Tools\Services\Client\FetchAndIterateService;
99
use React\Promise\PromiseInterface;
1010
use function React\Promise\resolve;
11-
use function WyriHaximus\React\futureFunctionPromise;
1211

1312
final class AnnotationsHandler
1413
{
@@ -26,9 +25,9 @@ public function __construct(FetchAndIterateService $service)
2625
}
2726

2827
/**
29-
* Fetch the given repository and hydrate it
28+
* Fetch the given repository and hydrate it.
3029
*
31-
* @param AnnotationsCommand $command
30+
* @param AnnotationsCommand $command
3231
* @return PromiseInterface
3332
*/
3433
public function handle(AnnotationsCommand $command): PromiseInterface

src/CommandBus/Handler/BranchesHandler.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use ApiClients\Tools\Services\Client\FetchAndIterateService;
99
use React\Promise\PromiseInterface;
1010
use function React\Promise\resolve;
11-
use function WyriHaximus\React\futureFunctionPromise;
1211

1312
final class BranchesHandler
1413
{
@@ -26,9 +25,9 @@ public function __construct(FetchAndIterateService $service)
2625
}
2726

2827
/**
29-
* Fetch the given repository and hydrate it
28+
* Fetch the given repository and hydrate it.
3029
*
31-
* @param BranchesCommand $command
30+
* @param BranchesCommand $command
3231
* @return PromiseInterface
3332
*/
3433
public function handle(BranchesCommand $command): PromiseInterface

0 commit comments

Comments
 (0)