/** * Creates a new response object. * * The response is constructed from either a {@link ezcWebdavCollection} or * a {@link ezcWebdavResource} as the first parameter and a finite amount * of {@link ezcWebdavPropStatResponse}s as additional parameters. * * @param ezcWebdavResource|ezcWebdavCollection $node * @return void */ public function __construct($node) { parent::__construct(ezcWebdavResponse::STATUS_200); $this->node = $node; // Add all ezcWebdavPropStatResponse $params = func_get_args(); $responses = array(); foreach ($params as $nr => $param) { // Flatten array structure, if given if (is_array($param)) { foreach ($param as $value) { if ($value instanceof ezcWebdavPropStatResponse) { $responses[] = $value; } } continue; } // Also add plain params if ($param instanceof ezcWebdavPropStatResponse) { $responses[] = $param; } } // If it actually consists of multiple sub responses be of type 207. if (count($responses) > 0) { $this->status = ezcWebdavResponse::STATUS_207; } $this->responses = $responses; }
/** * Creates a new response object. * * Creates a new LOCK response object using the given $lockDiscovery * property. If the $lockToken parameter is not null, the response will * have the Lock-Token header set, which must not occur for refreshing of * locks, but must occur for new locks. * * @param ezcWebdavLockDiscoveryProperty $lockDiscovery * @param int $status Constant ezcWebdavResponse::STATUS_* * @param string $lockToken */ public function __construct(ezcWebdavLockDiscoveryProperty $lockDiscovery, $status = ezcWebdavResponse::STATUS_200, $lockToken = null) { parent::__construct($status); $this->lockDiscovery = $lockDiscovery; if ($lockToken !== null) { $this->setHeader('Lock-Token', $lockToken); } }
/** * Creates a new response object. * * The $replaced parameter must indicate wether the target has been * overwritten during the copy process. * * @param bool $replaced * @return void */ public function __construct($replaced) { $this->replaced = $replaced; if ($replaced) { parent::__construct(ezcWebdavResponse::STATUS_204); } else { parent::__construct(ezcWebdavResponse::STATUS_201); } }
/** * Creates a new response object. * * Creates a new error response, with the given $status code, which refers * to the resource identified by $requestUri. Further details about the * error may be provided in $desc. * * @param int $status * @param string $requestUri * @param string $desc * @return void */ public function __construct($status, $requestUri = null, $desc = null) { parent::__construct($status); // Initialize property $this->properties['requestUri'] = null; if ($requestUri !== null) { $this->requestUri = $requestUri; } if ($desc !== null) { $this->responseDescription = $desc; } }
/** * Creates a new response object. * * Any number of {@link ezcWebdavResponse} objects may be passed as * parameters to the constructer. * * @return void */ public function __construct() { parent::__construct(ezcWebdavResponse::STATUS_207); $params = func_get_args(); $responses = array(); foreach ($params as $param) { // Flatten array structure, if given if (is_array($param)) { foreach ($param as $value) { $responses[] = $value; } continue; } // Just add everything else $responses[] = $param; } $this->responses = $responses; }
/** * Creates a new response object. * * @return void */ public function __construct() { parent::__construct(ezcWebdavResponse::STATUS_201); }
/** * Creates a new response object. * * Construct head response for {@link ezcWebdavResource} or {@link * ezcWebdavCollection}. * * @param ezcWebdavResource|ezcWebdavCollection $resource * @return void */ public function __construct($resource) { parent::__construct(ezcWebdavResponse::STATUS_200); $this->resource = $resource; }
/** * Creates a new response object. * * Creates a new repsonse object for the given $collection resource. * * @param ezcWebdavCollection $collection * @return void */ public function __construct(ezcWebdavCollection $collection) { parent::__construct(ezcWebdavResponse::STATUS_200); $this->collection = $collection; $this->setHeader('Content-Length', '4096'); }
/** * Creates a new response object. * * Creates a new response object, that indicates the given WebDAV $version * to be supported by the server. * * @param string $version * @return void */ public function __construct($version = null) { parent::__construct(ezcWebdavResponse::STATUS_200); $this->setHeader('DAV', $version === null ? '1' : $version); }
/** * Creates a new response object. * * Creates PROPSTAT response, which will be aggregated in a {@link * ezcWebdavPropFindResponse} from a property storage ($storage) and * optionally an error stutus code, which will default to 200(OK). * * @param ezcWebdavPropertyStorage $storage * @param int $status * @return void */ public function __construct(ezcWebdavPropertyStorage $storage, $status = ezcWebdavResponse::STATUS_200) { parent::__construct($status); $this->storage = $storage; }