public function addwork(array $new_work_units, $identifier = '', $bucket = self::DEFAULT_BUCKET, $sort_queue = false)
	{
		// ensure bucket is setup before we try to add data to it
		if (!array_key_exists($bucket, $this->work_units))
		{
			$this->add_bucket($bucket);
		}

		// add to queue to send
		if ($this->child_single_work_item[$bucket])
		{
			// prepend identifier with 'id-' because array_splice() re-arranges numeric keys
			$this->work_units[$bucket]['id-' . $identifier] = $new_work_units;
		}
		elseif ($new_work_units === null || sizeof($new_work_units) === 0)
		{
			// no work
		}
		else
		{
			// merge in the new work units
			$this->work_units[$bucket] = array_merge($this->work_units[$bucket], $new_work_units);
		}

		// sort the queue
		if ($sort_queue)
		{
			ksort($this->work_units[$bucket]);
		}

		return;
	}
public function addwork(array $new_work_units, $identifier = '', $bucket = self::DEFAULT_BUCKET, $sort_queue = false)
	{
		// ensure bucket is setup before we try to add data to it
		if (!array_key_exists($bucket, $this->work_units))
		{
			$this->add_bucket($bucket);
		}

		// add to queue to send
		if ($this->child_single_work_item[$bucket])
		{
			// prepend identifier with 'id-' because array_splice() re-arranges numeric keys
			$this->work_units[$bucket]['id-' . $identifier] = $new_work_units;
		}
		elseif ($new_work_units === null || sizeof($new_work_units) === 0)
		{
			// no work
		}
		else
		{
			// merge in the new work units
			$this->work_units[$bucket] = array_merge($this->work_units[$bucket], $new_work_units);
		}

		// sort the queue
		if ($sort_queue)
		{
			ksort($this->work_units[$bucket]);
		}

		return;
	}
public function addwork ( array $ new_work_units , $ identifier = '' , $ bucket = self :: DEFAULT_BUCKET , $ sort_queue = false ) { // ensure bucket is setup before we try to add data to it if ( ! array_key_exists ( $ bucket , $ this -> work_units ) ) { $ this -> add_bucket ( $ bucket ) ; } // add to queue to send if ( $ this -> child_single_work_item [ $ bucket ] ) { // prepend identifier with 'id-' because array_splice() re-arranges numeric keys $ this -> work_units [ $ bucket ] [ 'id-' . $ identifier ] = $ new_work_units ; } elseif ( $ new_work_units === null || sizeof ( $ new_work_units ) === 0 ) { // no work } else { // merge in the new work units $ this -> work_units [ $ bucket ] = array_merge ( $ this -> work_units [ $ bucket ] , $ new_work_units ) ; } // sort the queue if ( $ sort_queue ) { ksort ( $ this -> work_units [ $ bucket ] ) ; } return ; }
Add work to the group of work to be processed

@param array  $new_work_units Array of items to be handed back to child in chunks.
@param string $identifier     A unique identifier for this work.
@param int    $bucket         The bucket to use.
@param bool   $sort_queue     True to sort the work unit queue.
@return void
Add work to the group of work to be processed