Skip to content
This repository has been archived by the owner on Dec 27, 2019. It is now read-only.

Commit

Permalink
Small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
endroid committed Jun 25, 2015
1 parent 3d073d9 commit 515705d
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 56 deletions.
3 changes: 2 additions & 1 deletion .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
bin/
vendor/
composer.lock
composer.phar
phpunit.xml

.idea/
.idea/
7 changes: 0 additions & 7 deletions .scrutinizer.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ before_script:
- wget -nc http://getcomposer.org/composer.phar
- php composer.phar install --dev

script: phpunit -c phpunit.xml.dist
script: bin/phpunit -c phpunit.xml.dist

notifications:
email:
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 Jeroen van den Enden
Copyright (c) Jeroen van den Enden

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Endroid PredictionIO
====================
PredictionIO
============

*By [endroid](http://endroid.nl/)*

Expand All @@ -8,7 +8,7 @@ Endroid PredictionIO
[![Total Downloads](http://img.shields.io/packagist/dt/endroid/prediction-io.svg)](https://packagist.org/packages/endroid/prediction-io)
[![License](http://img.shields.io/packagist/l/endroid/prediction-io.svg)](https://packagist.org/packages/endroid/prediction-io)

The Endroid PredictionIO library provides a client which offers easy access to a PredictionIO recommendation engine.
The PredictionIO library provides a client which offers easy access to a PredictionIO recommendation engine.
PredictionIO is an open source machine learning server for software developers to create predictive features, such as
personalization, recommendation and content discovery.

Expand Down
9 changes: 8 additions & 1 deletion composer.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@
"php": ">=5.4.0",
"predictionio/predictionio": "~0.8"
},
"require-dev": {
"fabpot/php-cs-fixer": "~1.9",
"phpunit/phpunit": "~4.7"
},
"autoload": {
"psr-4": {
"Endroid\\": "src/Endroid/"
"Endroid\\PredictionIO\\": [ "src/", "tests/" ]
}
},
"config": {
"bin-dir": "bin"
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
Expand Down
12 changes: 3 additions & 9 deletions phpunit.xml.dist
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="./vendor/autoload.php" colors="true">
<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="PredictionIO Test Suite">
<directory suffix="Test.php">./tests/Endroid/</directory>
<testsuite>
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/Endroid/</directory>
</whitelist>
</filter>
</phpunit>
File renamed without changes.
49 changes: 19 additions & 30 deletions src/Endroid/PredictionIO/EventClient.php → src/EventClient.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,34 @@

namespace Endroid\PredictionIO;

use DateTime;
use predictionio\EventClient as BaseEventClient;
use Endroid\PredictionIO\Model\CustomEvent;
use Endroid\PredictionIO\Model\EntityEvent;

class EventClient extends BaseEventClient
{
/**
* @param string Access Key
* @param string Base URL to the Event Server.
* @param float Timeout of the request in seconds. Use 0 to wait indefinitely
* @param float Number of seconds to wait while trying to connect to a server.
* @param string $accessKey Key
* @param string $baseUrl URL to the Event Server.
* @param float $timeout Timeout of the request in seconds. Use 0 to wait indefinitely
* @param float $connectTimeout Number of seconds to wait while trying to connect to a server.
*/
public function __construct($accessKey, $baseUrl, $timeout, $connectTimeout)
{
parent::__construct($accessKey, $baseUrl, $timeout, $connectTimeout);
}

/**
* @param string $event
* @param string $entityType
* @param string $entityId
* @param array $properties
* @param null | \DateTime $eventTime
* @param string $event
* @param string $entityType
* @param string $entityId
* @param array $properties
* @param null|DateTime $eventTime
*
* @return string JSON response
*/
public function createEntityEvent(
$event,
$entityType,
$entityId,
array $properties = [],
\DateTime $eventTime = null)
public function createEntityEvent($event, $entityType, $entityId, array $properties = [], DateTime $eventTime = null)
{
$event = new EntityEvent($event, $entityType, $entityId);
$event->setProperties($properties);
Expand All @@ -51,24 +47,17 @@ public function createEntityEvent(
}

/**
* @param string $event
* @param string $entityType
* @param string $entityId
* @param string $targetEntityType
* @param string $targetEntityId
* @param array $properties
* @param null|\DateTime $eventTime
* @param string $event
* @param string $entityType
* @param string $entityId
* @param string $targetEntityType
* @param string $targetEntityId
* @param array $properties
* @param null|DateTime $eventTime
*
* @return string JSON response
*/
public function createCustomEvent(
$event,
$entityType,
$entityId,
$targetEntityType,
$targetEntityId,
array $properties = [],
\DateTime $eventTime = null)
public function createCustomEvent($event, $entityType, $entityId, $targetEntityType, $targetEntityId, array $properties = [], DateTime $eventTime = null)
{
$event = new CustomEvent($event, $entityType, $entityId);
$event->setProperties($properties);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions ...Endroid/Tests/PredictionIO/ClientTest.php → tests/ClientTest.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
* with this source code in the file LICENSE.
*/

namespace Endroid\Tests\PredictionIO;
namespace Endroid\PredictionIO;

class ClientTest extends \PHPUnit_Framework_TestCase
use PHPUnit_Framework_TestCase;

class ClientTest extends PHPUnit_Framework_TestCase
{
public function testNoTestsYet()
{
Expand Down

0 comments on commit 515705d

Please sign in to comment.