Skip to content

Commit 832d5e6

Browse files
committed
PSR1/PSR2 formatting only
1 parent 37fb92f commit 832d5e6

32 files changed

+1485
-1357
lines changed

examples/ExampleGetUserRequest.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@
44
use Briedis\ApiBuilder\Method;
55
use Briedis\ApiBuilder\StructureBuilder;
66

7-
class ExampleGetUserRequest extends Method{
8-
const URI = 'user/get';
7+
class ExampleGetUserRequest extends Method
8+
{
9+
const URI = 'user/get';
910

10-
const METHOD = 'GET';
11+
const METHOD = 'GET';
1112

12-
public $title = 'User information';
13+
public $title = 'User information';
1314

14-
public $description = 'Get user by given ids. One or multiple users can be fetched at once';
15+
public $description = 'Get user by given ids. One or multiple users can be fetched at once';
1516

16-
public function getRequest(){
17-
return new GetUsersStructure;
18-
}
17+
public function getRequest()
18+
{
19+
return new GetUsersStructure;
20+
}
1921

20-
public function getResponse(){
21-
return (new StructureBuilder)
22-
->struct('users', new UserStructure, 'Array with user objects')->multiple();
23-
}
22+
public function getResponse()
23+
{
24+
return (new StructureBuilder)
25+
->struct('users', new UserStructure, 'Array with user objects')->multiple();
26+
}
2427
}

examples/index.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
$presenter = new Presenter;
1212

1313
// Set a translation callback, if needed
14-
$presenter->setTranslateCallback(function ($key){
15-
return $key; // Call your trans() function
14+
$presenter->setTranslateCallback(function ($key) {
15+
return $key; // Call your trans() function
1616
});
1717

1818
$presenter->add(new ExampleGetUserRequest);
@@ -21,12 +21,12 @@
2121
<!DOCTYPE html>
2222
<html>
2323
<head>
24-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
25-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
24+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
25+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
2626
</head>
2727
<body>
2828
<div class="container">
29-
<?= $presenter->render(); ?>
29+
<?= $presenter->render(); ?>
3030
</div>
3131
</body>
3232
</html>

examples/structures/request/GetUsersStructure.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44
use Briedis\ApiBuilder\StructureBuilder;
55
use Briedis\ApiBuilder\StructureInterface;
66

7-
class GetUsersStructure implements StructureInterface {
8-
/**
9-
* Get the structure object
10-
* @return \Briedis\ApiBuilder\StructureBuilder
11-
*/
12-
public function getStructure(){
13-
return (new StructureBuilder)
14-
->int('userId', 'Array of user ids you want to fetch')->multiple()
15-
->int('offset', 'For paging purposes')->optional()
16-
->int('count', 'Amount of users to fetch. Defaults to 20')->optional();
17-
}
7+
class GetUsersStructure implements StructureInterface
8+
{
9+
/**
10+
* Get the structure object
11+
* @return \Briedis\ApiBuilder\StructureBuilder
12+
*/
13+
public function getStructure()
14+
{
15+
return (new StructureBuilder)
16+
->int('userId', 'Array of user ids you want to fetch')->multiple()
17+
->int('offset', 'For paging purposes')->optional()
18+
->int('count', 'Amount of users to fetch. Defaults to 20')->optional();
19+
}
1820
}
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<?php
22

33

4-
use Briedis\ApiBuilder\StructureInterface;
54
use Briedis\ApiBuilder\StructureBuilder;
5+
use Briedis\ApiBuilder\StructureInterface;
66

7-
class LocationStructure implements StructureInterface {
8-
/**
9-
* @return \Briedis\ApiBuilder\StructureBuilder
10-
*/
11-
public function getStructure(){
12-
return (new StructureBuilder('Location'))
13-
->float('lat', 'Latitude coordinate, in decimal format')
14-
->float('lon', 'Longitude coordinate, in decimal format');
15-
}
7+
class LocationStructure implements StructureInterface
8+
{
9+
/**
10+
* @return \Briedis\ApiBuilder\StructureBuilder
11+
*/
12+
public function getStructure()
13+
{
14+
return (new StructureBuilder('Location'))
15+
->float('lat', 'Latitude coordinate, in decimal format')
16+
->float('lon', 'Longitude coordinate, in decimal format');
17+
}
1618
}
Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
<?php
22

33

4-
use Briedis\ApiBuilder\StructureInterface;
54
use Briedis\ApiBuilder\StructureBuilder;
5+
use Briedis\ApiBuilder\StructureInterface;
66

7-
class UserStructure implements StructureInterface{
8-
/**
9-
* Get User structure object
10-
* @return StructureBuilder
11-
*/
12-
public function getStructure(){
13-
return (new StructureBuilder('User'))
14-
->int('id', 'Unique identifier')
15-
->str('username', 'Nickname that will be used in the system')
16-
->str('firstName', 'Users first name')
17-
->str('lastName', 'Users last name')
18-
->str('gender', 'M - male, F - female')->values(['M', 'F'])->optional()
19-
->int('signature', 'Provide your favorite quote or something, if you want')->optional()
20-
->struct('location', new LocationStructure, 'Location object for the user')->optional()
21-
->int('createdAt', 'Unix timestamp, when user has registered');
22-
}
7+
class UserStructure implements StructureInterface
8+
{
9+
/**
10+
* Get User structure object
11+
* @return StructureBuilder
12+
*/
13+
public function getStructure()
14+
{
15+
return (new StructureBuilder('User'))
16+
->int('id', 'Unique identifier')
17+
->str('username', 'Nickname that will be used in the system')
18+
->str('firstName', 'Users first name')
19+
->str('lastName', 'Users last name')
20+
->str('gender', 'M - male, F - female')->values(['M', 'F'])->optional()
21+
->int('signature', 'Provide your favorite quote or something, if you want')->optional()
22+
->struct('location', new LocationStructure, 'Location object for the user')->optional()
23+
->int('createdAt', 'Unix timestamp, when user has registered');
24+
}
2325
}

src/Briedis/ApiBuilder/ApiBuilderLaravel4ServiceProvider.php

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,37 @@
22

33
use Illuminate\Support\ServiceProvider;
44

5-
class ApiBuilderLaravel4ServiceProvider extends ServiceProvider{
6-
/**
7-
* Indicates if loading of the provider is deferred.
8-
*
9-
* @var bool
10-
*/
11-
protected $defer = false;
5+
class ApiBuilderLaravel4ServiceProvider extends ServiceProvider
6+
{
7+
/**
8+
* Indicates if loading of the provider is deferred.
9+
*
10+
* @var bool
11+
*/
12+
protected $defer = false;
1213

13-
/**
14-
* Register the service provider.
15-
*
16-
* @return void
17-
*/
18-
public function register(){
19-
//
20-
}
14+
/**
15+
* Register the service provider.
16+
*
17+
* @return void
18+
*/
19+
public function register()
20+
{
21+
//
22+
}
2123

22-
/**
23-
* Get the services provided by the provider.
24-
*
25-
* @return array
26-
*/
27-
public function provides(){
28-
return array();
29-
}
24+
/**
25+
* Get the services provided by the provider.
26+
*
27+
* @return array
28+
*/
29+
public function provides()
30+
{
31+
return [];
32+
}
3033

31-
public function boot(){
32-
$this->package('briedis/api-builder');
33-
}
34+
public function boot()
35+
{
36+
$this->package('briedis/api-builder');
37+
}
3438
}

src/Briedis/ApiBuilder/ApiBuilderLaravel5ServiceProvider.php

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@
22

33
use Illuminate\Support\ServiceProvider;
44

5-
class ApiBuilderLaravel5ServiceProvider extends ServiceProvider{
6-
protected $defer = false;
5+
class ApiBuilderLaravel5ServiceProvider extends ServiceProvider
6+
{
7+
protected $defer = false;
78

8-
public function register(){
9-
}
9+
public function register()
10+
{
11+
}
1012

11-
public function provides(){
12-
return array();
13-
}
13+
public function provides()
14+
{
15+
return [];
16+
}
1417

15-
public function boot(){
16-
$this->loadViewsFrom(__DIR__ . '/../../views/', 'api-builder');
17-
$this->publishes(array(
18-
__DIR__ . '/../../../public' => public_path('/packages/briedis/api-builder/'),
19-
));
20-
}
18+
public function boot()
19+
{
20+
$this->loadViewsFrom(__DIR__ . '/../../views/', 'api-builder');
21+
$this->publishes([
22+
__DIR__ . '/../../../public' => public_path('/packages/briedis/api-builder/'),
23+
]);
24+
}
2125
}

src/Briedis/ApiBuilder/Exceptions/InvalidParameterTypeException.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
use Briedis\ApiBuilder\Items\BaseItem;
55

6-
class InvalidParameterTypeException extends \Exception{
7-
/** @var BaseItem */
8-
public $expectedItem;
6+
class InvalidParameterTypeException extends \Exception
7+
{
8+
/** @var BaseItem */
9+
public $expectedItem;
910
}

0 commit comments

Comments
 (0)