API Documentation

Controller/Response/Cli.php

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Controller  
version
$Id: Cli.php 23775 2011-03-01 17:25:24Z ralph $  

\Zend_Controller_Response_Cli

Zend_Controller_Response_Cli

CLI response for controllers

Extends from
\Zend_Controller_Response_Abstract
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Controller  
subpackage
Response  
uses
\Zend_Controller_Response_Abstract  

Properties

Propertypublicboolean  $headersSentThrowsException= 'false'

Flag; if true, when header operations are called after headers have been sent, an exception will be raised; otherwise, processing will continue as normal. Defaults to false.

Default valuefalseDetails
Type
boolean
see
\canSendHeaders()  

Methods

methodpublic__toString( ) : string

Magic __toString functionality

Proxies to {@link sendResponse()} and returns response value as string using output buffering.

Returns
Type Description
string
methodprotected_normalizeHeader( string $name ) : string

Normalize a header name

Inherited from: \Zend_Controller_Response_Abstract::_normalizeHeader()

Normalizes a header name to X-Capitalized-Names

Parameters
Name Type Description
$name string
Returns
Type Description
string
methodpublicappend( string $name, string $content ) : \Zend_Controller_Response_Abstract

Append a named body segment to the body content array

Inherited from: \Zend_Controller_Response_Abstract::append()

If segment already exists, replaces with $content and places at end of array.

Parameters
Name Type Description
$name string
$content string
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicappendBody( string $content, null|string $name = null ) : \Zend_Controller_Response_Abstract

Append content to the body content

Inherited from: \Zend_Controller_Response_Abstract::appendBody()
Parameters
Name Type Description
$content string
$name null|string
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpubliccanSendHeaders( boolean $throw = false ) : boolean

Can we send headers?

Inherited from: \Zend_Controller_Response_Abstract::canSendHeaders()
Parameters
Name Type Description
$throw boolean Whether or not to throw an exception if headers have been sent; defaults to false
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Controller_Response_Exception
methodpublicclearAllHeaders( ) : \Zend_Controller_Response_Abstract

Clear all headers, normal and raw

Inherited from: \Zend_Controller_Response_Abstract::clearAllHeaders()
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicclearBody( string $name = null ) : boolean

Clear body array

Inherited from: \Zend_Controller_Response_Abstract::clearBody()

With no arguments, clears the entire body array. Given a $name, clears just that named segment; if no segment matching $name exists, returns false to indicate an error.

Parameters
Name Type Description
$name string Named segment to clear
Returns
Type Description
boolean
methodpublicclearHeader( string $name ) : \Zend_Controller_Response_Abstract

Clears the specified HTTP header

Inherited from: \Zend_Controller_Response_Abstract::clearHeader()
Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicclearRawHeader( string $headerRaw ) : \Zend_Controller_Response_Abstract

Clears the specified raw HTTP header

Inherited from: \Zend_Controller_Response_Abstract::clearRawHeader()
Parameters
Name Type Description
$headerRaw string
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicclearRawHeaders( ) : \Zend_Controller_Response_Abstract

Clear all {@link setRawHeader() raw HTTP headers}

Inherited from: \Zend_Controller_Response_Abstract::clearRawHeaders()
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicgetBody( boolean $spec = false ) : string|array|null

Return the body content

Inherited from: \Zend_Controller_Response_Abstract::getBody()

If $spec is false, returns the concatenated values of the body content array. If $spec is boolean true, returns the body content array. If $spec is a string and matches a named segment, returns the contents of that segment; otherwise, returns null.

Parameters
Name Type Description
$spec boolean
Returns
Type Description
stringarraynull
methodpublicgetException( ) : array

Retrieve the exception stack

Inherited from: \Zend_Controller_Response_Abstract::getException()
Returns
Type Description
array
methodpublicgetExceptionByCode( mixed $code ) : void

Retrieve all exceptions of a given code

Inherited from: \Zend_Controller_Response_Abstract::getExceptionByCode()
Parameters
Name Type Description
$code mixed
methodpublicgetExceptionByMessage( string $message ) : false|array

Retrieve all exceptions of a given message

Inherited from: \Zend_Controller_Response_Abstract::getExceptionByMessage()
Parameters
Name Type Description
$message string
Returns
Type Description
falsearray
methodpublicgetExceptionByType( string $type ) : false|array

Retrieve all exceptions of a given type

Inherited from: \Zend_Controller_Response_Abstract::getExceptionByType()
Parameters
Name Type Description
$type string
Returns
Type Description
falsearray
methodpublicgetHeaders( ) : array

Return array of headers; see {@link $_headers} for format

Inherited from: \Zend_Controller_Response_Abstract::getHeaders()
Returns
Type Description
array
methodpublicgetHttpResponseCode( ) : int

Retrieve HTTP response code

