Skip to content
Merged

V2 #77

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
aa8e3cc
WIP
f3ath Jan 4, 2018
84b7150
Removed doc2test
f3ath Feb 21, 2018
b94bd84
Tests pass
f3ath Feb 22, 2018
2c6ca98
Tests pass
f3ath Feb 22, 2018
6ea0926
Tests pass
f3ath Feb 22, 2018
00a1b65
Tests pass
f3ath Feb 22, 2018
9371d46
Update README.md
f3ath Feb 22, 2018
89bfcff
Tests pass
f3ath Feb 22, 2018
a75ded2
Tests pass
f3ath Feb 22, 2018
b0d3f2d
Tests pass
f3ath Feb 22, 2018
f53b1e0
Merge branch 'v2' of github.com:json-api-php/json-api into v2
f3ath Feb 22, 2018
77e0ab0
Tests pass
f3ath Feb 23, 2018
c04be95
Tests pass
f3ath Feb 23, 2018
be76f3f
Tests pass
f3ath Feb 23, 2018
b0dd136
Tests pass
f3ath Feb 23, 2018
20c53db
Tests pass
f3ath Feb 23, 2018
0452ea7
Tests pass
f3ath Feb 23, 2018
27927a4
Tests pass
f3ath Feb 23, 2018
797e74a
Tests pass
f3ath Feb 23, 2018
1bd2be0
Tests pass
f3ath Feb 23, 2018
d6ef007
Tests pass
f3ath Feb 23, 2018
9c02547
Tests pass
f3ath Feb 24, 2018
46a1f6b
Tests pass
f3ath Feb 24, 2018
74c337b
Tests pass
f3ath Feb 25, 2018
29b792d
Tests pass
f3ath Feb 26, 2018
9939f88
Tests pass
f3ath Feb 26, 2018
7aa20cd
Tests pass
f3ath Feb 26, 2018
0c0081a
Merge branch 'master' into v2
f3ath Feb 26, 2018
473df51
Tests pass
f3ath Feb 26, 2018
8fd9fd0
Naming
f3ath Feb 26, 2018
7caba5f
Naming
f3ath Feb 26, 2018
ebdd747
Tests pass
f3ath Feb 26, 2018
d4dc739
Tests pass
f3ath Feb 26, 2018
9619f1b
Tests pass
f3ath Feb 26, 2018
77357dd
Tests pass
f3ath Feb 27, 2018
438d99a
Tests pass
f3ath Feb 27, 2018
1b0346e
Tests pass
f3ath Feb 27, 2018
0cfbe49
v2 rc.0
f3ath Feb 27, 2018
cc488d8
v2 rc.0
f3ath Feb 27, 2018
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
Prev Previous commit
Next Next commit
Tests pass
  • Loading branch information
f3ath committed Feb 22, 2018
commit 00a1b65a8704cf9d0c876f7151c110587a2559cc
5 changes: 4 additions & 1 deletion src/Document/Attachable.php → src/Attachable.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php
declare(strict_types=1);

namespace JsonApiPhp\JsonApi\Document;
namespace JsonApiPhp\JsonApi;

/**
* @internal
*/
interface Attachable
{
function attachTo(object $o);
Expand Down
25 changes: 25 additions & 0 deletions src/AttachableValue.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);

namespace JsonApiPhp\JsonApi;

/**
* @internal
*/
class AttachableValue
extends JsonSerializableValue
implements Attachable
{
private $key;

public function __construct(string $key, $value)
{
parent::__construct($value);
$this->key = $key;
}

function attachTo(object $o)
{
$o->{$this->key} = $this;
}
}
3 changes: 1 addition & 2 deletions src/DataDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

namespace JsonApiPhp\JsonApi;

use JsonApiPhp\JsonApi\Document\JsonSerializableValue;
use JsonApiPhp\JsonApi\PrimaryData\PrimaryData;

