/usr/share/php/Horde/Imap/Client/Interaction/Pipeline.php is in php-horde-imap-client 2.29.12-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | <?php
/**
* Copyright 2013-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Horde
* @copyright 2013-2016 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Imap_Client
*/
/**
* An object representing a series of IMAP client commands (RFC 3501 [2.2.1])
* to be processed at the same time.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2013-2016 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Imap_Client
* @since 2.10.0
*
* @property-read boolean $finished True if all commands have finished.
*/
class Horde_Imap_Client_Interaction_Pipeline implements Countable, IteratorAggregate
{
/**
* Data storage from server responses.
*
* @var array
*/
public $data = array(
'modseqs' => array(),
'modseqs_nouid' => array()
);
/**
* Fetch results.
*
* @var Horde_Imap_Client_Fetch_Results
*/
public $fetch;
/**
* The list of commands.
*
* @var array
*/
protected $_commands = array();
/**
* The list of commands to complete.
*
* @var array
*/
protected $_todo = array();
/**
* Constructor.
*
* @param Horde_Imap_Client_Fetch_Results $fetch Fetch results object.
*/
public function __construct(Horde_Imap_Client_Fetch_Results $fetch)
{
$this->fetch = $fetch;
}
/**
*/
public function __get($name)
{
switch ($name) {
case 'finished':
return empty($this->_todo);
}
}
/**
* Add a command to the pipeline.
*
* @param Horde_Imap_Client_Interaction_Command $cmd Command object.
* @param boolean $top Add command to top
* of queue?
*/
public function add(Horde_Imap_Client_Interaction_Command $cmd,
$top = false)
{
if ($top) {
// This won't re-index keys, which may be numerical.
$this->_commands = array($cmd->tag => $cmd) + $this->_commands;
} else {
$this->_commands[$cmd->tag] = $cmd;
}
$this->_todo[$cmd->tag] = true;
}
/**
* Mark a command as completed.
*
* @param Horde_Imap_Client_Interaction_Server_Tagged $resp Tagged server
* response.
*
* @return Horde_Imap_Client_Interaction_Command Command that was
* completed. Returns null
* if tagged response
* is not contained in this
* pipeline object.
*/
public function complete(Horde_Imap_Client_Interaction_Server_Tagged $resp)
{
if (isset($this->_commands[$resp->tag])) {
$cmd = $this->_commands[$resp->tag];
$cmd->response = $resp;
unset($this->_todo[$resp->tag]);
} else {
/* This can be reached if a previous pipeline action was aborted,
* e.g. via an Exception. */
$cmd = null;
}
return $cmd;
}
/**
* Return the command for a given tag.
*
* @param string $tag The command tag.
*
* @return Horde_Imap_Client_Interaction_Command A command object (or
* null if the tag does
* not exist).
*/
public function getCmd($tag)
{
return isset($this->_commands[$tag])
? $this->_commands[$tag]
: null;
}
/* Countable methods. */
/**
*/
public function count()
{
return count($this->_commands);
}
/* IteratorAggregate methods. */
/**
*/
public function getIterator()
{
return new ArrayIterator($this->_commands);
}
}
|