Automatic pass to convert with php-cs-fixer
This commit is contained in:
@@ -1,33 +1,37 @@
|
||||
<?php
|
||||
|
||||
/** DomFramework
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
/**
|
||||
* DomFramework
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
|
||||
namespace Domframework;
|
||||
|
||||
/** Manage a queue in file
|
||||
* A process can add entries to the end of a queue
|
||||
* A process can get all the entries in a queue
|
||||
* A process can clear all the entries in a queue
|
||||
* A process can get the first entry in the queue (FIFO), with optional
|
||||
* removing of the entry
|
||||
* A process can get the last entry in the queue (LIFO), with optional
|
||||
* removing of the entry
|
||||
* A process can get X entries starting at position Y
|
||||
*/
|
||||
/**
|
||||
* Manage a queue in file
|
||||
* A process can add entries to the end of a queue
|
||||
* A process can get all the entries in a queue
|
||||
* A process can clear all the entries in a queue
|
||||
* A process can get the first entry in the queue (FIFO), with optional
|
||||
* removing of the entry
|
||||
* A process can get the last entry in the queue (LIFO), with optional
|
||||
* removing of the entry
|
||||
* A process can get X entries starting at position Y
|
||||
*/
|
||||
class Queuefile extends Queue
|
||||
{
|
||||
/** The queue connected object
|
||||
*/
|
||||
/**
|
||||
* The queue connected object
|
||||
*/
|
||||
private $queue = null;
|
||||
|
||||
/** Connect to the queue. Create it if not exists
|
||||
* @param string $dsn The DSN to connect to queue
|
||||
* @return $this;
|
||||
*/
|
||||
/**
|
||||
* Connect to the queue. Create it if not exists
|
||||
* @param string $dsn The DSN to connect to queue
|
||||
* @return $this;
|
||||
*/
|
||||
public function connect($dsn)
|
||||
{
|
||||
// The DSN format must be file:///tmp/queuefile.txt
|
||||
@@ -46,10 +50,11 @@ class Queuefile extends Queue
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** Add a new entry to the end of the queue
|
||||
* @param mixed $entry The entry to add
|
||||
* @return $this;
|
||||
*/
|
||||
/**
|
||||
* Add a new entry to the end of the queue
|
||||
* @param mixed $entry The entry to add
|
||||
* @return $this;
|
||||
*/
|
||||
public function add($entry)
|
||||
{
|
||||
$file = new File();
|
||||
@@ -63,10 +68,11 @@ class Queuefile extends Queue
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** Get all the entries of the queue
|
||||
* @param boolean|null $delete If true, delete the read entry
|
||||
* @return array
|
||||
*/
|
||||
/**
|
||||
* Get all the entries of the queue
|
||||
* @param boolean|null $delete If true, delete the read entry
|
||||
* @return array
|
||||
*/
|
||||
public function getAll($delete = false)
|
||||
{
|
||||
$file = new File();
|
||||
@@ -89,8 +95,9 @@ class Queuefile extends Queue
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/** Get the number of entries in the queue
|
||||
*/
|
||||
/**
|
||||
* Get the number of entries in the queue
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
$file = new File();
|
||||
@@ -101,9 +108,10 @@ class Queuefile extends Queue
|
||||
return $count;
|
||||
}
|
||||
|
||||
/** Clear all the entries of the queue
|
||||
* @return $this;
|
||||
*/
|
||||
/**
|
||||
* Clear all the entries of the queue
|
||||
* @return $this;
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$file = new File();
|
||||
@@ -113,11 +121,12 @@ class Queuefile extends Queue
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** Get the first entry in the queue with optional removing of the entry
|
||||
* @param boolean|null $delete If true, delete the read entry
|
||||
* @return mixed Return null if there is no entry, or the first entry in the
|
||||
* queue (FIFO)
|
||||
*/
|
||||
/**
|
||||
* Get the first entry in the queue with optional removing of the entry
|
||||
* @param boolean|null $delete If true, delete the read entry
|
||||
* @return mixed Return null if there is no entry, or the first entry in the
|
||||
* queue (FIFO)
|
||||
*/
|
||||
public function getFirst($delete = false)
|
||||
{
|
||||
$file = new File();
|
||||
@@ -146,11 +155,12 @@ class Queuefile extends Queue
|
||||
return $res;
|
||||
}
|
||||
|
||||
/** Get the last entry in the queue with optional removing of the entry
|
||||
* @param boolean|null $delete If true, delete the read entry
|
||||
* @return mixed Return null if there is no entry, or the last entry in the
|
||||
* queue (LIFO)
|
||||
*/
|
||||
/**
|
||||
* Get the last entry in the queue with optional removing of the entry
|
||||
* @param boolean|null $delete If true, delete the read entry
|
||||
* @return mixed Return null if there is no entry, or the last entry in the
|
||||
* queue (LIFO)
|
||||
*/
|
||||
public function getLast($delete = false)
|
||||
{
|
||||
$file = new File();
|
||||
@@ -179,13 +189,14 @@ class Queuefile extends Queue
|
||||
return $res;
|
||||
}
|
||||
|
||||
/** Get X entries starting at position Y
|
||||
* @param integer $start the starting position (the entries start at position
|
||||
* zero)
|
||||
* @param integer $number The number of entries to get
|
||||
* @param boolean|null $delete If true, delete the read entries
|
||||
* @return array An array of mixed entries
|
||||
*/
|
||||
/**
|
||||
* Get X entries starting at position Y
|
||||
* @param integer $start the starting position (the entries start at position
|
||||
* zero)
|
||||
* @param integer $number The number of entries to get
|
||||
* @param boolean|null $delete If true, delete the read entries
|
||||
* @return array An array of mixed entries
|
||||
*/
|
||||
public function getRange($start, $number, $delete = false)
|
||||
{
|
||||
$file = new File();
|
||||
@@ -198,7 +209,7 @@ class Queuefile extends Queue
|
||||
$entries = explode("\n", $content);
|
||||
// Explode return always one empty entry at end. Remove it
|
||||
array_pop($entries);
|
||||
$res = array();
|
||||
$res = [];
|
||||
if (count($entries) > 0) {
|
||||
for ($i = $start; $i < $start + $number; $i++) {
|
||||
if (! key_exists($i, $entries)) {
|
||||
|
||||
Reference in New Issue
Block a user