Skip to content

Commit f12b734

Browse files
committed
2 parents 4cbb069 + 68dd1d2 commit f12b734

Some content is hidden

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

44 files changed

+843
-816
lines changed

Diff for: src/Contracts/Entry.php

-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44

55
interface Entry
66
{
7-
87
public function getNode($key);
98

109
public function getRequest() ;
1110

1211
public function setRequest($request);
1312

1413
public function newRequest();
15-
1614
}

Diff for: src/Contracts/Relation.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44

55
interface Relation
66
{
7-
8-
}
7+
}

Diff for: src/Dev/Address.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66

77
class Address extends Resource
88
{
9-
protected $storeResource = 'MacsiDigital\API\Dev\Resources\StoreAddress';
9+
protected $storeResource = 'MacsiDigital\API\Dev\Resources\StoreAddress';
1010
protected $updateResource = 'MacsiDigital\API\Dev\Resources\UpdateAddress';
1111

12-
public function user()
12+
public function user()
1313
{
14-
return $this->belongsTo(User::class);
14+
return $this->belongsTo(User::class);
1515
}
16-
1716
}

Diff for: src/Dev/Api.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ public function newRequest()
1616
return Client::baseUrl(config('api.base_url'))->withOptions(config('api.options'));
1717
}
1818

19-
public function setConfig()
19+
public function setConfig()
2020
{
2121
// Normally you would use a proper config file but for our tests we will include it
2222
$config = include 'config.php';
2323
config($config);
2424
}
25-
2625
}

Diff for: src/Dev/Resources/StoreAddress.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66

77
class StoreAddress extends PersistResource
88
{
9-
109
protected $persistAttributes = [
11-
'street' => 'required|string|max:255',
12-
'town' => 'required|string|max:255',
13-
'postcode' => 'required|string|max:10',
10+
'street' => 'required|string|max:255',
11+
'town' => 'required|string|max:255',
12+
'postcode' => 'required|string|max:10',
1413
];
15-
1614
}

Diff for: src/Dev/Resources/StoreUser.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
class StoreUser extends PersistResource
88
{
99
protected $persistAttributes = [
10-
'name' => 'required|string|max:255',
11-
'email' => 'required|email|string|max:255',
12-
'password' => 'required|string|max:10',
13-
'address.street' => 'string|max:255',
14-
'address.town' => 'string|max:255',
15-
'address.postcode' => 'string|max:10',
10+
'name' => 'required|string|max:255',
11+
'email' => 'required|email|string|max:255',
12+
'password' => 'required|string|max:10',
13+
'address.street' => 'string|max:255',
14+
'address.town' => 'string|max:255',
15+
'address.postcode' => 'string|max:10',
1616
];
17-
1817
}

Diff for: src/Dev/Resources/UpdateAddress.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66

77
class UpdateAddress extends PersistResource
88
{
9-
109
protected $persistAttributes = [
11-
'street' => 'required|string|max:255',
12-
'town' => 'required|string|max:255',
13-
'postcode' => 'required|string|max:10',
10+
'street' => 'required|string|max:255',
11+
'town' => 'required|string|max:255',
12+
'postcode' => 'required|string|max:10',
1413
];
15-
1614
}

Diff for: src/Dev/Resources/UpdateUser.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@
77
class UpdateUser extends PersistResource
88
{
99
protected $persistAttributes = [
10-
'name' => 'string|max:255',
11-
'email' => 'email|string|max:255',
12-
'password' => 'string|max:10',
13-
'address.street' => 'string|max:255',
14-
'address.town' => 'string|max:255',
15-
'address.postcode' => 'string|max:10',
10+
'name' => 'string|max:255',
11+
'email' => 'email|string|max:255',
12+
'password' => 'string|max:10',
13+
'address.street' => 'string|max:255',
14+
'address.town' => 'string|max:255',
15+
'address.postcode' => 'string|max:10',
1616
];
1717

1818
protected $relatedResource = [
1919
// 'address' => '\MacsiDigital\API\Dev\Resources\UpdateAddress'
2020
];
21-
2221
}

Diff for: src/Dev/User.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66

77
class User extends Resource
88
{
9-
protected $storeResource = 'MacsiDigital\API\Dev\Resources\StoreUser';
9+
protected $storeResource = 'MacsiDigital\API\Dev\Resources\StoreUser';
1010
protected $updateResource = 'MacsiDigital\API\Dev\Resources\UpdateUser';
1111

12-
public function address()
12+
public function address()
1313
{
14-
return $this->hasOne(Address::class);
14+
return $this->hasOne(Address::class);
1515
}
16-
1716
}

Diff for: src/Dev/config.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

33
return [
4-
'api' => [
5-
'base_url' => 'http://playground.test/api/',
6-
'options' => [
4+
'api' => [
5+
'base_url' => 'http://playground.test/api/',
6+
'options' => [
77

8-
]
9-
]
10-
];
8+
],
9+
],
10+
];

Diff for: src/Exceptions/Base.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66

77
class Base extends Exception
88
{
9-
10-
}
9+
}