Inherited from: \Zend_Controller_Response_Abstract::getHttpResponseCode()
Returns
Type Description
int
methodpublicgetRawHeaders( ) : array

Retrieve all {@link setRawHeader() raw HTTP headers}

Inherited from: \Zend_Controller_Response_Abstract::getRawHeaders()
Returns
Type Description
array
methodpublichasExceptionOfCode( int $code ) : boolean

Does the response object contain an exception with a given code?

Inherited from: \Zend_Controller_Response_Abstract::hasExceptionOfCode()
Parameters
Name Type Description
$code int
Returns
Type Description
boolean
methodpublichasExceptionOfMessage( string $message ) : boolean

Does the response object contain an exception with a given message?

Inherited from: \Zend_Controller_Response_Abstract::hasExceptionOfMessage()
Parameters
Name Type Description
$message string
Returns
Type Description
boolean
methodpublichasExceptionOfType( string $type ) : boolean

Does the response object contain an exception of a given type?

Inherited from: \Zend_Controller_Response_Abstract::hasExceptionOfType()
Parameters
Name Type Description
$type string
Returns
Type Description
boolean
methodpublicinsert( string $name, string $content, string $parent = null, boolean $before = false ) : \Zend_Controller_Response_Abstract

Insert a named segment into the body content array

Inherited from: \Zend_Controller_Response_Abstract::insert()
Parameters
Name Type Description
$name string
$content string
$parent string
$before boolean

Whether to insert the new segment before or after the parent. Defaults to false (after)

Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicisException( ) : boolean

Has an exception been registered with the response?

Inherited from: \Zend_Controller_Response_Abstract::isException()
Returns
Type Description
boolean
methodpublicisRedirect( ) : boolean

Is this a redirect?

Inherited from: \Zend_Controller_Response_Abstract::isRedirect()
Returns
Type Description
boolean
methodpublicoutputBody( ) : void

Echo the body segments

Inherited from: \Zend_Controller_Response_Abstract::outputBody()
methodpublicprepend( string $name, string $content ) : void

Prepend a named body segment to the body content array

Inherited from: \Zend_Controller_Response_Abstract::prepend()

If segment already exists, replaces with $content and places at top of array.

Parameters
Name Type Description
$name string
$content string
methodpublicrenderExceptions( boolean $flag = null ) : boolean

Whether or not to render exceptions (off by default)

Inherited from: \Zend_Controller_Response_Abstract::renderExceptions()

If called with no arguments or a null argument, returns the value of the flag; otherwise, sets it and returns the current value.

Parameters
Name Type Description
$flag boolean Optional
Returns
Type Description
boolean
methodpublicsendHeaders( ) : \Zend_Controller_Response_Abstract

Send all headers

Inherited from: \Zend_Controller_Response_Abstract::sendHeaders()

Sends any headers specified. If an {@link setHttpResponseCode() HTTP response code} has been specified, it is sent with the first header.

Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicsendResponse( ) : void

Send the response, including all headers, rendering exceptions if so requested.

Inherited from: \Zend_Controller_Response_Abstract::sendResponse()
methodpublicsetBody( string $content, null|string $name = null ) : \Zend_Controller_Response_Abstract

Set body content

Inherited from: \Zend_Controller_Response_Abstract::setBody()

If $name is not passed, or is not a string, resets the entire body and sets the 'default' key to $content.

If $name is a string, sets the named segment in the body array to $content.

Parameters
Name Type Description
$content string
$name null|string
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicsetException( \Exception $e ) : \Zend_Controller_Response_Abstract

Register an exception with the response

Inherited from: \Zend_Controller_Response_Abstract::setException()
Parameters
Name Type Description
$e \Exception
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicsetHeader( string $name, string $value, boolean $replace = false ) : \Zend_Controller_Response_Abstract

If $replace is true, replaces any headers already defined with that $name.

Parameters
Name Type Description
$name string
$value string
$replace boolean
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicsetHttpResponseCode( int $code ) : \Zend_Controller_Response_Abstract

Set HTTP response code to use with headers

Inherited from: \Zend_Controller_Response_Abstract::setHttpResponseCode()
Parameters
Name Type Description
$code int
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicsetRawHeader( string $value ) : \Zend_Controller_Response_Abstract

Set raw HTTP header

Inherited from: \Zend_Controller_Response_Abstract::setRawHeader()

Allows setting non key => value headers, such as status codes

Parameters
Name Type Description
$value string
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicsetRedirect( string $url, int $code = 302 ) : \Zend_Controller_Response_Abstract

Set redirect URL

Inherited from: \Zend_Controller_Response_Abstract::setRedirect()

Sets Location header and response code. Forces replacement of any prior redirects.

Parameters
Name Type Description
$url string
$code int
Returns
Type Description
\Zend_Controller_Response_Abstract
Documentation was generated by DocBlox 0.13.3.