Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/compound_doc.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
new SelfLink('http://example.com/comments/5'),
new ToOne('author', new ResourceIdentifier('people', '2'))
);

$comment12 = new ResourceObject(
'comments',
'12',
Expand Down
1 change: 1 addition & 0 deletions src/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function __construct(string $name, $val)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/EmptyRelationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function __construct(string $name, RelationshipMember $member, Relationsh

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function __construct(ErrorMember ...$members)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Error/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function __construct(string $code)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Error/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function __construct(string $detail)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Error/Id.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function __construct(string $id)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Error/SourceParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function __construct(string $parameter)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Error/SourcePointer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function __construct(string $pointer)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Error/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function __construct(string $status)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Error/Title.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function __construct(string $title)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
3 changes: 1 addition & 2 deletions src/ErrorDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ final class ErrorDocument implements \JsonSerializable
{
private $obj;

public function __construct(Error $error, ErrorDocumentMember ...$members)
public function __construct(ErrorDocumentMember ...$members)
{
$this->obj = (object) [];
$error->attachTo($this->obj);
foreach ($members as $member) {
$member->attachTo($this->obj);
}
Expand Down
1 change: 1 addition & 0 deletions src/Included.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function validateLinkage(PrimaryData $data): void

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Internal/Attachable.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface Attachable
{
/**
* @param object $o
* @internal
*/
public function attachTo($o): void;
}
1 change: 1 addition & 0 deletions src/JsonApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function __construct(string $version = '1.0', Meta $meta = null)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Link/AboutLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ final class AboutLink implements ErrorMember

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Link/FirstLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ final class FirstLink implements PaginationLink

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Link/LastLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ final class LastLink implements PaginationLink

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Link/NextLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ final class NextLink implements PaginationLink

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Link/PrevLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ final class PrevLink implements PaginationLink

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Link/RelatedLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ final class RelatedLink implements RelationshipMember

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Link/SelfLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ final class SelfLink implements DataDocumentMember, ResourceMember, Relationship

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
4 changes: 4 additions & 0 deletions src/Meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public function __construct(string $key, $value)
$this->value = $value;
}

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
child($o, 'meta')->{$this->key} = $this->value;
Expand Down
1 change: 1 addition & 0 deletions src/NullData.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ final class NullData implements PrimaryData
{
/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/PaginatedCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function __construct(Pagination $pagination, Collection $collection)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function __construct(PaginationLink ...$links)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/ResourceCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function __construct(ResourceObject ...$resources)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
2 changes: 2 additions & 0 deletions src/ResourceIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function __construct(string $type, string $id, Meta $meta = null)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand All @@ -43,6 +44,7 @@ public function attachTo($o): void

/**
* @param object $o
* @internal
*/
public function attachToCollection($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/ResourceIdentifierCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function __construct(ResourceIdentifier ...$identifiers)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
2 changes: 2 additions & 0 deletions src/ResourceObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function registerIn(array &$registry): void

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand All @@ -77,6 +78,7 @@ public function attachAsIncludedTo($o): void

/**
* @param object $o
* @internal
*/
public function attachToCollection($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/ToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function __construct(string $name, ResourceIdentifierCollection $collecti

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/ToNull.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function __construct(string $name, ToOneMember ...$members)

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions src/ToOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function __construct(string $name, ResourceIdentifier $identifier, ToOneM

/**
* @param object $o
* @internal
*/
public function attachTo($o): void
{
Expand Down
1 change: 1 addition & 0 deletions test/CompoundDocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function testOfficialDocsExample()
new SelfLink('http://example.com/comments/5'),
new ToOne('author', new ResourceIdentifier('people', '2'))
);

$comment12 = new ResourceObject(
'comments',
'12',
Expand Down
1 change: 1 addition & 0 deletions test/benchmarks/compound10k.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
new SelfLink('http://example.com/comments/5'),
new ToOne('author', new ResourceIdentifier('people', '2'))
);

$comment12 = new ResourceObject(
'comments',
'12',
Expand Down