-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathJsonApi.php
More file actions
28 lines (22 loc) · 697 Bytes
/
Copy pathJsonApi.php
File metadata and controls
28 lines (22 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
declare(strict_types=1);
namespace JsonApiPhp\JsonApi;
use JsonApiPhp\JsonApi\Internal\DataDocumentMember;
use JsonApiPhp\JsonApi\Internal\ErrorDocumentMember;
use JsonApiPhp\JsonApi\Internal\MetaDocumentMember;
final class JsonApi implements MetaDocumentMember, DataDocumentMember, ErrorDocumentMember {
private readonly object $obj;
public function __construct(string $version = '1.0', Meta $meta = null) {
$this->obj = (object)[
'version' => $version,
];
$meta?->attachTo($this->obj);
}
/**
* @param object $o
* @internal
*/
public function attachTo(object $o): void {
$o->jsonapi = $this->obj;
}
}