|
|
|
|
@@ -1,8 +1,10 @@
|
|
|
|
|
<?php namespace Cybercinch;
|
|
|
|
|
|
|
|
|
|
use InvalidArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class UglyQueueManager
|
|
|
|
|
* @package DCarbone
|
|
|
|
|
* @package Cybercinch
|
|
|
|
|
*/
|
|
|
|
|
class UglyQueueManager implements \SplObserver, \Countable
|
|
|
|
|
{
|
|
|
|
|
@@ -17,12 +19,12 @@ class UglyQueueManager implements \SplObserver, \Countable
|
|
|
|
|
*
|
|
|
|
|
* @param string $baseDir
|
|
|
|
|
* @throws \RuntimeException
|
|
|
|
|
* @throws \InvalidArgumentException
|
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
|
*/
|
|
|
|
|
public function __construct($baseDir)
|
|
|
|
|
{
|
|
|
|
|
if (false === is_string($baseDir))
|
|
|
|
|
throw new \InvalidArgumentException('Argument 1 expected to be string, "'.gettype($baseDir).'" seen.');
|
|
|
|
|
throw new InvalidArgumentException('Argument 1 expected to be string, "'.gettype($baseDir).'" seen.');
|
|
|
|
|
|
|
|
|
|
if (false === is_dir($baseDir))
|
|
|
|
|
throw new \RuntimeException('"'.$baseDir.'" points to a directory that does not exist.');
|
|
|
|
|
@@ -40,7 +42,7 @@ class UglyQueueManager implements \SplObserver, \Countable
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $name
|
|
|
|
|
* @return UglyQueue|UglyQueueManager
|
|
|
|
|
* @return UglyQueue
|
|
|
|
|
*/
|
|
|
|
|
public function getQueue($name)
|
|
|
|
|
{
|
|
|
|
|
@@ -56,7 +58,7 @@ class UglyQueueManager implements \SplObserver, \Countable
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param UglyQueue $uglyQueue
|
|
|
|
|
* @return \DCarbone\UglyQueueManager
|
|
|
|
|
* @return UglyQueueManager
|
|
|
|
|
* @throws \RuntimeException
|
|
|
|
|
*/
|
|
|
|
|
public function addQueue(UglyQueue $uglyQueue)
|
|
|
|
|
@@ -111,7 +113,7 @@ class UglyQueueManager implements \SplObserver, \Countable
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param UglyQueue $uglyQueue
|
|
|
|
|
* @return \DCarbone\UglyQueueManager
|
|
|
|
|
* @return UglyQueueManager
|
|
|
|
|
*/
|
|
|
|
|
public function removeQueue(UglyQueue $uglyQueue)
|
|
|
|
|
{
|
|
|
|
|
@@ -124,7 +126,7 @@ class UglyQueueManager implements \SplObserver, \Countable
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $name
|
|
|
|
|
* @return \DCarbone\UglyQueueManager
|
|
|
|
|
* @return UglyQueueManager
|
|
|
|
|
*/
|
|
|
|
|
public function removeQueueByName($name)
|
|
|
|
|
{
|
|
|
|
|
@@ -136,15 +138,15 @@ class UglyQueueManager implements \SplObserver, \Countable
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $name
|
|
|
|
|
* @return \DCarbone\UglyQueue
|
|
|
|
|
* @throws \InvalidArgumentException
|
|
|
|
|
* @return UglyQueue
|
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
|
*/
|
|
|
|
|
public function getQueueWithName($name)
|
|
|
|
|
{
|
|
|
|
|
if (isset($this->queues[$name]))
|
|
|
|
|
return $this->queues[$name];
|
|
|
|
|
|
|
|
|
|
throw new \InvalidArgumentException('Argument 1 expected to be valid queue name.');
|
|
|
|
|
throw new InvalidArgumentException('Argument 1 expected to be valid queue name.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|