class DataDocument extends JsonSerializableValue
final class DataDocument extends JsonSerializableValue
{
public function __construct(PrimaryData $data, DataDocumentMember ...$documentMembers)
{
Expand Down
4 changes: 3 additions & 1 deletion src/DataDocumentMember.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php
namespace JsonApiPhp\JsonApi;

/**
* @internal
*/
interface DataDocumentMember extends DocumentMember
{

}
22 changes: 0 additions & 22 deletions src/Document/AttachableValue.php

This file was deleted.

9 changes: 0 additions & 9 deletions src/Document/Resource/ResourceObject.php

This file was deleted.

5 changes: 3 additions & 2 deletions src/DocumentMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

namespace JsonApiPhp\JsonApi;

use JsonApiPhp\JsonApi\Document\Attachable;

/**
* @internal
*/
interface DocumentMember
extends \JsonSerializable, Attachable
{
Expand Down
4 changes: 2 additions & 2 deletions src/Error/AboutLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
namespace JsonApiPhp\JsonApi\Error;

use JsonApiPhp\JsonApi\Link\Link;
use JsonApiPhp\JsonApi\Link\NamedLink;
use JsonApiPhp\JsonApi\Link\AttachableLink;

class AboutLink extends NamedLink implements ErrorMember
final class AboutLink extends AttachableLink implements ErrorMember
{
public function __construct(Link $link)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Error/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace JsonApiPhp\JsonApi\Error;

use JsonApiPhp\JsonApi\Document\AttachableValue;
use JsonApiPhp\JsonApi\AttachableValue;

class Code
final class Code
extends AttachableValue
implements ErrorMember
{
Expand Down
4 changes: 2 additions & 2 deletions src/Error/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace JsonApiPhp\JsonApi\Error;

use JsonApiPhp\JsonApi\Document\AttachableValue;
use JsonApiPhp\JsonApi\AttachableValue;

class Detail
final class Detail
extends AttachableValue
implements ErrorMember
{
Expand Down
4 changes: 2 additions & 2 deletions src/Error/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

namespace JsonApiPhp\JsonApi\Error;

use JsonApiPhp\JsonApi\Document\JsonSerializableValue;
use JsonApiPhp\JsonApi\JsonSerializableValue;
use JsonApiPhp\JsonApi\MandatoryErrorDocumentMember;
use function JsonApiPhp\JsonApi\combine;

class Error
final class Error
extends JsonSerializableValue
implements MandatoryErrorDocumentMember

Expand Down
3 changes: 3 additions & 0 deletions src/Error/ErrorMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

use JsonApiPhp\JsonApi\DocumentMember;

/**
* @internal
*/
interface ErrorMember extends DocumentMember
{
}
17 changes: 0 additions & 17 deletions src/Error/Errors.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/Error/Id.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace JsonApiPhp\JsonApi\Error;

use JsonApiPhp\JsonApi\Document\AttachableValue;
use JsonApiPhp\JsonApi\AttachableValue;

class Id
final class Id
extends AttachableValue
implements ErrorMember
{
Expand Down
4 changes: 2 additions & 2 deletions src/Error/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

namespace JsonApiPhp\JsonApi\Error;

use JsonApiPhp\JsonApi\Document\AttachableValue;
use JsonApiPhp\JsonApi\AttachableValue;
use JsonApiPhp\JsonApi\Error\Source\SourceMember;
use function JsonApiPhp\JsonApi\combine;

class Source
final class Source
extends AttachableValue
implements ErrorMember
{
Expand Down
2 changes: 1 addition & 1 deletion src/Error/Source/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace JsonApiPhp\JsonApi\Error\Source;

use JsonApiPhp\JsonApi\Document\AttachableValue;
use JsonApiPhp\JsonApi\AttachableValue;

final class Parameter
extends AttachableValue
Expand Down
2 changes: 1 addition & 1 deletion src/Error/Source/Pointer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace JsonApiPhp\JsonApi\Error\Source;

use JsonApiPhp\JsonApi\Document\AttachableValue;
use JsonApiPhp\JsonApi\AttachableValue;

final class Pointer
extends AttachableValue
Expand Down
3 changes: 3 additions & 0 deletions src/Error/Source/SourceMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

use JsonApiPhp\JsonApi\DocumentMember;

/**
* @internal
*/
interface SourceMember extends DocumentMember
{
}
2 changes: 1 addition & 1 deletion src/Error/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace JsonApiPhp\JsonApi\Error;

use JsonApiPhp\JsonApi\Document\AttachableValue;
use JsonApiPhp\JsonApi\AttachableValue;

final class Status
extends AttachableValue
Expand Down
2 changes: 1 addition & 1 deletion src/Error/Title.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace JsonApiPhp\JsonApi\Error;

use JsonApiPhp\JsonApi\Document\AttachableValue;
use JsonApiPhp\JsonApi\AttachableValue;

class Title
extends AttachableValue
Expand Down
4 changes: 1 addition & 3 deletions src/ErrorDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

namespace JsonApiPhp\JsonApi;

use JsonApiPhp\JsonApi\Document\JsonSerializableValue;

class ErrorDocument
final class ErrorDocument
extends JsonSerializableValue
{
public function __construct(MandatoryErrorDocumentMember $error, ErrorDocumentMember ...$members)
Expand Down
3 changes: 3 additions & 0 deletions src/ErrorDocumentMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

namespace JsonApiPhp\JsonApi;

/**
* @internal
*/
interface ErrorDocumentMember extends DocumentMember
{

Expand Down
5 changes: 1 addition & 4 deletions src/Document/JsonApi.php → src/JsonApi.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<?php
declare(strict_types=1);

namespace JsonApiPhp\JsonApi\Document;

use JsonApiPhp\JsonApi\DataDocumentMember;
use JsonApiPhp\JsonApi\TopLevelDocumentMember;
namespace JsonApiPhp\JsonApi;

final class JsonApi
extends AttachableValue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php
declare(strict_types=1);

namespace JsonApiPhp\JsonApi\Document;
namespace JsonApiPhp\JsonApi;

/**
* @internal
*/
class JsonSerializableValue implements \JsonSerializable
{
private $value;
Expand Down
11 changes: 7 additions & 4 deletions src/Link/NamedLink.php → src/Link/AttachableLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@

namespace JsonApiPhp\JsonApi\Link;

use JsonApiPhp\JsonApi\Document\AttachableValue;
use JsonApiPhp\JsonApi\AttachableValue;

abstract class NamedLink
/**
* @internal
*/
class AttachableLink
extends AttachableValue
{
public function __construct(string $name, Link $link)
public function __construct(string $key, Link $link)
{
parent::__construct($name, $link);
parent::__construct($key, $link);
}

function attachTo(object $o)
Expand Down
3 changes: 3 additions & 0 deletions src/Link/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

namespace JsonApiPhp\JsonApi\Link;

/**
* @internal
*/
interface Link
{

Expand Down
6 changes: 3 additions & 3 deletions src/Link/LinkObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

namespace JsonApiPhp\JsonApi\Link;

use JsonApiPhp\JsonApi\Document\JsonSerializableValue;
use JsonApiPhp\JsonApi\Document\Meta;
use JsonApiPhp\JsonApi\JsonSerializableValue;
use JsonApiPhp\JsonApi\Meta;

class LinkObject
final class LinkObject
extends JsonSerializableValue
implements Link
{
Expand Down
2 changes: 1 addition & 1 deletion src/Link/SelfLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use JsonApiPhp\JsonApi\DataDocumentMember;

class SelfLink extends NamedLink implements DataDocumentMember
final class SelfLink extends AttachableLink implements DataDocumentMember
{
public function __construct(Link $link)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Link/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace JsonApiPhp\JsonApi\Link;

use JsonApiPhp\JsonApi\Document\JsonSerializableValue;
use JsonApiPhp\JsonApi\JsonSerializableValue;

class Url
final class Url
extends JsonSerializableValue
implements Link
{
Expand Down
3 changes: 3 additions & 0 deletions src/MandatoryErrorDocumentMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

namespace JsonApiPhp\JsonApi;

/**
* @internal
*/
interface MandatoryErrorDocumentMember extends ErrorDocumentMember
{

Expand Down
Loading