Skip to content

Commit 2a97e29

Browse files
committed
remove unneeded getter methods from API classes
1 parent 40153a0 commit 2a97e29

16 files changed

+92
-175
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ install:
3333
- if [ "$deps" = "" ]; then composer install; fi
3434

3535
script:
36+
- vendor/bin/phpspec run
3637
- if [[ "$xdebug" = "yes" ]]; then phpunit --coverage-clover=coverage.clover; else phpunit; fi
3738
- if [[ "$xdebug" = "yes" ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
3839
- if [[ "$xdebug" = "yes" ]]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,39 @@ CHANGELOG
44
0.3.0
55
-----
66

7+
* Removed the `getRequestHandler()` method from the API classes:
8+
9+
* `ActivityProfileApiClient::getRequestHandler()`
10+
* `AgentProfileApiClient::getRequestHandler()`
11+
* `ApiClient::getRequestHandler()`
12+
* `DocumentApiClient::getRequestHandler()`
13+
* `StateApiClient::getRequestHandler()`
14+
* `StatementsApiClient::getRequestHandler()`
15+
16+
* Removed the `getVersion()` method from the API interfaces:
17+
18+
* `ActivityProfileApiClientInterface::getVersion()`
19+
* `AgentProfileApiClientInterface::getVersion()`
20+
* `StateApiClientInterface::getVersion()`
21+
* `StatementsApiClientInterface::getVersion()`
22+
23+
* Removed the `getVersion()` method from the API classes:
24+
25+
* `ActivityProfileApiClient::getVersion()`
26+
* `AgentProfileApiClient::getVersion()`
27+
* `ApiClient::getVersion()`
28+
* `DocumentApiClient::getVersion()`
29+
* `StateApiClient::getVersion()`
30+
* `StatementsApiClient::getVersion()`
31+
* `XApiClient::getVersion()`
32+
33+
* Removed the `getUsername()` and `getPassword()` methods from the `HandlerInterface`
34+
and the `Handler` class.
35+
36+
* Removed the `getHttpClient()` method from the `Handler` class.
37+
38+
* Removed the `getSerializerRegistry()` method from the `XApiClient` class.
39+
740
* Made all classes final.
841

942
0.2.0

UPGRADE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,40 @@ UPGRADE
44
Upgrading from 0.2 to 0.3
55
-------------------------
66

7+
* Removed the `getRequestHandler()` method from the API classes:
8+
9+
* `ActivityProfileApiClient::getRequestHandler()`
10+
* `AgentProfileApiClient::getRequestHandler()`
11+
* `ApiClient::getRequestHandler()`
12+
* `DocumentApiClient::getRequestHandler()`
13+
* `StateApiClient::getRequestHandler()`
14+
* `StatementsApiClient::getRequestHandler()`
15+
* `XApiClient::getRequestHandler()`
16+
17+
* Removed the `getVersion()` method from the API interfaces:
18+
19+
* `ActivityProfileApiClientInterface::getVersion()`
20+
* `AgentProfileApiClientInterface::getVersion()`
21+
* `StateApiClientInterface::getVersion()`
22+
* `StatementsApiClientInterface::getVersion()`
23+
24+
* Removed the `getVersion()` method from the API classes:
25+
26+
* `ActivityProfileApiClient::getVersion()`
27+
* `AgentProfileApiClient::getVersion()`
28+
* `ApiClient::getVersion()`
29+
* `DocumentApiClient::getVersion()`
30+
* `StateApiClient::getVersion()`
31+
* `StatementsApiClient::getVersion()`
32+
* `XApiClient::getVersion()`
33+
34+
* Removed the `getUsername()` and `getPassword()` methods from the `HandlerInterface`
35+
and the `Handler` class.
36+
37+
* Removed the `getHttpClient()` method from the `Handler` class.
38+
39+
* Removed the `getSerializerRegistry()` method from the `XApiClient` class.
40+
741
* All classes are final now which means that you can now longer extend them.
842
Consider using composition/decoration instead if you need to build functionality
943
on top of the built-in classes.

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"php-xapi/serializer": "^0.3.0"
2020
},
2121
"require-dev": {
22+
"phpspec/phpspec": "^2.3",
2223
"php-xapi/test-fixtures": "^0.5.0"
2324
},
2425
"conflict": {
@@ -31,6 +32,7 @@
3132
},
3233
"autoload-dev": {
3334
"psr-4": {
35+
"spec\\Xabbuh\\XApi\\Client\\": "spec/",
3436
"Xabbuh\\XApi\\Client\\Tests\\": "tests/"
3537
}
3638
},

phpspec.yml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
suites:
2+
default:
3+
namespace: Xabbuh\XApi\Client
4+
psr4_prefix: Xabbuh\XApi\Client

spec/XApiClientBuilderSpec.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace spec\Xabbuh\XApi\Client;
4+
5+
use PhpSpec\ObjectBehavior;
6+
7+
class XApiClientBuilderSpec extends ObjectBehavior
8+
{
9+
function it_is_an_xapi_client_builder()
10+
{
11+
$this->shouldHaveType('Xabbuh\XApi\Client\XApiClientBuilderInterface');
12+
}
13+
14+
function it_creates_an_xapi_client()
15+
{
16+
$this->build()->shouldHaveType('Xabbuh\XApi\Client\XApiClientInterface');
17+
}
18+
}

src/Api/ActivityProfileApiClientInterface.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@
2222
*/
2323
interface ActivityProfileApiClientInterface
2424
{
25-
/**
26-
* Returns the xAPI version.
27-
*
28-
* @return string The xAPI version
29-
*/
30-
public function getVersion();
31-
3225
/**
3326
* Stores a document for an activity profile. Updates an existing document
3427
* for this activity profile if one exists.

src/Api/AgentProfileApiClientInterface.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@
2222
*/
2323
interface AgentProfileApiClientInterface
2424
{
25-
/**
26-
* Returns the xAPI version.
27-
*
28-
* @return string The xAPI version
29-
*/
30-
public function getVersion();
31-
3225
/**
3326
* Stores a document for an agent profile. Updates an existing document for
3427
* this agent profile if one exists.

src/Api/ApiClient.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,4 @@ public function __construct(HandlerInterface $requestHandler, $version)
3333
$this->requestHandler = $requestHandler;
3434
$this->version = $version;
3535
}
36-
37-
public function getRequestHandler()
38-
{
39-
return $this->requestHandler;
40-
}
41-
42-
public function getVersion()
43-
{
44-
return $this->version;
45-
}
4636
}

src/Api/StateApiClientInterface.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121
*/
2222
interface StateApiClientInterface
2323
{
24-
/**
25-
* Returns the xAPI version.
26-
*
27-
* @return string The xAPI version
28-
*/
29-
public function getVersion();
30-
3124
/**
3225
* Stores a document for a state. Updates an existing document for this
3326
* state if one exists.

0 commit comments

Comments
 (0)