Skip to content

Commit 7c6466c

Browse files
committed
Consistent code format.
1 parent 0b11318 commit 7c6466c

22 files changed

+2161
-2047
lines changed

src/Contracts/Error/ErrorCollectionInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
namespace CloudCreativity\JsonApi\Contracts\Error;
4+
45
use Neomerx\JsonApi\Contracts\Document\ErrorInterface;
56

67
interface ErrorCollectionInterface extends \Traversable, \Countable

src/Contracts/Stdlib/ConfigurableInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
interface ConfigurableInterface
66
{
77

8-
/**
9-
* @param array $config
10-
* @return $this
11-
*/
12-
public function configure(array $config);
8+
/**
9+
* @param array $config
10+
* @return $this
11+
*/
12+
public function configure(array $config);
1313
}

src/Error/ErrorObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ErrorObject implements ErrorInterface
3131
*/
3232
public function __construct(array $input = [])
3333
{
34-
$this->exchangeArray($input);
34+
$this->exchangeArray($input);
3535
}
3636

3737
/**

src/Object/Relationships/Relationships.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,32 @@
77
class Relationships extends StandardObject
88
{
99

10-
/**
11-
* @param $key
12-
* @return mixed
13-
*/
14-
public function __get($key)
15-
{
16-
return parent::get($key);
17-
}
10+
/**
11+
* @param $key
12+
* @return mixed
13+
*/
14+
public function __get($key)
15+
{
16+
return parent::get($key);
17+
}
1818

19-
/**
20-
* @param $key
21-
* @param $default
22-
* @return Relationship
23-
*/
24-
public function get($key, $default = null)
25-
{
26-
return new Relationship(parent::get($key, $default));
27-
}
19+
/**
20+
* @param $key
21+
* @param $default
22+
* @return Relationship
23+
*/
24+
public function get($key, $default = null)
25+
{
26+
return new Relationship(parent::get($key, $default));
27+
}
2828

29-
/**
30-
* @return \Generator
31-
*/
32-
public function getIterator()
33-
{
34-
foreach ($this->keys() as $key) {
35-
yield $key => $this->get($key);
29+
/**
30+
* @return \Generator
31+
*/
32+
public function getIterator()
33+
{
34+
foreach ($this->keys() as $key) {
35+
yield $key => $this->get($key);
36+
}
3637
}
37-
}
3838
}

src/Object/Resource/Resource.php

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -9,106 +9,106 @@
99
class Resource extends StandardObject
1010
{
1111

12-
const TYPE = 'type';
13-
const ID = 'id';
14-
const ATTRIBUTES = 'attributes';
15-
const RELATIONSHIPS = 'relationships';
16-
const META = 'meta';
17-
18-
/**
19-
* @return string
20-
*/
21-
public function getType()
22-
{
23-
$type = $this->get(static::TYPE);
24-
25-
if (!is_string($type) || empty($type)) {
26-
throw new \RuntimeException('No resource object type set.');
12+
const TYPE = 'type';
13+
const ID = 'id';
14+
const ATTRIBUTES = 'attributes';
15+
const RELATIONSHIPS = 'relationships';
16+
const META = 'meta';
17+
18+
/**
19+
* @return string
20+
*/
21+
public function getType()
22+
{
23+
$type = $this->get(static::TYPE);
24+
25+
if (!is_string($type) || empty($type)) {
26+
throw new \RuntimeException('No resource object type set.');
27+
}
28+
29+
return $type;
2730
}
2831

29-
return $type;
30-
}
32+
/**
33+
* @return mixed
34+
*/
35+
public function getId()
36+
{
37+
if (!$this->hasId()) {
38+
throw new \RuntimeException('No resource object id set.');
39+
}
3140

32-
/**
33-
* @return mixed
34-
*/
35-
public function getId()
36-
{
37-
if (!$this->hasId()) {
38-
throw new \RuntimeException('No resource object id set.');
41+
return $this->get(static::ID);
3942
}
4043

41-
return $this->get(static::ID);
42-
}
43-
44-
/**
45-
* @return bool
46-
*/
47-
public function hasId()
48-
{
49-
return $this->has(static::ID);
50-
}
51-
52-
/**
53-
* @return ResourceIdentifier
54-
*/
55-
public function getIdentifier()
56-
{
57-
$identifier = new ResourceIdentifier();
58-
$identifier->setType($this->getType());
59-
60-
if ($this->hasId()) {
61-
$identifier->setId($this->getId());
44+
/**
45+
* @return bool
46+
*/
47+
public function hasId()
48+
{
49+
return $this->has(static::ID);
6250
}
6351

64-
return $identifier;
65-
}
66-
67-
/**
68-
* @return StandardObject
69-
*/
70-
public function getAttributes()
71-
{
72-
return new StandardObject($this->get(static::ATTRIBUTES));
73-
}
74-
75-
/**
76-
* @return bool
77-
*/
78-
public function hasAttributes()
79-
{
80-
return $this->has(static::ATTRIBUTES);
81-
}
82-
83-
/**
84-
* @return Relationships
85-
*/
86-
public function getRelationships()
87-
{
88-
return new Relationships($this->get(static::RELATIONSHIPS));
89-
}
90-
91-
/**
92-
* @return bool
93-
*/
94-
public function hasRelationships()
95-
{
96-
return $this->has(static::RELATIONSHIPS);
97-
}
98-
99-
/**
100-
* @return StandardObject
101-
*/
102-
public function getMeta()
103-
{
104-
return new StandardObject($this->get(static::META));
105-
}
106-
107-
/**
108-
* @return bool
109-
*/
110-
public function hasMeta()
111-
{
112-
return $this->has(static::META);
113-
}
52+
/**
53+
* @return ResourceIdentifier
54+
*/
55+
public function getIdentifier()
56+
{
57+
$identifier = new ResourceIdentifier();
58+
$identifier->setType($this->getType());
59+
60+
if ($this->hasId()) {
61+
$identifier->setId($this->getId());
62+
}
63+
64+
return $identifier;
65+
}
66+
67+
/**
68+
* @return StandardObject
69+
*/
70+
public function getAttributes()
71+
{
72+
return new StandardObject($this->get(static::ATTRIBUTES));
73+
}
74+
75+
/**
76+
* @return bool
77+
*/
78+
public function hasAttributes()
79+
{
80+
return $this->has(static::ATTRIBUTES);
81+
}
82+
83+
/**
84+
* @return Relationships
85+
*/
86+
public function getRelationships()
87+
{
88+
return new Relationships($this->get(static::RELATIONSHIPS));
89+
}
90+
91+
/**
92+
* @return bool
93+
*/
94+
public function hasRelationships()
95+
{
96+
return $this->has(static::RELATIONSHIPS);
97+
}
98+
99+
/**
100+
* @return StandardObject
101+
*/
102+
public function getMeta()
103+
{
104+
return new StandardObject($this->get(static::META));
105+
}
106+
107+
/**
108+
* @return bool
109+
*/
110+
public function hasMeta()
111+
{
112+
return $this->has(static::META);
113+
}
114114
}

0 commit comments

Comments
 (0)