Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nohponex committed Jan 29, 2017
1 parent b79bba6 commit e38130b
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 51 deletions.
16 changes: 9 additions & 7 deletions src/AbstractEndpoint.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Phramework\JSONAPI\Client;
declare(strict_types=1);
/*
* Copyright 2016-2017 Xenofon Spafaridis
*
Expand All @@ -15,6 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Phramework\JSONAPI\Client;

use Phramework\JSONAPI\Client\Directive\Directive;
use Phramework\JSONAPI\Client\Exceptions\ResponseException;
use Phramework\JSONAPI\Client\Response\Collection;
Expand All @@ -30,7 +32,7 @@ abstract class AbstractEndpoint
* @return Collection
* @throws ResponseException
*/
public abstract function get(
abstract public function get(
Directive ...$directives
) : Collection;

Expand All @@ -40,7 +42,7 @@ public abstract function get(
* @return JSONAPIResource
* @throws ResponseException
*/
public abstract function getById(
abstract public function getById(
string $id,
Directive ...$directives
) : JSONAPIResource;
Expand All @@ -52,7 +54,7 @@ public abstract function getById(
* @return JSONAPIResource
* @throws ResponseException
*/
public abstract function post(
abstract public function post(
\stdClass $attributes = null,
RelationshipsData $relationships = null,
Directive ...$directives
Expand All @@ -66,7 +68,7 @@ public abstract function post(
* @return JSONAPIResource
* @throws ResponseException
*/
public abstract function patch(
abstract public function patch(
string $id,
\stdClass $attributes = null,
RelationshipsData $relationships = null,
Expand All @@ -81,7 +83,7 @@ public abstract function patch(
* @return JSONAPIResource
* @throws ResponseException
*/
public abstract function delete(
abstract public function delete(
string $id,
\stdClass $attributes = null,
RelationshipsData $relationships = null,
Expand All @@ -96,7 +98,7 @@ public abstract function delete(
* @return JSONAPIResource
* @throws ResponseException
*/
public abstract function put(
abstract public function put(
string $id,
\stdClass $attributes = null,
RelationshipsData $relationships = null,
Expand Down
3 changes: 2 additions & 1 deletion src/Directive/Directive.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ abstract class Directive
/**
* @return string
*/
public function getURL(): string {
public function getURL(): string
{
return '';
}

Expand Down
2 changes: 1 addition & 1 deletion src/Directive/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ public function getLimit()
{
return $this->limit;
}
}
}
2 changes: 1 addition & 1 deletion src/Endpoint/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ public function get(

return (new Collection($response));
}
}
}
2 changes: 1 addition & 1 deletion src/Response/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ public function offsetGet($offset)
{
return isset($this->data[$offset]) ? $this->data[$offset] : null;
}
}
}
1 change: 0 additions & 1 deletion src/Response/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function __construct(ResponseInterface $response)
$body = json_decode($response->getBody()->getContents());

if ($body) {

$members = array_keys(get_object_vars($this));

foreach ($members as $member) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Phramework\JSONAPI\Client;
namespace Phramework\JSONAPI\APP;

use Phramework\JSONAPI\Client\Directive\IncludeRelationship;
use Phramework\JSONAPI\Client\Directive\Page;
use Phramework\JSONAPI\Client\Endpoint;

trait BaseEndpoint
{
Expand Down
14 changes: 2 additions & 12 deletions tests/src/Endpoint/EndpointPatchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
*/
namespace Phramework\JSONAPI\Client;

require_once __DIR__ . '/BaseEndpoint.php';

use Phramework\JSONAPI\APP\BaseEndpoint;
use Phramework\JSONAPI\Client\Response\JSONAPIResource;

/**
Expand All @@ -38,16 +37,7 @@ public function testPost()
(object) [
'title' => 'do this from phpunit',
'body' => 'do this from phpunit - body',
]/*,
(new RelationshipsData())
->append(
'tag',
'1'
)
->append(
'tag',
'2'
)*/
]
);

$this->markTestIncomplete();
Expand Down
4 changes: 1 addition & 3 deletions tests/src/Endpoint/GetByIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
*/
namespace Phramework\JSONAPI\Client;

require_once __DIR__ . '/BaseEndpoint.php';

use Phramework\JSONAPI\APP\BaseEndpoint;
use Phramework\JSONAPI\Client\Directive\IncludeRelationship;
use Phramework\JSONAPI\Client\Directive\Page;
use Phramework\JSONAPI\Client\Exceptions\ResponseException;
Expand All @@ -34,7 +33,6 @@ class GetByIdTest extends \PHPUnit_Framework_TestCase
use BaseEndpoint;

/**
* @param string $id
* @covers ::getById
*/
public function testGeyById()
Expand Down
3 changes: 1 addition & 2 deletions tests/src/Endpoint/GetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
*/
namespace Phramework\JSONAPI\Client;

require_once __DIR__ . '/BaseEndpoint.php';

use Phramework\JSONAPI\APP\BaseEndpoint;
use Phramework\JSONAPI\Client\Directive\IncludeRelationship;
use Phramework\JSONAPI\Client\Directive\Page;
use Phramework\JSONAPI\Client\Exceptions\ResponseException;
Expand Down
19 changes: 3 additions & 16 deletions tests/src/Endpoint/PostTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
*/
namespace Phramework\JSONAPI\Client;

require_once __DIR__ . '/BaseEndpoint.php';

use Phramework\JSONAPI\Client\Directive\IncludeRelationship;
use Phramework\JSONAPI\Client\Directive\Page;
use Phramework\JSONAPI\Client\Exceptions\ResponseException;
use Phramework\JSONAPI\APP\BaseEndpoint;
use Phramework\JSONAPI\Client\Response\JSONAPIResource;

/**
Expand All @@ -40,17 +36,8 @@ public function testPost()
$post = $this->endpoint->post(
(object) [
'title' => 'do this from phpunit',
'body' => 'do this from phpunit - body',
]/*,
(new RelationshipsData())
->append(
'tag',
'1'
)
->append(
'tag',
'2'
)*/
'body' => 'do this from phpunit - body',
]
);

$this->markTestIncomplete();
Expand Down
5 changes: 0 additions & 5 deletions tests/src/EndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,3 @@
* limitations under the License.
*/
namespace Phramework\JSONAPI\Client;

use Phramework\JSONAPI\Client\Directive\IncludeRelationship;
use Phramework\JSONAPI\Client\Directive\Page;
use Phramework\JSONAPI\Client\Exceptions\ResponseException;
use Phramework\JSONAPI\Client\Response\JSONAPIResource;

0 comments on commit e38130b

Please sign in to comment.