Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
tidal committed Oct 2, 2016
2 parents 26e625f + 40f3d28 commit 88c6027
Show file tree
Hide file tree
Showing 82 changed files with 3,018 additions and 62 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

### [0.6.0] - 2016-10-02

* added basic meta model

### [0.5.3] - 2016-10-02

* fixed subscription monitor integration test
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
"codacy/coverage": "dev-master"
},
"autoload": {
"psr-0": {
"Tidal\\WampWatch": "src/"
"psr-4": {
"Tidal\\WampWatch\\Test\\Unit\\": "tests/unit",
"Tidal\\WampWatch\\Test\\Integration\\": "tests/integration",
"Tidal\\WampWatch\\": "src/Tidal/WampWatch"
}
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/Tidal/WampWatch/Behavior/Event/ObservableTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/*
* This file is part of the Tidal/WampWatch package.
* (c) 2016 Timo Michna <timomichna/yahoo.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace Tidal\WampWatch\Behavior\Event;

trait ObservableTrait
{
}
37 changes: 37 additions & 0 deletions src/Tidal/WampWatch/Contract/Async/PromiseInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/*
* This file is part of the Tidal/WampWatch package.
* (c) 2016 Timo Michna <timomichna/yahoo.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace Tidal\WampWatch\Contract\Async;

interface PromiseInterface
{
/**
* @return PromiseInterface
*/
public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null);

public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null);

/**
* @return PromiseInterface
*/
public function otherwise(callable $onRejected);

/**
* @return PromiseInterface
*/
public function always(callable $onFulfilledOrRejected);

/**
* @return PromiseInterface
*/
public function progress(callable $onProgress);
}
25 changes: 25 additions & 0 deletions src/Tidal/WampWatch/Contract/Event/EventEmitterInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

/*
* This file is part of the Tidal/WampWatch package.
* (c) 2016 Timo Michna <timomichna/yahoo.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace Tidal\WampWatch\Contract\Event;

interface EventEmitterInterface
{
/**
* Registers a subscriber to be notified on given event.
*
* @param string $eventName the event to subscribe to
* @param callable $callback the callback to notify the subscriber
*
* @return mixed
*/
public function on($eventName, callable $callback);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

/*
* This file is part of the Tidal/WampWatch package.
* (c) 2016 Timo Michna <timomichna/yahoo.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace Tidal\WampWatch\Model\Behavior\Property;

use InvalidArgumentException;
use Tidal\WampWatch\Model\Contract\Property\CollectionInterface;

trait HasCollectionsTrait
{
private function initCollection($name, CollectionInterface $collection)
{
if (property_exists($this, $name)) {
$this->{$name} = $collection;
}
}

private function appendTo($name, $value)
{
$this->getCollection($name)->append($value);
}

/**
* @param string $name the name of the collection
*
* @throws InvalidArgumentException when the collection has not been initialized before
*
* @return CollectionInterface the collection object
*/
private function getCollection($name)
{
if (!$this->hasCollection($name)) {
throw new InvalidArgumentException("No Collection with name '$name' registered.");
}

return $this->{$name};
}

private function hasCollection($name)
{
return property_exists($this, $name) && is_a($this->{$name}, CollectionInterface::class);
}
}
37 changes: 37 additions & 0 deletions src/Tidal/WampWatch/Model/Connection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/*
* This file is part of the Tidal/WampWatch package.
* (c) 2016 Timo Michna <timomichna/yahoo.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace Tidal\WampWatch\Model;

use Tidal\WampWatch\Model\Property\Object\HasRouterTrait;
use Tidal\WampWatch\Model\Property\Object\HasRealmTrait;
use Tidal\WampWatch\Model\Property\Object\HasSessionTrait;

class Connection implements Contract\ConnectionInterface
{
use HasRouterTrait;
use HasRealmTrait;
use HasSessionTrait;

public function __construct(Contract\RouterInterface $router, Contract\RealmInterface $realm, Contract\SessionInterface $session = null)
{
$this->setRouter($router);
$this->setRealm($realm);
if ($session !== null) {
$this->confirm($session);
}
}

public function confirm(Contract\SessionInterface $session)
{
$this->setSession($session);
}
}
25 changes: 25 additions & 0 deletions src/Tidal/WampWatch/Model/Contract/ConnectionInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

/*
* This file is part of the Tidal/WampWatch package.
* (c) 2016 Timo Michna <timomichna/yahoo.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace Tidal\WampWatch\Model\Contract;

interface ConnectionInterface
{
/**
* @return RouterInterface
*/
public function getRouter();

/**
* @return RealmInterface
*/
public function getRealm();
}
18 changes: 18 additions & 0 deletions src/Tidal/WampWatch/Model/Contract/ProcedureInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

/*
* This file is part of the Tidal/WampWatch package.
* (c) 2016 Timo Michna <timomichna/yahoo.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace Tidal\WampWatch\Model\Contract;

use Tidal\WampWatch\Model\Contract\Property\Scalar\HasUriInterface;

interface ProcedureInterface extends HasUriInterface
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/*
* This file is part of the Tidal/WampWatch package.
* (c) 2016 Timo Michna <timomichna/yahoo.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace Tidal\WampWatch\Model\Contract\Property\Collection;

use Tidal\WampWatch\Model\Contract;

interface HasProceduresInterface
{
public function addProcedure(Contract\ProcedureInterface $procedure);

/**
* @param string $uri
*
* @return mixed
*/
public function hasProcedure($uri);

/**
* @param string $uri
*
* @return Contract\ProcedureInterface
*/
public function getProcedure($uri);

/**
* @return \Generator
*/
public function listProcedures();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/*
* This file is part of the Tidal/WampWatch package.
* (c) 2016 Timo Michna <timomichna/yahoo.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace Tidal\WampWatch\Model\Contract\Property\Collection;

use Tidal\WampWatch\Model\Contract;

interface HasTopicsInterface
{
public function addTopic(Contract\TopicInterface $topic);

public function hasTopic($uri);

/**
* @param string $uri
*
* @return Contract\TopicInterface
*/
public function getTopic($uri);

/**
* @return \Generator
*/
public function listTopics();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

/*
* This file is part of the Tidal/WampWatch package.
* (c) 2016 Timo Michna <timomichna/yahoo.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace Tidal\WampWatch\Model\Contract\Property;

use IteratorAggregate;
use ArrayAccess;
use Serializable;
use Countable;

interface CollectionInterface extends IteratorAggregate, ArrayAccess, Serializable, Countable
{
/**
* Sets a property type constrain for collection items.
*
* @param $type
*/
public function setItemType($type);

/**
* Registers a callback function to validate new Collection entries.
* The callback function must return a boolean value.
*
*
* @param callable $callback
*/
public function setValidationCallback(callable $callback);

/**
* If the collection has an item with the given key.
*
* @param string $key the name of the key
*
* @return bool
*/
public function has($key);

/**
* set an item with the given key.
*
* @param string $key the name of the key
* @param mixed $value the item to add
*
* @return mixed
*/
public function set($key, $value);

/**
* Retrieves an item with the given key.
*
* @param string $key the name of the key
*
* @return mixed
*/
public function get($key);
}
Loading

0 comments on commit 88c6027

Please sign in to comment.