*/
class JobQueueMemory extends JobQueue {
/** @var array[] */
- protected static $data = array();
+ protected static $data = [];
/**
* @see JobQueue::doBatchPush
* @param int $flags
*/
protected function doBatchPush( array $jobs, $flags ) {
- $unclaimed =& $this->getQueueData( 'unclaimed', array() );
+ $unclaimed =& $this->getQueueData( 'unclaimed', [] );
foreach ( $jobs as $job ) {
if ( $job->ignoreDuplicates() ) {
* @return string[]
*/
protected function supportedOrders() {
- return array( 'random', 'timestamp', 'fifo' );
+ return [ 'random', 'timestamp', 'fifo' ];
}
/**
}
$unclaimed =& $this->getQueueData( 'unclaimed' );
- $claimed =& $this->getQueueData( 'claimed', array() );
+ $claimed =& $this->getQueueData( 'claimed', [] );
if ( $this->order === 'random' ) {
$key = array_rand( $unclaimed );
public function getAllQueuedJobs() {
$unclaimed = $this->getQueueData( 'unclaimed' );
if ( !$unclaimed ) {
- return new ArrayIterator( array() );
+ return new ArrayIterator( [] );
}
- $that = $this;
return new MappedIterator(
$unclaimed,
- function ( $value ) use ( $that ) {
- $that->jobFromSpecInternal( $value );
+ function ( $value ) {
+ $this->jobFromSpecInternal( $value );
}
);
}
public function getAllAcquiredJobs() {
$claimed = $this->getQueueData( 'claimed' );
if ( !$claimed ) {
- return new ArrayIterator( array() );
+ return new ArrayIterator( [] );
}
- $that = $this;
return new MappedIterator(
$claimed,
- function ( $value ) use ( $that ) {
- $that->jobFromSpecInternal( $value );
+ function ( $value ) {
+ $this->jobFromSpecInternal( $value );
}
);
}