CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.6 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.6
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 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

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
      • Client
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Class
ResponseTransformer

This class converts PSR7 responses into CakePHP ones and back again.

By bridging the CakePHP and PSR7 responses together, applications can be embedded as PSR7 middleware in a fully compatible way.

Namespace: Cake\Http
Deprecated: 3.4.0 No longer used. Will be removed in 4.0.0

Method Summary

  • buildCookieHeader() protected static

    Convert an array of cookies into header lines.

  • collapseHeaders() protected static

    Convert a PSR7 Response headers into a flat array

  • getBody() protected static

    Get the response body from a PSR7 Response.

  • getStream() protected static

    Get the stream for the new response.

  • parseCookies() protected static

    Parse the Set-Cookie headers in a PSR7 response into the format CakePHP expects.

  • setContentType() protected static

    Add in the Content-Type header if necessary.

  • toCake() public static

    Convert a PSR7 Response into a CakePHP one.

  • toPsr() public static

    Convert a CakePHP response into a PSR7 one.

Method Detail

buildCookieHeader() ¶ protected static

buildCookieHeader(array $cookies): array

Convert an array of cookies into header lines.

Parameters
array $cookies

The cookies to serialize.

Returns
array

collapseHeaders() ¶ protected static

collapseHeaders(Psr\Http\Message\ResponseInterface $response): array

Convert a PSR7 Response headers into a flat array

Parameters
Psr\Http\Message\ResponseInterface $response

The response to convert.

Returns
array

getBody() ¶ protected static

getBody(Psr\Http\Message\ResponseInterface $response): array

Get the response body from a PSR7 Response.

Parameters
Psr\Http\Message\ResponseInterface $response

The response to convert.

Returns
array

getStream() ¶ protected static

getStream(Cake\Http\Response $response): Psr\Http\Message\StreamInterface|string

Get the stream for the new response.

Parameters
Cake\Http\Response $response

The cake response to extract the body from.

Returns
Psr\Http\Message\StreamInterface|string

parseCookies() ¶ protected static

parseCookies(array $cookieHeader): array

Parse the Set-Cookie headers in a PSR7 response into the format CakePHP expects.

Parameters
array $cookieHeader

A list of Set-Cookie headers.

Returns
array

setContentType() ¶ protected static

setContentType(array $headers, Cake\Http\Response $response): array

Add in the Content-Type header if necessary.

Parameters
array $headers

The headers to update

Cake\Http\Response $response

The CakePHP response to convert

Returns
array

toCake() ¶ public static

toCake(Psr\Http\Message\ResponseInterface $response): Cake\Http\Response

Convert a PSR7 Response into a CakePHP one.

Parameters
Psr\Http\Message\ResponseInterface $response

The response to convert.

Returns
Cake\Http\Response

toPsr() ¶ public static

toPsr(Cake\Http\Response $response): Psr\Http\Message\ResponseInterface

Convert a CakePHP response into a PSR7 one.

Parameters
Cake\Http\Response $response

The CakePHP response to convert

Returns
Psr\Http\Message\ResponseInterface
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs