-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
82 changed files
with
3,018 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
25
src/Tidal/WampWatch/Contract/Event/EventEmitterInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
51 changes: 51 additions & 0 deletions
51
src/Tidal/WampWatch/Model/Behavior/Property/HasCollectionsTrait.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
25
src/Tidal/WampWatch/Model/Contract/ConnectionInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ | ||
} |
38 changes: 38 additions & 0 deletions
38
src/Tidal/WampWatch/Model/Contract/Property/Collection/HasProceduresInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
33 changes: 33 additions & 0 deletions
33
src/Tidal/WampWatch/Model/Contract/Property/Collection/HasTopicsInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
64 changes: 64 additions & 0 deletions
64
src/Tidal/WampWatch/Model/Contract/Property/CollectionInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
Oops, something went wrong.