Diff for: src/Exceptions/CantDeleteException.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
class CantDeleteException extends Base
66
{
7-
public function __construct($class, $key)
7+
public function __construct($class, $key)
88
{
99
parent::__construct('There was an error deleting '.$class.' with a key of '.$key);
1010
}
11-
}
11+
}

Diff for: src/Exceptions/HttpException.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ class HttpException extends Exception
88
{
99
public function __construct($code = 0, $message, \Throwable $previous = null)
1010
{
11-
parent::__construct('HTTP Request returned Status Code '.$code.'. '.$message);
11+
parent::__construct('HTTP Request returned Status Code '.$code.'. '.$message);
1212
}
13-
}
13+
}

Diff for: src/Exceptions/IncorrectRelationshipModel.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
class IncorrectRelationshipModel extends Base
66
{
7-
public function __construct($related, $object)
7+
public function __construct($related, $object)
88
{
99
parent::__construct('The relation must be of class '.get_class($related).', '.get_class($object).' passed.');
1010
}
1111
}
12-

Diff for: src/Exceptions/InvalidActionException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
class InvalidActionException extends Exception
88
{
99
//
10-
}
10+
}

Diff for: src/Exceptions/JsonEncodingException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ public static function forAttribute($model, $key, $message)
3232

3333
return new static("Unable to encode attribute [{$key}] for model [{$class}] to JSON: {$message}.");
3434
}
35-
}
35+
}

Diff for: src/Exceptions/KeyNotFoundException.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
class KeyNotFoundException extends Base
66
{
7-
public function __construct($class)
8-
{
9-
parent::__construct('Priamry key for '.$class.' not set, so cant perform this action.');
10-
}
11-
}
7+
public function __construct($class)
8+
{
9+
parent::__construct('Priamry key for '.$class.' not set, so cant perform this action.');
10+
}
11+
}

Diff for: src/Exceptions/ModelNotFoundException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ public function getIds()
6363
{
6464
return $this->ids;
6565
}
66-
}
66+
}

Diff for: src/Exceptions/NodeNotFoundException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44

55
class NodeNotFoundException extends Base
66
{
7-
8-
}
7+
}

Diff for: src/Exceptions/NotAPersistableModel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class NotAPersistableModel extends Base
66
{
7-
public function __construct($related)
7+
public function __construct($related)
88
{
99
parent::__construct(get_class($related).' cannot be saved directly to the API. It needs to be saved as part of its parent.');
1010
}

Diff for: src/Exceptions/OutOfResultSetException.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
class OutOfResultSetException extends Base
66
{
7-
public function __construct()
7+
public function __construct()
88
{
99
parent::__construct('You are trying to retrieve results outside of the available results.');
1010
}
11-
}
11+
}

Diff for: src/Exceptions/RelationAlreadyExistsException.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
class RelationAlreadyExistsException extends Base
66
{
7-
public function __construct($owner, $related)
7+
public function __construct($owner, $related)
88
{
99
parent::__construct(get_class($owner).' already has a set relationship from '.get_class($related).' this is a One relationship and cna only have 1 set relation.');
1010
}
11-
}
11+
}

Diff for: src/Exceptions/RequestException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ public function __construct(Response $response)
2626

2727
$this->response = $response;
2828
}
29-
}
29+
}

Diff for: src/Exceptions/ValidationFailedException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66

77
class ValidationFailedException extends Exception
88
{
9-
109
public function __construct($error)
1110
{
1211
parent::__construct('You have validation errors:- '.implode(', ', $error->all()));
1312
}
14-
}
13+
}

Diff for: src/Providers/APIServiceProvider.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
namespace MacsiDigital\API\Providers;
44

5-
use MacsiDigital\API\Dev\User;
6-
use MacsiDigital\API\Support\Entry;
75
use Illuminate\Support\ServiceProvider;
6+
use MacsiDigital\API\Support\Entry;
87

98
class APIServiceProvider extends ServiceProvider
109
{
11-
public function boot()
10+
public function boot()
1211
{
13-
1412
}
1513

1614
/**
@@ -26,6 +24,5 @@ public function register()
2624
// $this->app->bind(Entry::class, function ($app) {
2725
// return new Entry();
2826
// });
29-
3027
}
3128
}

Diff for: src/Support/ApiResource.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@
55

66
class ApiResource extends Resource
77
{
8-
use InteractsWithAPI;
9-
10-
}
8+
use InteractsWithAPI;
9+
}

Diff for: src/Support/Authentication/JWT.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public static function generateToken($token, $secret)
1313

1414
public static function decodeToken($jwt, $secret)
1515
{
16-
return FirebaseJWT::decode($jwt, $secret, array('HS256'));
16+
return FirebaseJWT::decode($jwt, $secret, ['HS256']);
1717
}
18-
}
18+
}

Diff for: src/Support/Authentication/OAuth1.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ public static function generate($options)
1010
{
1111
return new GuzzleOauth1($options);
1212
}
13-
}
13+
}

0 commit comments

Comments
 (0)