Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #228 from roelvanduijnhoven/feature/tweaks
Browse files Browse the repository at this point in the history
Mixed set of enhancements
  • Loading branch information
Roel van Duijnhoven committed Jan 30, 2020
2 parents 3420f03 + f72e71e commit d59a3b4
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 208 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tools:
external_code_coverage: true
external_code_coverage: false
checks:
php:
code_rating: true
Expand Down
109 changes: 0 additions & 109 deletions CHANGELOG.md

This file was deleted.

25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ SlmQueue

[![Build Status](https://travis-ci.org/JouwWeb/SlmQueue.png?branch=master)](https://travis-ci.org/JouwWeb/SlmQueue)
[![Latest Stable Version](https://poser.pugx.org/slm/queue/v/stable.png)](https://packagist.org/packages/JouwWeb/slm-queue)
[![Latest Unstable Version](https://poser.pugx.org/slm/queue/v/unstable.png)](https://packagist.org/packages/JouwWeb/slm-queue)

Created by Jurian Sluiman and Michaël Gallego

Introduction
------------
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/JouwWeb/SlmQueue/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/JouwWeb/SlmQueue/?branch=master)

SlmQueue is a job queue abstraction layer for Zend Framework applications. It supports various job queue systems and
makes your application independent from the underlying system you use. The currently supported systems have each their
Expand Down Expand Up @@ -38,7 +33,7 @@ SlmQueue works with [Composer](http://getcomposer.org). Make sure you have the c

```json
"require": {
"slm/queue": "^1.0"
"slm/queue": "^2.0"
}
```

Expand All @@ -56,8 +51,8 @@ or [SlmQueueDoctrine](https://github.com/juriansluiman/SlmQueueDoctrine)

Requirements
------------
* PHP5.5+
* [laminas-servicemanager 2.7 || 3.0](https://github.com/laminas/laminas-servicemanager)
* PHP >= 7.2
* [laminas-servicemanager >= 3.3.1](https://github.com/laminas/laminas-servicemanager)


Code samples
Expand Down Expand Up @@ -89,8 +84,6 @@ class EmailJob extends AbstractJob

If you want to inject this job into a queue, you can do this for instance in your controller:

Since v0.8.0 you can also add additional options (in the example the job will be delay by a minute)

```php
namespace MyModule\Controller;

Expand Down Expand Up @@ -144,3 +137,13 @@ contribute, please be aware of the following guidelines:
5. If you add a new feature, please work on some documentation as well

For long-term contributors, push access to this repository is granted.

Who to thank?
-------------

[Jurian Sluiman](https://github.com/juriansluiman) and [Michaël Gallego](https://github.com/bakura10) did the initial work on creating this repo, and maintained it for a long time.

Currently it is maintained by:

* [Bas Kamer](https://github.com/basz)
* [Roel van Duijnhoven](https://github.com/roelvanduijnhoven)
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@
],
"require": {
"php": "^7.2",
"laminas/laminas-eventmanager": "^2.6 || ^3.0",
"laminas/laminas-servicemanager": "^2.7 || ^3.0",
"laminas/laminas-stdlib": "^2.7 || ^3.0"
"laminas/laminas-eventmanager": "^3.2.1",
"laminas/laminas-servicemanager": "^3.3.1",
"laminas/laminas-stdlib": "^3.2"
},
"require-dev": {
"laminas/laminas-mvc": "^2.5",
"laminas/laminas-modulemanager": "^2.5",
"laminas/laminas-mvc": "^2.7.13",
"laminas/laminas-modulemanager": "^2.8.3",
"laminas/laminas-view": "^2.7",
"laminas/laminas-serializer": "^2.6",
"laminas/laminas-log": "^2.7",
"laminas/laminas-i18n": "^2.6",
"laminas/laminas-console": "^2.6",
"laminas/laminas-config": "^2.6",
"laminas/laminas-serializer": "^2.9.1",
"laminas/laminas-log": "^2.11",
"laminas/laminas-i18n": "^2.8",
"laminas/laminas-console": "^2.7",
"laminas/laminas-config": "^3.2",
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.5",
"php-coveralls/php-coveralls": "^2.0"
Expand Down
10 changes: 5 additions & 5 deletions docs/2.Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ to push jobs into the queue. In the following example, access to the queue in yo
namespace MyModule\Factory;

use MyModule\Controller\MyController;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;

class MyControllerFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $sl)
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$queueManager = $sl->get('SlmQueue\Queue\QueuePluginManager');
$queue = $queueManager->get('default');
$queueManager = $container->get('SlmQueue\Queue\QueuePluginManager');
$queue = $queueManager->get('default');

$controller = new MyController($queue);
$controller = new MyController($queue);
return $controller;
}
}
Expand Down
6 changes: 3 additions & 3 deletions docs/3.Jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,16 @@ To inject the email transport instance, a factory must be created to instantiate
```php
namespace MyModule\Factory;

use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;

use MyModule\Job\SendEmailJob;

class SendEmailJobFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $sl)
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$transport = $sl->getServiceLocator()->get('my-transport-service');
$transport = $container->getServiceLocator()->get('my-transport-service');

$job = new SendEmailJob($transport);
return $job;
Expand Down
14 changes: 4 additions & 10 deletions docs/6.Events.md
Original file line number Diff line number Diff line change
Expand Up @@ -615,25 +615,19 @@ Since this worker strategy has a dependency that needs to be injected we should
namespace MyModule\Strategy\Factory;

use MyModule\Strategy\JobTranslatorStrategy;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;

class JobTranslatorStrategyFactory implements FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return JobTranslatorStrategy
*/
public function createService(ServiceLocatorInterface $serviceLocator)
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$sm = $serviceLocator->getServiceLocator();
$sm = $container->getServiceLocator();

/** @var $sm \Laminas\Mvc\I18n\Translator */
$translator = $sm->get('MvcTranslator');

$strategy = new JobTranslatorStrategy($translator);
$strategy = new JobTranslatorStrategy($translator);

return $strategy;
}
Expand Down
8 changes: 1 addition & 7 deletions src/Factory/QueueControllerPluginFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
namespace SlmQueue\Factory;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use SlmQueue\Controller\Plugin\QueuePlugin;
use SlmQueue\Job\JobPluginManager;
use SlmQueue\Queue\QueuePluginManager;
Expand All @@ -18,9 +17,4 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o

return new QueuePlugin($queuePluginManager, $jobPluginManager);
}

public function createService(ServiceLocatorInterface $serviceLocator): QueuePlugin
{
return $this($serviceLocator->getServiceLocator(), QueuePlugin::class);
}
}
8 changes: 1 addition & 7 deletions src/Factory/QueuePluginManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
namespace SlmQueue\Factory;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use SlmQueue\Queue\QueuePluginManager;

class QueuePluginManagerFactory implements FactoryInterface
Expand All @@ -16,9 +15,4 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o

return new QueuePluginManager($container, $config);
}

public function createService(ServiceLocatorInterface $serviceLocator): QueuePluginManager
{
return $this($serviceLocator, QueuePluginManager::class);
}
}
14 changes: 1 addition & 13 deletions src/Factory/StrategyPluginManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
namespace SlmQueue\Factory;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use SlmQueue\Strategy\StrategyPluginManager;

class StrategyPluginManagerFactory implements FactoryInterface
{
/**
* {@inheritDoc}
*/
public function __invoke(
ContainerInterface $container,
$requestedName,
Expand All @@ -22,12 +18,4 @@ public function __invoke(

return new StrategyPluginManager($container, $config);
}

/**
* {@inheritDoc}
*/
public function createService(ServiceLocatorInterface $serviceLocator): StrategyPluginManager
{
return $this($serviceLocator, StrategyPluginManager::class);
}
}
11 changes: 1 addition & 10 deletions src/Factory/WorkerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
use Interop\Container\ContainerInterface;
use Laminas\EventManager\EventManager;
use Laminas\EventManager\EventManagerInterface;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use SlmQueue\Strategy\StrategyPluginManager;
use SlmQueue\Worker\WorkerInterface;

Expand All @@ -27,14 +26,6 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o
return $worker;
}

public function createService(
ServiceLocatorInterface $serviceLocator,
$canonicalName = null,
$requestedName = null
): WorkerInterface {
return $this($serviceLocator, $requestedName);
}

protected function attachWorkerListeners(
EventManagerInterface $eventManager,
StrategyPluginManager $listenerPluginManager,
Expand Down
7 changes: 1 addition & 6 deletions src/Strategy/Factory/AttachQueueListenersStrategyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SlmQueue\Strategy\Factory;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use SlmQueue\Strategy\AttachQueueListenersStrategy;
use SlmQueue\Strategy\StrategyPluginManager;
Expand All @@ -21,9 +21,4 @@ public function __invoke(

return new AttachQueueListenersStrategy($pluginManager, $strategyConfig);
}

public function createService(ServiceLocatorInterface $serviceLocator): AttachQueueListenersStrategy
{
return $this($serviceLocator->getServiceLocator(), AttachQueueListenersStrategy::class);
}
}
Loading

0 comments on commit d59a3b4

Please sign in to comment.