CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • ActionDispatcher
  • BaseApplication
  • Client
  • ControllerFactory
  • CorsBuilder
  • MiddlewareQueue
  • Response
  • ResponseEmitter
  • Runner
  • Server
  • ServerRequest
  • ServerRequestFactory
  • Session

Class ResponseEmitter

Emits a Response to the PHP Server API.

This emitter offers a few changes from the emitters offered by diactoros:

  • It logs headers sent using CakePHP's logging tools.
  • Cookies are emitted using setcookie() to not conflict with ext/session
  • For fastcgi servers with PHP-FPM session_write_close() is called just before fastcgi_finish_request() to make sure session data is saved correctly (especially on slower session backends).
Cake\Http\ResponseEmitter implements Zend\Diactoros\Response\EmitterInterface
Namespace: Cake\Http
Location: Http/ResponseEmitter.php

Method Summary

  • emit() public
  • emitBody() protected
    Emit the message body.
  • emitBodyRange() protected
    Emit a range of the message body.
  • emitCookies() protected
    Emit cookies using setcookie()
  • emitHeaders() protected
    Emit response headers.
  • emitStatusLine() protected
    Emit the status line.
  • flush() protected

    Loops through the output buffer, flushing each, before emitting the response.

  • parseContentRange() protected

    Parse content-range header https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16

Method Detail

emit() public ¶

emit( Psr\Http\Message\ResponseInterface $response , $maxBufferLength = 8192 )

emitBody() protected ¶

emitBody( Psr\Http\Message\ResponseInterface $response , integer $maxBufferLength )

Emit the message body.

Parameters
Psr\Http\Message\ResponseInterface $response
The response to emit
integer $maxBufferLength
The chunk size to emit

emitBodyRange() protected ¶

emitBodyRange( array $range , Psr\Http\Message\ResponseInterface $response , integer $maxBufferLength )

Emit a range of the message body.

Parameters
array $range
The range data to emit
Psr\Http\Message\ResponseInterface $response
The response to emit
integer $maxBufferLength
The chunk size to emit

emitCookies() protected ¶

emitCookies( array $cookies )

Emit cookies using setcookie()

Parameters
array $cookies
An array of Set-Cookie headers.

emitHeaders() protected ¶

emitHeaders( Psr\Http\Message\ResponseInterface $response )

Emit response headers.

Loops through each header, emitting each; if the header value is an array with multiple values, ensures that each is sent in such a way as to create aggregate headers (instead of replace the previous).

Parameters
Psr\Http\Message\ResponseInterface $response
The response to emit

emitStatusLine() protected ¶

emitStatusLine( Psr\Http\Message\ResponseInterface $response )

Emit the status line.

Emits the status line using the protocol version and status code from the response; if a reason phrase is available, it, too, is emitted.

Parameters
Psr\Http\Message\ResponseInterface $response
The response to emit

flush() protected ¶

flush( integer|null $maxBufferLevel = null )

Loops through the output buffer, flushing each, before emitting the response.

Parameters
integer|null $maxBufferLevel optional null
Flush up to this buffer level.

parseContentRange() protected ¶

parseContentRange( string $header )

Parse content-range header https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16

Parameters
string $header
The Content-Range header to parse.
Returns
array|false

[unit, first, last, length]; returns false if no content range or an invalid content range is provided


Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs