It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.
If you suppress an error, we recommend checking for the error condition explicitly:
// For example instead of@mkdir($dir);// Better useif(@mkdir($dir)===false){thrownew\RuntimeException('The directory '.$dir.' could not be created.');}
Loading history...
17
}
18
19
/**
20
* Pushes a message to the end of the cache.
21
*
22
* @param string $queueName
23
*/
24
public function push($queueName, Message $message)
25
{
26
$cache = $this->get($queueName);
27
$cache->enqueue($message);
28
}
29
30
/**
31
* Get the next message in line. Or nothing if there is no more
32
* in the cache.
33
*
34
* @param string $queueName
35
*
36
* @return Message|null
37
*/
38
public function pop($queueName)
39
{
40
$cache = $this->get($queueName);
41
42
if (!$cache->isEmpty()) {
43
return $cache->dequeue();
44
}
45
}
46
47
/**
48
* Create the queue cache internally if it doesn't yet exists.
49
*
50
* @param string $queueName
51
*
52
* @return \SplQueue
53
*/
54
protected function get($queueName)
55
{
56
if (isset($this->caches[$queueName])) {
57
return $this->caches[$queueName];
58
}
59
60
return $this->caches[$queueName] = new \SplQueue();
This class, trait or interface has been deprecated.