mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
update namespace
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
namespace Flasher\Laravel\ServiceProvider\Providers;
|
||||
|
||||
use Flasher\Laravel\Config\Config;
|
||||
use Flasher\Laravel\NotifyServiceProvider;
|
||||
use Flasher\LaravelFlasher\PrimeServiceProvider;
|
||||
use Flasher\Laravel\Storage\Storage;
|
||||
use Flasher\Prime\Filter\DefaultFilter;
|
||||
use Flasher\Prime\Filter\FilterBuilder;
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Flasher\Laravel\ServiceProvider\Providers;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Flasher\Laravel\Config\Config;
|
||||
use Flasher\Laravel\NotifyServiceProvider;
|
||||
use Flasher\LaravelFlasher\PrimeServiceProvider;
|
||||
use Flasher\Prime\Middleware\MiddlewareManager;
|
||||
|
||||
final class Laravel4 extends Laravel
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Flasher\Laravel\ServiceProvider\Providers;
|
||||
|
||||
use Laravel\Lumen\Application;
|
||||
use Flasher\Laravel\NotifyServiceProvider;
|
||||
use Flasher\LaravelFlasher\PrimeServiceProvider;
|
||||
|
||||
final class Lumen extends Laravel
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Flasher\Laravel\ServiceProvider\Providers;
|
||||
|
||||
use Flasher\Laravel\NotifyServiceProvider;
|
||||
use Flasher\LaravelFlasher\PrimeServiceProvider;
|
||||
|
||||
interface ServiceProviderInterface
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Flasher\Laravel\ServiceProvider;
|
||||
|
||||
use Flasher\Laravel\NotifyServiceProvider;
|
||||
use Flasher\LaravelFlasher\PrimeServiceProvider;
|
||||
use Flasher\Laravel\ServiceProvider\Providers\ServiceProviderInterface;
|
||||
|
||||
final class ServiceProviderManager
|
||||
|
||||
@@ -14,7 +14,7 @@ class TestCase extends Orchestra
|
||||
protected function getPackageProviders($app = null)
|
||||
{
|
||||
return array(
|
||||
'Flasher\Laravel\NotifyServiceProvider',
|
||||
'Flasher\LaravelFlasher\PrimeServiceProvider',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Flasher\\Laravel\\NotifyServiceProvider"
|
||||
"Flasher\\Laravel\Flasher\PrimeServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Flasher": "Flasher\\Laravel\\Facades\\Flasher"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Flasher\Notyf\Laravel\ServiceProvider\Providers;
|
||||
|
||||
use Flasher\Notyf\Laravel\NotifyNotyfServiceProvider;
|
||||
use Flasher\Notyf\LaravelFlasher\PrimeNotyfServiceProvider;
|
||||
use Flasher\Notyf\Prime\Producer\NotyfProducer;
|
||||
use Flasher\Notyf\Prime\Renderer\NotyfRenderer;
|
||||
use Flasher\Prime\Flasher;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Flasher\Notyf\Laravel\ServiceProvider\Providers;
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Flasher\Notyf\Laravel\NotifyNotyfServiceProvider;
|
||||
use Flasher\Notyf\LaravelFlasher\PrimeNotyfServiceProvider;
|
||||
|
||||
final class Laravel4 extends Laravel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Flasher\Notyf\Laravel\ServiceProvider\Providers;
|
||||
|
||||
use Laravel\Lumen\Application;
|
||||
use Flasher\Notyf\Laravel\NotifyNotyfServiceProvider;
|
||||
use Flasher\Notyf\LaravelFlasher\PrimeNotyfServiceProvider;
|
||||
|
||||
final class Lumen extends Laravel
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Flasher\Notyf\Laravel\ServiceProvider\Providers;
|
||||
|
||||
use Flasher\Notyf\Laravel\NotifyNotyfServiceProvider;
|
||||
use Flasher\Notyf\LaravelFlasher\PrimeNotyfServiceProvider;
|
||||
|
||||
interface ServiceProviderInterface
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Flasher\Notyf\Laravel\ServiceProvider;
|
||||
|
||||
use Flasher\Notyf\Laravel\NotifyNotyfServiceProvider;
|
||||
use Flasher\Notyf\LaravelFlasher\PrimeNotyfServiceProvider;
|
||||
use Flasher\Notyf\Laravel\ServiceProvider\Providers\ServiceProviderInterface;
|
||||
|
||||
final class ServiceProviderManager
|
||||
|
||||
@@ -19,8 +19,8 @@ class TestCase extends Orchestra
|
||||
protected function getPackageProviders($app = null)
|
||||
{
|
||||
return array(
|
||||
'Flasher\Laravel\NotifyServiceProvider',
|
||||
'Flasher\Notyf\Laravel\NotifyNotyfServiceProvider',
|
||||
'Flasher\LaravelFlasher\PrimeServiceProvider',
|
||||
'Flasher\Notyf\LaravelFlasher\PrimeNotyfServiceProvider',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Flasher\\Laravel\\Notyf\\NotifyNotyfServiceProvider"
|
||||
"Flasher\\Laravel\\Notyf\Flasher\PrimeNotyfServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -30,7 +30,7 @@ final class NotifyNotyfExtension extends Extension implements PrependExtensionIn
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasExtension('notify')) {
|
||||
throw new \RuntimeException('[Flasher\Symfony\NotifyBundle] is not registered');
|
||||
throw new \RuntimeException('[Flasher\SymfonyFlasher\PrimeBundle] is not registered');
|
||||
}
|
||||
|
||||
$configs = $container->getExtensionConfig($this->getAlias());
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Flasher\Pnotify\Laravel\ServiceProvider\Providers;
|
||||
|
||||
use Flasher\Pnotify\Laravel\NotifyPnotifyServiceProvider;
|
||||
use Flasher\Pnotify\LaravelFlasher\PrimePnotifyServiceProvider;
|
||||
use Flasher\PFlasher\Prime\TestsProducer\PnotifyProducer;
|
||||
use Flasher\PFlasher\Prime\TestsRenderer\PnotifyRenderer;
|
||||
use Flasher\PFlasher\Prime\Renderer\PnotifyRenderer;
|
||||
use Flasher\Prime\Flasher;
|
||||
use Flasher\Prime\Renderer\RendererManager;
|
||||
use Illuminate\Container\Container;
|
||||
@@ -44,7 +44,7 @@ class Laravel implements ServiceProviderInterface
|
||||
});
|
||||
|
||||
$this->app->alias('notify.producer.pnotify', 'Flasher\PFlasher\Prime\TestsProducer\PnotifyProducer');
|
||||
$this->app->alias('notify.renderer.pnotify', 'Flasher\PFlasher\Prime\TestsRenderer\PnotifyRenderer');
|
||||
$this->app->alias('notify.renderer.pnotify', 'Flasher\PFlasher\Prime\Renderer\PnotifyRenderer');
|
||||
|
||||
$this->app->extend('notify.producer', function (Flasher $manager, Container $app) {
|
||||
$manager->addDriver('pnotify', $app['notify.producer.pnotify']);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Flasher\Pnotify\Laravel\ServiceProvider\Providers;
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Flasher\Pnotify\Laravel\NotifyPnotifyServiceProvider;
|
||||
use Flasher\Pnotify\LaravelFlasher\PrimePnotifyServiceProvider;
|
||||
|
||||
final class Laravel4 extends Laravel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Flasher\Pnotify\Laravel\ServiceProvider\Providers;
|
||||
|
||||
use Laravel\Lumen\Application;
|
||||
use Flasher\Pnotify\Laravel\NotifyPnotifyServiceProvider;
|
||||
use Flasher\Pnotify\LaravelFlasher\PrimePnotifyServiceProvider;
|
||||
|
||||
final class Lumen extends Laravel
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Flasher\Pnotify\Laravel\ServiceProvider\Providers;
|
||||
|
||||
use Flasher\Pnotify\Laravel\NotifyPnotifyServiceProvider;
|
||||
use Flasher\Pnotify\LaravelFlasher\PrimePnotifyServiceProvider;
|
||||
|
||||
interface ServiceProviderInterface
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Flasher\Pnotify\Laravel\ServiceProvider;
|
||||
|
||||
use Flasher\Pnotify\Laravel\NotifyPnotifyServiceProvider;
|
||||
use Flasher\Pnotify\LaravelFlasher\PrimePnotifyServiceProvider;
|
||||
use Flasher\Pnotify\Laravel\ServiceProvider\Providers\ServiceProviderInterface;
|
||||
|
||||
final class ServiceProviderManager
|
||||
|
||||
@@ -19,8 +19,8 @@ class TestCase extends Orchestra
|
||||
protected function getPackageProviders($app = null)
|
||||
{
|
||||
return array(
|
||||
'Flasher\Laravel\NotifyServiceProvider',
|
||||
'Flasher\Pnotify\Laravel\NotifyPnotifyServiceProvider',
|
||||
'Flasher\LaravelFlasher\PrimeServiceProvider',
|
||||
'Flasher\Pnotify\LaravelFlasher\PrimePnotifyServiceProvider',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Flasher\\Laravel\\Pnotify\\NotifyPnotifyServiceProvider"
|
||||
"Flasher\\Laravel\\Pnotify\Flasher\PrimePnotifyServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\PFlasher\Prime\TestsRenderer;
|
||||
namespace Flasher\PFlasher\Prime\Renderer;
|
||||
|
||||
use Flasher\Prime\Config\ConfigInterface;
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
@@ -30,7 +30,7 @@ final class NotifyPnotifyExtension extends Extension implements PrependExtension
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasExtension('notify')) {
|
||||
throw new \RuntimeException('[Flasher\Symfony\NotifyBundle] is not registered');
|
||||
throw new \RuntimeException('[Flasher\SymfonyFlasher\PrimeBundle] is not registered');
|
||||
}
|
||||
|
||||
$configs = $container->getExtensionConfig($this->getAlias());
|
||||
|
||||
@@ -6,11 +6,11 @@ services:
|
||||
- { name: 'notify.producer', alias: 'pnotify' }
|
||||
|
||||
notify.renderer.pnotify:
|
||||
class: Flasher\PFlasher\Prime\TestsRenderer\PnotifyRenderer
|
||||
class: Flasher\PFlasher\Prime\Renderer\PnotifyRenderer
|
||||
arguments:
|
||||
- '@notify.config'
|
||||
tags:
|
||||
- { name: 'notify.renderer', alias: 'pnotify' }
|
||||
|
||||
Flasher\PFlasher\Prime\TestsProducer\PnotifyProducer: '@notify.producer.pnotify'
|
||||
Flasher\PFlasher\Prime\TestsRenderer\PnotifyRenderer: '@notify.renderer.pnotify'
|
||||
Flasher\PFlasher\Prime\Renderer\PnotifyRenderer: '@notify.renderer.pnotify'
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher\Event;
|
||||
|
||||
final class AfterFilter
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher\Event;
|
||||
|
||||
class AfterNotificationDispatched
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher\Event;
|
||||
|
||||
class AfterNotificationRendered
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher\Event;
|
||||
|
||||
class BeforeFilter
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher\Event;
|
||||
|
||||
class BeforeNotificationDispatched
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher\Event;
|
||||
|
||||
class BeforeNotificationRendered
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher\Event;
|
||||
|
||||
interface EventInterface
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher\Event;
|
||||
|
||||
class NotificationDispatched implements EventInterface
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher\Event;
|
||||
|
||||
class NotificationRendered implements EventInterface
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher\Event;
|
||||
|
||||
class PresenterReady implements EventInterface
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher;
|
||||
|
||||
use Flasher\Prime\Dispatcher\Event\EventInterface;
|
||||
use Flasher\Prime\Dispatcher\Listener\ListenerInterface;
|
||||
|
||||
final class EventDispatcher implements EventDispatcherInterface
|
||||
{
|
||||
private $listeners = array();
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function addListener($eventName, ListenerInterface $listener)
|
||||
{
|
||||
$this->listeners[$eventName][] = $listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function dispatch(EventInterface $event, $eventName = null)
|
||||
{
|
||||
$eventName = $eventName ?: get_class($event);
|
||||
|
||||
$listeners = $this->getListeners($eventName);
|
||||
|
||||
$this->callListeners($listeners, $event);
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $eventName
|
||||
*
|
||||
* @return ListenerInterface[]
|
||||
*/
|
||||
public function getListeners($eventName)
|
||||
{
|
||||
if (empty($this->listeners[$eventName])) {
|
||||
return array();
|
||||
}
|
||||
|
||||
return $this->listeners[$eventName];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ListenerInterface[] $listeners
|
||||
* @param EventInterface $event
|
||||
*/
|
||||
protected function callListeners(array $listeners, $event)
|
||||
{
|
||||
foreach ($listeners as $listener) {
|
||||
$listener->handle($event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher;
|
||||
|
||||
use Flasher\Prime\Dispatcher\Event\EventInterface;
|
||||
use Flasher\Prime\Dispatcher\Listener\ListenerInterface;
|
||||
|
||||
interface EventDispatcherInterface
|
||||
{
|
||||
/**
|
||||
* @param string $eventName
|
||||
* @param ListenerInterface $listener
|
||||
*/
|
||||
public function addListener($eventName, ListenerInterface $listener);
|
||||
|
||||
/**
|
||||
* @param EventInterface $event
|
||||
* @param string|null $eventName
|
||||
*
|
||||
* @return EventInterface
|
||||
*/
|
||||
public function dispatch(EventInterface $event, $eventName = null);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher;
|
||||
|
||||
final class FlusherEvents
|
||||
{
|
||||
const NOTIFICATION_CREATED = 'flusher.notification.created';
|
||||
|
||||
const NOTIFICATION_RENDERED = 'flusher.notification.rendered';
|
||||
|
||||
const NOTIFICATION_CLEARED = 'flusher.notification.cleared';
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher\Listener;
|
||||
|
||||
use Flasher\Prime\Dispatcher\Event\EventInterface;
|
||||
|
||||
interface ListenerInterface
|
||||
{
|
||||
public function handle(EventInterface $event);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Dispatcher\Listener;
|
||||
|
||||
interface SubscriberInterface
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Notify;
|
||||
namespace Flasher\Prime;
|
||||
|
||||
use Flasher\Prime\TestsNotification\NotificationInterface;
|
||||
use Flasher\Prime\TestsStamp\StampInterface;
|
||||
use Flasher\Prime\Notification\NotificationInterface;
|
||||
use Flasher\Prime\Stamp\StampInterface;
|
||||
|
||||
final class Envelope
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime;
|
||||
namespace Flasher\Prime\Factory;
|
||||
|
||||
use Flasher\Prime\TestsNotification\Notification;
|
||||
use Flasher\Prime\TestsNotification\NotificationBuilder;
|
||||
use Flasher\Prime\TestsNotification\NotificationBuilderInterface;
|
||||
use Flasher\Prime\TestsNotification\NotificationInterface;
|
||||
use Flasher\Prime\Notification\Notification;
|
||||
use Flasher\Prime\Notification\NotificationBuilder;
|
||||
use Flasher\Prime\Notification\NotificationBuilderInterface;
|
||||
use Flasher\Prime\Notification\NotificationInterface;
|
||||
|
||||
/**
|
||||
* @method NotificationBuilderInterface type($type, $message = null, array $options = array())
|
||||
@@ -19,7 +19,7 @@ use Flasher\Prime\TestsNotification\NotificationInterface;
|
||||
* @method NotificationBuilderInterface warning($message = null, array $options = array())
|
||||
* @method NotificationInterface getNotification()
|
||||
*/
|
||||
abstract class AbstractFlasher implements NotifyFactoryInterface
|
||||
abstract class AbstractFlasher implements FactoryInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Factory;
|
||||
|
||||
use Flasher\Prime\Notification\NotificationBuilderInterface;
|
||||
use Flasher\Prime\Notification\NotificationInterface;
|
||||
|
||||
interface FactoryInterface
|
||||
{
|
||||
/**
|
||||
* @return NotificationBuilderInterface
|
||||
*/
|
||||
public function createNotificationBuilder();
|
||||
|
||||
/**
|
||||
* @return NotificationInterface
|
||||
*/
|
||||
public function createNotification();
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $context
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function supports($name = null, array $context = array());
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsFilter;
|
||||
namespace Flasher\Prime\Filter;
|
||||
|
||||
use Flasher\Prime\TestsFilter\Specification\LifeSpecification;
|
||||
use Flasher\Prime\TestsFilter\Specification\PrioritySpecification;
|
||||
use Flasher\Prime\Filter\Specification\ReplaySpecification;
|
||||
use Flasher\Prime\Filter\Specification\PrioritySpecification;
|
||||
|
||||
final class CriteriaBuilder
|
||||
{
|
||||
/**
|
||||
* @var \Flasher\Prime\TestsFilter\FilterBuilder
|
||||
* @var \Flasher\Prime\Filter\FilterBuilder
|
||||
*/
|
||||
private $filterBuilder;
|
||||
|
||||
@@ -66,7 +66,7 @@ final class CriteriaBuilder
|
||||
$min = isset($life['min']) ? $life['min'] : null;
|
||||
$max = isset($life['max']) ? $life['max'] : null;
|
||||
|
||||
$this->filterBuilder->andWhere(new LifeSpecification($min, $max));
|
||||
$this->filterBuilder->andWhere(new ReplaySpecification($min, $max));
|
||||
}
|
||||
|
||||
public function buildLimit()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsFilter;
|
||||
namespace Flasher\Prime\Filter;
|
||||
|
||||
final class DefaultFilter implements FilterInterface
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsFilter;
|
||||
namespace Flasher\Prime\Filter;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\TestsFilter\Specification\AndSpecification;
|
||||
use Flasher\Prime\TestsFilter\Specification\OrSpecification;
|
||||
use Flasher\Prime\TestsFilter\Specification\SpecificationInterface;
|
||||
use Flasher\Prime\TestsStamp\OrderableStampInterface;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Filter\Specification\AndSpecification;
|
||||
use Flasher\Prime\Filter\Specification\OrSpecification;
|
||||
use Flasher\Prime\Filter\Specification\SpecificationInterface;
|
||||
use Flasher\Prime\Stamp\OrderableStampInterface;
|
||||
|
||||
final class FilterBuilder
|
||||
{
|
||||
@@ -14,7 +14,7 @@ final class FilterBuilder
|
||||
const DESC = 'DESC';
|
||||
|
||||
/**
|
||||
* @var \Flasher\Prime\TestsFilter\Specification\SpecificationInterface
|
||||
* @var SpecificationInterface
|
||||
*/
|
||||
private $specification;
|
||||
|
||||
@@ -103,7 +103,7 @@ final class FilterBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Flasher\Prime\TestsFilter\Specification\SpecificationInterface
|
||||
* @return SpecificationInterface
|
||||
*/
|
||||
public function getSpecification()
|
||||
{
|
||||
@@ -131,7 +131,7 @@ final class FilterBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Flasher\Prime\TestsFilter\Specification\SpecificationInterface $specification
|
||||
* @param SpecificationInterface $specification
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -147,7 +147,7 @@ final class FilterBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Flasher\Prime\TestsFilter\Specification\SpecificationInterface $specification
|
||||
* @param SpecificationInterface $specification
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -159,7 +159,7 @@ final class FilterBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Flasher\Prime\TestsFilter\Specification\SpecificationInterface $specification
|
||||
* @param SpecificationInterface $specification
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -173,4 +173,14 @@ final class FilterBuilder
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function whereType()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function wherePriority()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsFilter;
|
||||
namespace Flasher\Prime\Filter;
|
||||
|
||||
interface FilterInterface
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsFilter;
|
||||
namespace Flasher\Prime\Filter;
|
||||
|
||||
use Flasher\Prime\TestsManager\AbstractManager;
|
||||
use Flasher\Prime\Manager\AbstractManager;
|
||||
|
||||
/**
|
||||
* @method \Flasher\Prime\TestsFilter\FilterInterface make($driver = null)
|
||||
* @method \Flasher\Prime\Filter\FilterInterface make($driver = null)
|
||||
*/
|
||||
final class FilterManager extends AbstractManager
|
||||
{
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsFilter\Specification;
|
||||
namespace Flasher\Prime\Filter\Specification;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
final class AndSpecification implements SpecificationInterface
|
||||
{
|
||||
/**
|
||||
* @var \Flasher\Prime\TestsFilter\Specification\SpecificationInterface[]
|
||||
* @var SpecificationInterface[]
|
||||
*/
|
||||
private $specifications;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsFilter\Specification;
|
||||
namespace Flasher\Prime\Filter\Specification;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
final class NotSpecification implements SpecificationInterface
|
||||
{
|
||||
/**
|
||||
* @var \Flasher\Prime\TestsFilter\Specification\SpecificationInterface
|
||||
* @var SpecificationInterface
|
||||
*/
|
||||
private $specification;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsFilter\Specification;
|
||||
namespace Flasher\Prime\Filter\Specification;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
final class OrSpecification implements SpecificationInterface
|
||||
{
|
||||
/**
|
||||
* @var \Flasher\Prime\TestsFilter\Specification\SpecificationInterface[]
|
||||
* @var \Flasher\Prime\Filter\Specification\SpecificationInterface[]
|
||||
*/
|
||||
private $specifications;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsFilter\Specification;
|
||||
namespace Flasher\Prime\Filter\Specification;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
final class PrioritySpecification implements SpecificationInterface
|
||||
{
|
||||
@@ -23,13 +23,13 @@ final class PrioritySpecification implements SpecificationInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope $envelope
|
||||
* @param \Flasher\Prime\Envelope $envelope
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSatisfiedBy(Envelope $envelope)
|
||||
{
|
||||
$stamp = $envelope->get('Flasher\Prime\TestsStamp\PriorityStamp');
|
||||
$stamp = $envelope->get('Flasher\Prime\Stamp\PriorityStamp');
|
||||
|
||||
if (null === $stamp) {
|
||||
return false;
|
||||
|
||||
+7
-7
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsFilter\Specification;
|
||||
namespace Flasher\Prime\Filter\Specification;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
final class LifeSpecification implements SpecificationInterface
|
||||
final class ReplaySpecification implements SpecificationInterface
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
@@ -23,22 +23,22 @@ final class LifeSpecification implements SpecificationInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope $envelope
|
||||
* @param Envelope $envelope
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSatisfiedBy(Envelope $envelope)
|
||||
{
|
||||
$stamp = $envelope->get('Flasher\Prime\TestsStamp\ReplayStamp');
|
||||
$stamp = $envelope->get('Flasher\Prime\Stamp\HopsStamp');
|
||||
|
||||
if (null === $stamp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (null !== $this->maxLife && $stamp->getLife() > $this->maxLife) {
|
||||
if (null !== $this->maxLife && $stamp->getCount() > $this->maxLife) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $stamp->getLife() >= $this->minLife;
|
||||
return $stamp->getCount() >= $this->minLife;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsFilter\Specification;
|
||||
namespace Flasher\Prime\Filter\Specification;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
interface SpecificationInterface
|
||||
{
|
||||
/**
|
||||
* @param \Notify\Envelope $envelope
|
||||
* @param \Flasher\Prime\Envelope $envelope
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsFilter\Specification;
|
||||
namespace Flasher\Prime\Filter\Specification;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
final class TimeSpecification implements SpecificationInterface
|
||||
{
|
||||
@@ -23,13 +23,13 @@ final class TimeSpecification implements SpecificationInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope $envelope
|
||||
* @param \Flasher\Prime\Envelope $envelope
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSatisfiedBy(Envelope $envelope)
|
||||
{
|
||||
$stamp = $envelope->get('Flasher\Prime\TestsStamp\CreatedAtStamp');
|
||||
$stamp = $envelope->get('Flasher\Prime\Stamp\CreatedAtStamp');
|
||||
|
||||
if (null === $stamp) {
|
||||
return false;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Flasher\Prime;
|
||||
|
||||
use Flasher\Prime\Config\ConfigInterface;
|
||||
use Flasher\Prime\TestsNotification\NotificationBuilderInterface;
|
||||
use Flasher\Prime\TestsNotification\NotificationInterface;
|
||||
use Flasher\Prime\Manager\AbstractManager;
|
||||
use Flasher\Prime\Notification\NotificationBuilderInterface;
|
||||
use Flasher\Prime\Notification\NotificationInterface;
|
||||
|
||||
/**
|
||||
* @method NotificationBuilderInterface type($type, $message = null, array $options = array())
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsManager;
|
||||
namespace Flasher\Prime\Manager;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Notify\Config\ConfigInterface;
|
||||
use Flasher\Prime\Config\ConfigInterface;
|
||||
|
||||
abstract class AbstractManager
|
||||
{
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsMiddleware;
|
||||
namespace Flasher\Prime\Middleware;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\TestsStamp\CreatedAtStamp;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Stamp\CreatedAtStamp;
|
||||
|
||||
final class AddCreatedAtStampMiddleware implements MiddlewareInterface
|
||||
{
|
||||
public function handle(Envelope $envelope, callable $next)
|
||||
{
|
||||
if (null === $envelope->get('Flasher\Prime\TestsStamp\CreatedAtStamp')) {
|
||||
if (null === $envelope->get('Flasher\Prime\Stamp\CreatedAtStamp')) {
|
||||
$envelope->withStamp(new CreatedAtStamp());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\Middleware;
|
||||
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Stamp\HopsStamp;
|
||||
|
||||
final class AddHopsStampMiddleware implements MiddlewareInterface
|
||||
{
|
||||
public function handle(Envelope $envelope, callable $next)
|
||||
{
|
||||
if (null === $envelope->get('Flasher\Prime\Stamp\HopsStamp')) {
|
||||
$envelope->withStamp(new HopsStamp(1));
|
||||
}
|
||||
|
||||
return $next($envelope);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsMiddleware;
|
||||
namespace Flasher\Prime\Middleware;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\TestsStamp\PriorityStamp;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Stamp\PriorityStamp;
|
||||
|
||||
final class AddPriorityStampMiddleware implements MiddlewareInterface
|
||||
{
|
||||
public function handle(Envelope $envelope, callable $next)
|
||||
{
|
||||
if (null === $envelope->get('Flasher\Prime\TestsStamp\PriorityStamp')) {
|
||||
if (null === $envelope->get('Flasher\Prime\Stamp\PriorityStamp')) {
|
||||
$envelope->withStamp(new PriorityStamp(0));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsMiddleware;
|
||||
namespace Flasher\Prime\Middleware;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\TestsStamp\RenderedAtStamp;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Stamp\RenderedAtStamp;
|
||||
|
||||
final class AddRenderedAtStampMiddleware implements MiddlewareInterface
|
||||
{
|
||||
public function handle(Envelope $envelope, callable $next)
|
||||
{
|
||||
if (null === $envelope->get('Flasher\Prime\TestsStamp\RenderedAtStamp')) {
|
||||
if (null === $envelope->get('Flasher\Prime\Stamp\RenderedAtStamp')) {
|
||||
$envelope->withStamp(new RenderedAtStamp());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsMiddleware;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\TestsStamp\ReplayStamp;
|
||||
|
||||
final class AddReplayStampMiddleware implements MiddlewareInterface
|
||||
{
|
||||
public function handle(Envelope $envelope, callable $next)
|
||||
{
|
||||
if (null === $envelope->get('Flasher\Prime\TestsStamp\ReplayStamp')) {
|
||||
$envelope->withStamp(new ReplayStamp(1));
|
||||
}
|
||||
|
||||
return $next($envelope);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsMiddleware;
|
||||
namespace Flasher\Prime\Middleware;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
interface MiddlewareInterface
|
||||
{
|
||||
/**
|
||||
* @param \Notify\Envelope $envelope
|
||||
* @param Envelope $envelope
|
||||
* @param callable $next
|
||||
*
|
||||
* @return \Notify\Envelope
|
||||
* @return Envelope
|
||||
*/
|
||||
public function handle(Envelope $envelope, callable $next);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsMiddleware;
|
||||
namespace Flasher\Prime\Middleware;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Notification\NotificationInterface;
|
||||
|
||||
final class NotifyBus
|
||||
{
|
||||
/**
|
||||
* @var \Flasher\Prime\TestsMiddleware\MiddlewareInterface[]
|
||||
* @var MiddlewareInterface[]
|
||||
*/
|
||||
private $middlewares;
|
||||
|
||||
/**
|
||||
* Executes the given command and optionally returns a value
|
||||
*
|
||||
* @param \Notify\Envelope|\Flasher\Prime\TestsNotification\NotificationInterface $envelope
|
||||
* @param array $stamps
|
||||
* @param Envelope|NotificationInterface $envelope
|
||||
* @param array $stamps
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -31,7 +32,7 @@ final class NotifyBus
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Flasher\Prime\TestsMiddleware\MiddlewareInterface $middleware
|
||||
* @param MiddlewareInterface $middleware
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsNotification;
|
||||
namespace Flasher\Prime\Notification;
|
||||
|
||||
class Notification implements NotificationInterface
|
||||
{
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsNotification;
|
||||
namespace Flasher\Prime\Notification;
|
||||
|
||||
class NotificationBuilder implements NotificationBuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var \Flasher\Prime\TestsNotification\NotificationInterface
|
||||
* @var NotificationInterface
|
||||
*/
|
||||
protected $notification;
|
||||
|
||||
/**
|
||||
* @param \Flasher\Prime\TestsNotification\NotificationInterface|null $notification
|
||||
* @param NotificationInterface|null $notification
|
||||
*/
|
||||
public function __construct(NotificationInterface $notification = null)
|
||||
{
|
||||
@@ -108,4 +108,19 @@ class NotificationBuilder implements NotificationBuilderInterface
|
||||
{
|
||||
return $this->type(NotificationInterface::TYPE_WARNING, $message, $options);
|
||||
}
|
||||
|
||||
public function priority($priority)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function hops()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function sticky()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsNotification;
|
||||
namespace Flasher\Prime\Notification;
|
||||
|
||||
interface NotificationBuilderInterface
|
||||
{
|
||||
@@ -9,14 +9,14 @@ interface NotificationBuilderInterface
|
||||
* @param string|null $message
|
||||
* @param array $options
|
||||
*
|
||||
* @return \Flasher\Prime\TestsNotification\NotificationBuilder
|
||||
* @return NotificationBuilder
|
||||
*/
|
||||
public function type($type, $message = null, array $options = array());
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
*
|
||||
* @return \Flasher\Prime\TestsNotification\NotificationBuilder
|
||||
* @return NotificationBuilder
|
||||
*/
|
||||
public function message($message);
|
||||
|
||||
@@ -24,7 +24,7 @@ interface NotificationBuilderInterface
|
||||
* @param array<string, mixed> $options
|
||||
* @param bool $merge
|
||||
*
|
||||
* @return \Flasher\Prime\TestsNotification\NotificationBuilder
|
||||
* @return NotificationBuilder
|
||||
*/
|
||||
public function options($options, $merge = true);
|
||||
|
||||
@@ -32,12 +32,12 @@ interface NotificationBuilderInterface
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return \Flasher\Prime\TestsNotification\NotificationBuilder
|
||||
* @return NotificationBuilder
|
||||
*/
|
||||
public function option($name, $value);
|
||||
|
||||
/**
|
||||
* @return \Flasher\Prime\TestsNotification\NotificationInterface
|
||||
* @return NotificationInterface
|
||||
*/
|
||||
public function getNotification();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsNotification;
|
||||
namespace Flasher\Prime\Notification;
|
||||
|
||||
interface NotificationInterface
|
||||
{
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsPresenter;
|
||||
namespace Flasher\Prime\Presenter;
|
||||
|
||||
use Notify\Config\ConfigInterface;
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\TestsFilter\FilterManager;
|
||||
use Flasher\Prime\TestsRenderer\HasOptionsInterface;
|
||||
use Flasher\Prime\TestsRenderer\HasScriptsInterface;
|
||||
use Flasher\Prime\TestsRenderer\HasStylesInterface;
|
||||
use Flasher\Prime\TestsRenderer\RendererManager;
|
||||
use Flasher\Prime\TestsStorage\StorageInterface;
|
||||
use Flasher\Prime\Config\ConfigInterface;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Filter\FilterManager;
|
||||
use Flasher\Prime\Renderer\HasOptionsInterface;
|
||||
use Flasher\Prime\Renderer\HasScriptsInterface;
|
||||
use Flasher\Prime\Renderer\HasStylesInterface;
|
||||
use Flasher\Prime\Renderer\RendererManager;
|
||||
use Flasher\Prime\Storage\StorageInterface;
|
||||
|
||||
abstract class AbstractPresenter implements PresenterInterface
|
||||
{
|
||||
/**
|
||||
* @var \Notify\Config\ConfigInterface
|
||||
* @var ConfigInterface
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var \Flasher\Prime\TestsStorage\StorageInterface
|
||||
* @var Flasher\Prime\Storage\StorageInterface
|
||||
*/
|
||||
protected $storage;
|
||||
|
||||
/**
|
||||
* @var \Flasher\Prime\TestsFilter\FilterManager
|
||||
* @var \Flasher\Prime\Filter\FilterManager
|
||||
*/
|
||||
protected $filterManager;
|
||||
|
||||
/**
|
||||
* @var \Flasher\Prime\TestsRenderer\RendererManager
|
||||
* @var \Flasher\Prime\Renderer\RendererManager
|
||||
*/
|
||||
protected $rendererManager;
|
||||
|
||||
/**
|
||||
* AbstractPresenter constructor.
|
||||
*
|
||||
* @param \Notify\Config\ConfigInterface $config
|
||||
* @param \Flasher\Prime\TestsStorage\StorageInterface $storage
|
||||
* @param \Flasher\Prime\TestsFilter\FilterManager $filterManager
|
||||
* @param \Flasher\Prime\TestsRenderer\RendererManager $rendererManager
|
||||
* @param Flasher\Prime\Config\ConfigInterface $config
|
||||
* @param \Flasher\Prime\Storage\StorageInterface $storage
|
||||
* @param \Flasher\Prime\Filter\FilterManager $filterManager
|
||||
* @param \Flasher\Prime\Renderer\RendererManager $rendererManager
|
||||
*/
|
||||
public function __construct(
|
||||
ConfigInterface $config,
|
||||
@@ -69,7 +69,7 @@ abstract class AbstractPresenter implements PresenterInterface
|
||||
return array_filter(
|
||||
$envelopes,
|
||||
static function (Envelope $envelope) {
|
||||
$lifeStamp = $envelope->get('Flasher\Prime\TestsStamp\ReplayStamp');
|
||||
$lifeStamp = $envelope->get('Flasher\Prime\Stamp\HopsStamp');
|
||||
|
||||
return $lifeStamp->getLife() > 0;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ abstract class AbstractPresenter implements PresenterInterface
|
||||
$renderers = array();
|
||||
|
||||
foreach ($envelopes as $envelope) {
|
||||
$rendererStamp = $envelope->get('Flasher\Prime\TestsStamp\HandlerStamp');
|
||||
$rendererStamp = $envelope->get('Flasher\Prime\Stamp\HandlerStamp');
|
||||
if (in_array($rendererStamp->getHandler(), $renderers)) {
|
||||
continue;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ abstract class AbstractPresenter implements PresenterInterface
|
||||
$renderers = array();
|
||||
|
||||
foreach ($envelopes as $envelope) {
|
||||
$rendererStamp = $envelope->get('Flasher\Prime\TestsStamp\HandlerStamp');
|
||||
$rendererStamp = $envelope->get('Flasher\Prime\Stamp\HandlerStamp');
|
||||
if (in_array($rendererStamp->getHandler(), $renderers)) {
|
||||
continue;
|
||||
}
|
||||
@@ -143,7 +143,7 @@ abstract class AbstractPresenter implements PresenterInterface
|
||||
$renderers = array();
|
||||
|
||||
foreach ($envelopes as $envelope) {
|
||||
$rendererStamp = $envelope->get('Flasher\Prime\TestsStamp\HandlerStamp');
|
||||
$rendererStamp = $envelope->get('Flasher\Prime\Stamp\HandlerStamp');
|
||||
if (in_array($rendererStamp->getHandler(), $renderers)) {
|
||||
continue;
|
||||
}
|
||||
@@ -159,4 +159,9 @@ abstract class AbstractPresenter implements PresenterInterface
|
||||
|
||||
return array_values(array_filter(array_unique($options)));
|
||||
}
|
||||
|
||||
public function hasNotifications()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsPresenter\Adapter;
|
||||
namespace Flasher\Prime\Presenter\Adapter;
|
||||
|
||||
use Flasher\Prime\TestsPresenter\AbstractPresenter;
|
||||
use Flasher\Prime\Presenter\AbstractPresenter;
|
||||
|
||||
final class HtmlPresenter extends AbstractPresenter
|
||||
{
|
||||
@@ -53,7 +53,7 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope[] $envelopes
|
||||
* @param \Flasher\Prime\Envelope[] $envelopes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -62,7 +62,7 @@ HTML;
|
||||
$html = '';
|
||||
|
||||
foreach ($envelopes as $envelope) {
|
||||
$rendererStamp = $envelope->get('Flasher\Prime\TestsStamp\HandlerStamp');
|
||||
$rendererStamp = $envelope->get('Flasher\Prime\Stamp\HandlerStamp');
|
||||
$renderer = $this->rendererManager->make($rendererStamp->getHandler());
|
||||
|
||||
$html .= $renderer->render($envelope).PHP_EOL;
|
||||
@@ -72,7 +72,7 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope[] $envelopes
|
||||
* @param \Flasher\Prime\Envelope[] $envelopes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -88,7 +88,7 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope[] $envelopes
|
||||
* @param \Flasher\Prime\Envelope[] $envelopes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsPresenter\Adapter;
|
||||
namespace Flasher\Prime\Presenter\Adapter;
|
||||
|
||||
use Flasher\Prime\TestsPresenter\AbstractPresenter;
|
||||
use Flasher\Prime\Presenter\AbstractPresenter;
|
||||
|
||||
final class JsonPresenter extends AbstractPresenter
|
||||
{
|
||||
@@ -39,7 +39,7 @@ final class JsonPresenter extends AbstractPresenter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope[] $envelopes
|
||||
* @param \Flasher\Prime\Envelope[] $envelopes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -48,7 +48,7 @@ final class JsonPresenter extends AbstractPresenter
|
||||
$notifications = array();
|
||||
|
||||
foreach ($envelopes as $envelope) {
|
||||
$rendererStamp = $envelope->get('Flasher\Prime\TestsStamp\HandlerStamp');
|
||||
$rendererStamp = $envelope->get('Flasher\Prime\Stamp\HandlerStamp');
|
||||
$renderer = $this->rendererManager->make($rendererStamp->getHandler());
|
||||
|
||||
$notifications[] = array(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsPresenter;
|
||||
namespace Flasher\Prime\Presenter;
|
||||
|
||||
interface PresenterInterface
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsPresenter;
|
||||
namespace Flasher\Prime\Presenter;
|
||||
|
||||
use Flasher\Prime\TestsManager\AbstractManager;
|
||||
use Flasher\Prime\Manager\AbstractManager;
|
||||
|
||||
/**
|
||||
* @method \Flasher\Prime\TestsPresenter\PresenterInterface make($name = null, array $context = array())
|
||||
* @method PresenterInterface make($name = null, array $context = array())
|
||||
*/
|
||||
final class PresenterManager extends AbstractManager
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsRenderer;
|
||||
namespace Flasher\Prime\Renderer;
|
||||
|
||||
interface HasOptionsInterface
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsRenderer;
|
||||
namespace Flasher\Prime\Renderer;
|
||||
|
||||
interface HasScriptsInterface
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsRenderer;
|
||||
namespace Flasher\Prime\Renderer;
|
||||
|
||||
interface HasStylesInterface
|
||||
{
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsRenderer;
|
||||
namespace Flasher\Prime\Renderer;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
interface RendererInterface
|
||||
{
|
||||
/**
|
||||
* @param \Notify\Envelope $envelope
|
||||
* @param Envelope $envelope
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsRenderer;
|
||||
namespace Flasher\Prime\Renderer;
|
||||
|
||||
use Flasher\Prime\TestsManager\AbstractManager;
|
||||
use Flasher\Prime\Manager\AbstractManager;
|
||||
|
||||
/**
|
||||
* @method \Flasher\Prime\TestsRenderer\RendererInterface make($name = null, array $context = array())
|
||||
* @method RendererInterface make($name = null, array $context = array())
|
||||
*/
|
||||
class RendererManager extends AbstractManager
|
||||
{
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsStamp;
|
||||
namespace Flasher\Prime\Stamp;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use Exception;
|
||||
|
||||
final class CreatedAtStamp implements StampInterface, OrderableStampInterface
|
||||
{
|
||||
/**
|
||||
* @param \DateTime
|
||||
* @param DateTime
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* @param \DateTime|null $createdAt
|
||||
* @param DateTime|null $createdAt
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct(\DateTime $createdAt = null)
|
||||
public function __construct(DateTime $createdAt = null)
|
||||
{
|
||||
$this->createdAt = $createdAt ?: new \DateTime('now', new \DateTimeZone('Africa/Casablanca'));
|
||||
$this->createdAt = $createdAt ?: new DateTime('now', new DateTimeZone('Africa/Casablanca'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
@@ -28,7 +32,7 @@ final class CreatedAtStamp implements StampInterface, OrderableStampInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Flasher\Prime\TestsStamp\OrderableStampInterface $orderable
|
||||
* @param OrderableStampInterface $orderable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsStamp;
|
||||
namespace Flasher\Prime\Stamp;
|
||||
|
||||
final class HandlerStamp implements StampInterface
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsStamp;
|
||||
namespace Flasher\Prime\Stamp;
|
||||
|
||||
final class ReplayStamp implements StampInterface
|
||||
final class HopsStamp implements StampInterface
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsStamp;
|
||||
namespace Flasher\Prime\Stamp;
|
||||
|
||||
interface OrderableStampInterface
|
||||
{
|
||||
/**
|
||||
* @param \Flasher\Prime\TestsStamp\OrderableStampInterface $orderable
|
||||
* @param OrderableStampInterface $orderable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsStamp;
|
||||
namespace Flasher\Prime\Stamp;
|
||||
|
||||
final class PriorityStamp implements StampInterface, OrderableStampInterface
|
||||
{
|
||||
@@ -26,7 +26,7 @@ final class PriorityStamp implements StampInterface, OrderableStampInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Flasher\Prime\TestsStamp\OrderableStampInterface $orderable
|
||||
* @param OrderableStampInterface $orderable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsStamp;
|
||||
namespace Flasher\Prime\Stamp;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use Exception;
|
||||
|
||||
final class RenderedAtStamp implements StampInterface
|
||||
{
|
||||
/**
|
||||
* @param \DateTime
|
||||
* @param DateTime
|
||||
*/
|
||||
private $renderedAt;
|
||||
|
||||
/**
|
||||
* @param \DateTime|null $renderedAt
|
||||
* @param DateTime|null $renderedAt
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct(\DateTime $renderedAt = null)
|
||||
public function __construct(DateTime $renderedAt = null)
|
||||
{
|
||||
$this->renderedAt = $renderedAt ?: new \DateTime('now', new \DateTimeZone('Africa/Casablanca'));
|
||||
$this->renderedAt = $renderedAt ?: new DateTime('now', new DateTimeZone('Africa/Casablanca'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getRenderedAt()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsStamp;
|
||||
namespace Flasher\Prime\Stamp;
|
||||
|
||||
interface StampInterface
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsStamp;
|
||||
namespace Flasher\Prime\Stamp;
|
||||
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
final class UuidStamp implements StampInterface
|
||||
{
|
||||
@@ -28,9 +30,9 @@ final class UuidStamp implements StampInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope|\Notify\Envelope[] $envelopes
|
||||
* @param Envelope|Envelope[] $envelopes
|
||||
*
|
||||
* @return array<string, \Notify\Envelope>
|
||||
* @return array<string, Envelope>
|
||||
*/
|
||||
public static function indexWithUuid($envelopes)
|
||||
{
|
||||
@@ -39,7 +41,7 @@ final class UuidStamp implements StampInterface
|
||||
$map = array();
|
||||
|
||||
foreach ($envelopes as $envelope) {
|
||||
$uuid = $envelope->get('Flasher\Prime\TestsStamp\UuidStamp')->getUuid();
|
||||
$uuid = $envelope->get('Flasher\Prime\Stamp\UuidStamp')->getUuid();
|
||||
|
||||
$map[$uuid] = $envelope;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsStorage;
|
||||
namespace Flasher\Prime\Storage;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\TestsStamp\UuidStamp;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Stamp\UuidStamp;
|
||||
|
||||
final class ArrayStorage implements StorageInterface
|
||||
{
|
||||
@@ -28,7 +28,7 @@ final class ArrayStorage implements StorageInterface
|
||||
$envelopes = is_array($envelopes) ? $envelopes : func_get_args();
|
||||
|
||||
foreach ($envelopes as $envelope) {
|
||||
if (null === $envelope->get('Flasher\Prime\TestsStamp\UuidStamp')) {
|
||||
if (null === $envelope->get('Flasher\Prime\Stamp\UuidStamp')) {
|
||||
$envelope->withStamp(new UuidStamp());
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ final class ArrayStorage implements StorageInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope[] $envelopes
|
||||
* @param Envelope[] $envelopes
|
||||
*/
|
||||
public function remove($envelopes)
|
||||
{
|
||||
@@ -48,7 +48,7 @@ final class ArrayStorage implements StorageInterface
|
||||
$this->envelopes = array_filter(
|
||||
$this->envelopes,
|
||||
function (Envelope $envelope) use ($map) {
|
||||
$uuid = $envelope->get('Flasher\Prime\TestsStamp\UuidStamp')->getUuid();
|
||||
$uuid = $envelope->get('Flasher\Prime\Stamp\UuidStamp')->getUuid();
|
||||
|
||||
return !isset($map[$uuid]);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsStorage;
|
||||
namespace Flasher\Prime\Storage;
|
||||
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
interface StorageInterface
|
||||
{
|
||||
/**
|
||||
* @return \Notify\Envelope[]
|
||||
* @return Envelope[]
|
||||
*/
|
||||
public function all();
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope|\Notify\Envelope[] $envelopes
|
||||
* @param Envelope|Envelope[] $envelopes
|
||||
*/
|
||||
public function add($envelopes);
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope|\Notify\Envelope[] $envelopes
|
||||
* @param Envelope|Envelope[] $envelopes
|
||||
*/
|
||||
public function remove($envelopes);
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsStorage;
|
||||
namespace Flasher\Prime\Storage;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\TestsStamp\ReplayStamp;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Stamp\HopsStamp;
|
||||
|
||||
final class StorageManager implements StorageManagerInterface
|
||||
{
|
||||
/**
|
||||
* @var \Flasher\Prime\TestsStorage\StorageInterface
|
||||
* @var StorageInterface
|
||||
*/
|
||||
private $storage;
|
||||
|
||||
/**
|
||||
* @param \Flasher\Prime\TestsStorage\StorageInterface $storage
|
||||
* @param StorageInterface $storage
|
||||
*/
|
||||
public function __construct(StorageInterface $storage)
|
||||
{
|
||||
@@ -30,14 +30,14 @@ final class StorageManager implements StorageManagerInterface
|
||||
$this->storage->remove($envelopes);
|
||||
|
||||
foreach ($envelopes as $envelope) {
|
||||
$replayStamp = $envelope->get('Flasher\Prime\TestsStamp\ReplayStamp');
|
||||
$replayStamp = $envelope->get('Flasher\Prime\Stamp\HopsStamp');
|
||||
$replayCount = null === $replayStamp ? 0 : $replayStamp->getCount() - 1;
|
||||
|
||||
if (1 > $replayCount) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$envelope->with(new ReplayStamp($replayCount));
|
||||
$envelope->with(new HopsStamp($replayCount));
|
||||
$this->storage->add($envelope);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Prime\TestsStorage;
|
||||
namespace Flasher\Prime\Storage;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
|
||||
interface StorageManagerInterface
|
||||
{
|
||||
/**
|
||||
* @param \Notify\Envelope[] $envelopes
|
||||
* @param Envelope[] $envelopes
|
||||
*/
|
||||
public function flush($envelopes);
|
||||
|
||||
/**
|
||||
* @return \Notify\Envelope[]
|
||||
* @return Envelope[]
|
||||
*/
|
||||
public function all();
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope $envelope
|
||||
* @param Envelope $envelope
|
||||
*/
|
||||
public function add(Envelope $envelope);
|
||||
|
||||
/**
|
||||
* @param \Notify\Envelope[] $envelopes
|
||||
* @param Envelope[] $envelopes
|
||||
*/
|
||||
public function remove($envelopes);
|
||||
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
namespace Flasher\Prime\Tests\Envelope;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class EnvelopeTest extends TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock();
|
||||
$stamp = $this->getMockBuilder('Flasher\Prime\TestsStamp\StampInterface')->getMock();
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock();
|
||||
$stamp = $this->getMockBuilder('Flasher\Prime\Stamp\StampInterface')->getMock();
|
||||
|
||||
$envelope = new Envelope($notification, array($stamp));
|
||||
|
||||
@@ -20,9 +20,9 @@ final class EnvelopeTest extends TestCase
|
||||
|
||||
public function testWith()
|
||||
{
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock();
|
||||
$stamp1 = $this->getMockBuilder('Flasher\Prime\TestsStamp\StampInterface')->getMock();
|
||||
$stamp2 = $this->getMockBuilder('Flasher\Prime\TestsStamp\StampInterface')->getMock();
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock();
|
||||
$stamp1 = $this->getMockBuilder('Flasher\Prime\Stamp\StampInterface')->getMock();
|
||||
$stamp2 = $this->getMockBuilder('Flasher\Prime\Stamp\StampInterface')->getMock();
|
||||
|
||||
$envelope = new Envelope($notification);
|
||||
$envelope->with($stamp1, $stamp2);
|
||||
@@ -33,8 +33,8 @@ final class EnvelopeTest extends TestCase
|
||||
|
||||
public function testWrap()
|
||||
{
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock();
|
||||
$stamp = $this->getMockBuilder('Flasher\Prime\TestsStamp\StampInterface')->getMock();
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock();
|
||||
$stamp = $this->getMockBuilder('Flasher\Prime\Stamp\StampInterface')->getMock();
|
||||
|
||||
$envelope = Envelope::wrap($notification, array($stamp));
|
||||
|
||||
@@ -44,12 +44,12 @@ final class EnvelopeTest extends TestCase
|
||||
|
||||
public function testAll()
|
||||
{
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock();
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock();
|
||||
$stamps = array(
|
||||
$this->getMockBuilder('Flasher\Prime\TestsStamp\StampInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\TestsStamp\StampInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\TestsStamp\StampInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\TestsStamp\StampInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Stamp\StampInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Stamp\StampInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Stamp\StampInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Stamp\StampInterface')->getMock(),
|
||||
);
|
||||
|
||||
$envelope = new Envelope($notification, $stamps);
|
||||
@@ -60,14 +60,14 @@ final class EnvelopeTest extends TestCase
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$notification = $this->getMockBuilder('\Flasher\Prime\TestsNotification\NotificationInterface')->getMock();
|
||||
$notification = $this->getMockBuilder('\Flasher\Prime\Notification\NotificationInterface')->getMock();
|
||||
$stamps = array(
|
||||
$this->getMockBuilder('Flasher\Prime\TestsStamp\StampInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\TestsStamp\StampInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\TestsStamp\StampInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Stamp\StampInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Stamp\StampInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Stamp\StampInterface')->getMock(),
|
||||
);
|
||||
|
||||
$envelope = new \Notify\Envelope($notification, $stamps);
|
||||
$envelope = new \Flasher\Prime\Envelope($notification, $stamps);
|
||||
|
||||
$this->assertSame($notification, $envelope->getNotification());
|
||||
|
||||
|
||||
@@ -2,30 +2,30 @@
|
||||
|
||||
namespace Flasher\Prime\Tests\Envelope\Stamp;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\TestsStamp\CreatedAtStamp;
|
||||
use Flasher\Prime\TestsStamp\ReplayStamp;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Stamp\CreatedAtStamp;
|
||||
use Flasher\Prime\Stamp\HopsStamp;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class CreatedAtStampTest extends TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock();
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock();
|
||||
$stamp = new CreatedAtStamp();
|
||||
|
||||
$envelop = new Envelope($notification, array($stamp));
|
||||
|
||||
$this->assertSame($stamp, $envelop->get('Flasher\Prime\TestsStamp\CreatedAtStamp'));
|
||||
$this->assertInstanceOf('Flasher\Prime\TestsStamp\StampInterface', $stamp);
|
||||
$this->assertSame($stamp, $envelop->get('Flasher\Prime\Stamp\CreatedAtStamp'));
|
||||
$this->assertInstanceOf('Flasher\Prime\Stamp\StampInterface', $stamp);
|
||||
}
|
||||
|
||||
public function testCompare()
|
||||
{
|
||||
$createdAt1 = new \Flasher\Prime\TestsStamp\CreatedAtStamp(new \DateTime('+2 h'));
|
||||
$createdAt2 = new \Flasher\Prime\TestsStamp\CreatedAtStamp(new \DateTime('+1 h'));
|
||||
$createdAt1 = new \Flasher\Prime\Stamp\CreatedAtStamp(new \DateTime('+2 h'));
|
||||
$createdAt2 = new \Flasher\Prime\Stamp\CreatedAtStamp(new \DateTime('+1 h'));
|
||||
|
||||
$this->assertFalse($createdAt1->compare($createdAt2));
|
||||
$this->assertSame(0, $createdAt1->compare(new ReplayStamp(1)));
|
||||
$this->assertSame(0, $createdAt1->compare(new HopsStamp(1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
|
||||
namespace Flasher\Prime\Tests\Envelope\Stamp;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class LifeStampTest extends TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock();
|
||||
$stamp = new \Flasher\Prime\TestsStamp\ReplayStamp(5);
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock();
|
||||
$stamp = new \Flasher\Prime\Stamp\HopsStamp(5);
|
||||
|
||||
$envelop = new Envelope($notification, array($stamp));
|
||||
|
||||
$this->assertSame($stamp, $envelop->get('Flasher\Prime\TestsStamp\ReplayStamp'));
|
||||
$this->assertInstanceOf('Flasher\Prime\TestsStamp\ReplayStamp', $stamp);
|
||||
$this->assertSame($stamp, $envelop->get('Flasher\Prime\Stamp\HopsStamp'));
|
||||
$this->assertInstanceOf('Flasher\Prime\Stamp\HopsStamp', $stamp);
|
||||
$this->assertSame(5, $stamp->getCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,30 +2,30 @@
|
||||
|
||||
namespace Flasher\Prime\Tests\Envelope\Stamp;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\TestsStamp\PriorityStamp;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Stamp\PriorityStamp;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class PriorityStampTest extends TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock();
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock();
|
||||
$stamp = new PriorityStamp(5);
|
||||
|
||||
$envelop = new Envelope($notification, array($stamp));
|
||||
|
||||
$this->assertSame($stamp, $envelop->get('Flasher\Prime\TestsStamp\PriorityStamp'));
|
||||
$this->assertInstanceOf('Flasher\Prime\TestsStamp\StampInterface', $stamp);
|
||||
$this->assertSame($stamp, $envelop->get('Flasher\Prime\Stamp\PriorityStamp'));
|
||||
$this->assertInstanceOf('Flasher\Prime\Stamp\StampInterface', $stamp);
|
||||
$this->assertSame(5, $stamp->getPriority());
|
||||
}
|
||||
|
||||
public function testCompare()
|
||||
{
|
||||
$stamp1 = new PriorityStamp(1);
|
||||
$stamp2 = new \Flasher\Prime\TestsStamp\PriorityStamp(2);
|
||||
$stamp2 = new \Flasher\Prime\Stamp\PriorityStamp(2);
|
||||
|
||||
$this->assertFalse($stamp1->compare($stamp2));
|
||||
$this->assertSame(0, $stamp1->compare(new \Flasher\Prime\TestsStamp\ReplayStamp(1)));
|
||||
$this->assertSame(0, $stamp1->compare(new \Flasher\Prime\Stamp\HopsStamp(1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
|
||||
namespace Flasher\Prime\Tests\Envelope\Stamp;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class RendererStampTest extends TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock();
|
||||
$stamp = new \Flasher\Prime\TestsStamp\HandlerStamp('toastr');
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock();
|
||||
$stamp = new \Flasher\Prime\Stamp\HandlerStamp('toastr');
|
||||
|
||||
$envelop = new Envelope($notification, array($stamp));
|
||||
|
||||
$this->assertSame($stamp, $envelop->get('Flasher\Prime\TestsStamp\HandlerStamp'));
|
||||
$this->assertInstanceOf('Flasher\Prime\TestsStamp\HandlerStamp', $stamp);
|
||||
$this->assertSame($stamp, $envelop->get('Flasher\Prime\Stamp\HandlerStamp'));
|
||||
$this->assertInstanceOf('Flasher\Prime\Stamp\HandlerStamp', $stamp);
|
||||
$this->assertSame('toastr', $stamp->getHandler());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
|
||||
namespace Flasher\Prime\Tests\Envelope\Stamp;
|
||||
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\Envelope;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class UuidStampTest extends TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock();
|
||||
$stamp = new \Flasher\Prime\TestsStamp\UuidStamp();
|
||||
$notification = $this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock();
|
||||
$stamp = new \Flasher\Prime\Stamp\UuidStamp();
|
||||
|
||||
$envelop = new Envelope($notification, array($stamp));
|
||||
|
||||
$this->assertSame($stamp, $envelop->get('Flasher\Prime\TestsStamp\UuidStamp'));
|
||||
$this->assertInstanceOf('Flasher\Prime\TestsStamp\UuidStamp', $stamp);
|
||||
$this->assertSame($stamp, $envelop->get('Flasher\Prime\Stamp\UuidStamp'));
|
||||
$this->assertInstanceOf('Flasher\Prime\Stamp\UuidStamp', $stamp);
|
||||
$this->assertNotEmpty($stamp->getUuid());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Flasher\Prime\Tests\Filter;
|
||||
|
||||
use Flasher\Prime\TestsFilter\CriteriaBuilder;
|
||||
use Flasher\Prime\TestsFilter\FilterBuilder;
|
||||
use Flasher\Prime\Filter\CriteriaBuilder;
|
||||
use Flasher\Prime\Filter\FilterBuilder;
|
||||
use Flasher\Prime\Tests\TestCase;
|
||||
|
||||
final class CriteriaBuilderTest extends TestCase
|
||||
@@ -12,14 +12,14 @@ final class CriteriaBuilderTest extends TestCase
|
||||
{
|
||||
$criteria = new CriteriaBuilder(
|
||||
new FilterBuilder(), array(
|
||||
'priority' => 1,
|
||||
'life' => 2,
|
||||
'limit' => 2,
|
||||
'order_by' => 'Flasher\Prime\TestsStamp\ReplayStamp',
|
||||
'priority' => 1,
|
||||
'life' => 2,
|
||||
'limit' => 2,
|
||||
'order_by' => 'Flasher\Prime\Stamp\HopsStamp',
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Flasher\Prime\TestsFilter\FilterBuilder', $criteria->build());
|
||||
$this->assertInstanceOf('Flasher\Prime\Filter\FilterBuilder', $criteria->build());
|
||||
$this->assertNotEmpty($criteria->build()->getSpecification());
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ final class CriteriaBuilderTest extends TestCase
|
||||
{
|
||||
$criteria = new CriteriaBuilder(new FilterBuilder(), array());
|
||||
|
||||
$this->assertInstanceOf('Flasher\Prime\TestsFilter\FilterBuilder', $criteria->build());
|
||||
$this->assertInstanceOf('Flasher\Prime\Filter\FilterBuilder', $criteria->build());
|
||||
$this->assertEmpty($criteria->build()->getSpecification());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
namespace Flasher\Prime\Tests\Filter;
|
||||
|
||||
use Notify\Config\Config;
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\TestsMiddleware\AddCreatedAtStampMiddleware;
|
||||
use Flasher\Prime\TestsMiddleware\AddPriorityStampMiddleware;
|
||||
use Flasher\Prime\TestsStamp\PriorityStamp;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Middleware\AddCreatedAtStampMiddleware;
|
||||
use Flasher\Prime\Middleware\AddPriorityStampMiddleware;
|
||||
use Flasher\Prime\Stamp\PriorityStamp;
|
||||
use Flasher\Prime\Tests\TestCase;
|
||||
|
||||
final class DefaultFilterTest extends TestCase
|
||||
@@ -14,23 +14,23 @@ final class DefaultFilterTest extends TestCase
|
||||
public function testWithCriteria()
|
||||
{
|
||||
$notifications = array(
|
||||
$this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock(),
|
||||
);
|
||||
|
||||
$notifications[3] = new Envelope(
|
||||
$this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock(),
|
||||
array(new PriorityStamp(5))
|
||||
);
|
||||
|
||||
$notifications[4] = new Envelope(
|
||||
$this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock(),
|
||||
array(new PriorityStamp(-1))
|
||||
);
|
||||
|
||||
$notifications[5] = new Envelope(
|
||||
$this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock(),
|
||||
array(new PriorityStamp(1))
|
||||
);
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
namespace Flasher\Prime\Tests\Filter;
|
||||
|
||||
use Notify\Config\Config;
|
||||
use Notify\Envelope;
|
||||
use Flasher\Prime\TestsFilter\FilterBuilder;
|
||||
use Flasher\Prime\TestsFilter\Specification\PrioritySpecification;
|
||||
use Flasher\Prime\TestsMiddleware\AddCreatedAtStampMiddleware;
|
||||
use Flasher\Prime\TestsMiddleware\AddPriorityStampMiddleware;
|
||||
use Flasher\Prime\TestsMiddleware\NotifyBus;
|
||||
use Flasher\Prime\TestsStamp\PriorityStamp;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Filter\FilterBuilder;
|
||||
use Flasher\Prime\Filter\Specification\PrioritySpecification;
|
||||
use Flasher\Prime\Middleware\AddCreatedAtStampMiddleware;
|
||||
use Flasher\Prime\Middleware\AddPriorityStampMiddleware;
|
||||
use Flasher\Prime\MiddlewareFlasher\PrimeBus;
|
||||
use Flasher\Prime\Stamp\PriorityStamp;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class FilterManagerTest extends TestCase
|
||||
@@ -17,23 +17,23 @@ final class FilterManagerTest extends TestCase
|
||||
public function testFilterWhere()
|
||||
{
|
||||
$notifications = array(
|
||||
$this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock(),
|
||||
);
|
||||
|
||||
$notifications[3] = new Envelope(
|
||||
$this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock(),
|
||||
array(new PriorityStamp(5))
|
||||
);
|
||||
|
||||
$notifications[4] = new Envelope(
|
||||
$this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock(),
|
||||
array(new PriorityStamp(-1))
|
||||
);
|
||||
|
||||
$notifications[5] = new Envelope(
|
||||
$this->getMockBuilder('Flasher\Prime\TestsNotification\NotificationInterface')->getMock(),
|
||||
$this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock(),
|
||||
array(new PriorityStamp(1))
|
||||
);
|
||||
|
||||
@@ -68,7 +68,7 @@ final class FilterManagerTest extends TestCase
|
||||
->andWhere(new PrioritySpecification(1, 5))
|
||||
->orderBy(
|
||||
array(
|
||||
'Flasher\Prime\TestsStamp\PriorityStamp' => 'ASC'
|
||||
'Flasher\Prime\Stamp\PriorityStamp' => 'ASC'
|
||||
)
|
||||
)
|
||||
->setMaxResults(2)
|
||||
@@ -83,8 +83,8 @@ final class FilterManagerTest extends TestCase
|
||||
->orWhere(new PrioritySpecification(1, 5))
|
||||
->orderBy(
|
||||
array(
|
||||
'Flasher\Prime\TestsStamp\PriorityStamp' => 'ASC',
|
||||
'Notify\Envelope\Stamp\NotExists' => 'ASC',
|
||||
'Flasher\Prime\Stamp\PriorityStamp' => 'ASC',
|
||||
'Flasher\Prime\Envelope\Stamp\NotExists' => 'ASC',
|
||||
)
|
||||
)
|
||||
->setMaxResults(2)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Flasher\Prime\Tests\Manager;
|
||||
|
||||
use Notify\Notify;
|
||||
use NotifyFlasher\Prime;
|
||||
use Flasher\Prime\Tests\TestCase;
|
||||
|
||||
final class ManagerTest extends TestCase
|
||||
@@ -27,7 +27,7 @@ final class ManagerTest extends TestCase
|
||||
|
||||
$manager = new Notify($config);
|
||||
|
||||
$producer = $this->getMockBuilder('Notify\NotifyFactory')->getMock();
|
||||
$producer = $this->getMockBuilder('NotifyFlasher\PrimeFactory')->getMock();
|
||||
$producer->method('supports')->willReturn(true);
|
||||
$manager->addDriver($producer);
|
||||
|
||||
@@ -45,7 +45,7 @@ final class ManagerTest extends TestCase
|
||||
|
||||
$manager = new Notify($config);
|
||||
|
||||
$producer = $this->getMockBuilder('Notify\NotifyFactory')->getMock();
|
||||
$producer = $this->getMockBuilder('NotifyFlasher\PrimeFactory')->getMock();
|
||||
$manager->addDriver($producer);
|
||||
|
||||
$manager->make('test_driver');
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user