Overview

Namespaces

  • Peach
    • DF
    • DT
    • Http
      • Body
      • Header
    • Markup
    • Util

Classes

  • Peach\DF\Base64Codec
  • Peach\DF\CodecChain
  • Peach\DF\JsonCodec
  • Peach\DF\SerializationCodec
  • Peach\DF\Utf8Codec
  • Peach\DT\AbstractTime
  • Peach\DT\Clock
  • Peach\DT\Date
  • Peach\DT\Datetime
  • Peach\DT\DefaultClock
  • Peach\DT\FixedClock
  • Peach\DT\FormatWrapper
  • Peach\DT\HttpDateFormat
  • Peach\DT\OffsetClock
  • Peach\DT\ShiftFormat
  • Peach\DT\SimpleFormat
  • Peach\DT\TimeEquator
  • Peach\DT\Timestamp
  • Peach\DT\TimeWrapper
  • Peach\DT\UnixTimeFormat
  • Peach\DT\Util
  • Peach\DT\W3cDatetimeFormat
  • Peach\Http\Body
  • Peach\Http\Body\CodecRenderer
  • Peach\Http\Body\StringRenderer
  • Peach\Http\DefaultEndpoint
  • Peach\Http\Header\CookieItem
  • Peach\Http\Header\CookieOptions
  • Peach\Http\Header\HttpDate
  • Peach\Http\Header\NoField
  • Peach\Http\Header\QualityValues
  • Peach\Http\Header\Raw
  • Peach\Http\Header\SetCookie
  • Peach\Http\Header\Status
  • Peach\Http\Request
  • Peach\Http\Response
  • Peach\Http\Util
  • Peach\Markup\AbstractHelper
  • Peach\Markup\AbstractRenderer
  • Peach\Markup\BaseHelper
  • Peach\Markup\BreakControlWrapper
  • Peach\Markup\Builder
  • Peach\Markup\Code
  • Peach\Markup\Comment
  • Peach\Markup\ContainerElement
  • Peach\Markup\Context
  • Peach\Markup\DebugBuilder
  • Peach\Markup\DebugContext
  • Peach\Markup\DefaultBreakControl
  • Peach\Markup\DefaultBuilder
  • Peach\Markup\DefaultContext
  • Peach\Markup\Element
  • Peach\Markup\EmptyElement
  • Peach\Markup\HelperObject
  • Peach\Markup\HtmlHelper
  • Peach\Markup\Indent
  • Peach\Markup\MinimalBreakControl
  • Peach\Markup\NameBreakControl
  • Peach\Markup\NameValidator
  • Peach\Markup\NodeList
  • Peach\Markup\None
  • Peach\Markup\SgmlRenderer
  • Peach\Markup\Text
  • Peach\Markup\XmlRenderer
  • Peach\Util\AbstractMapEntry
  • Peach\Util\ArrayMap
  • Peach\Util\ArrayMapEntry
  • Peach\Util\Arrays
  • Peach\Util\DefaultComparator
  • Peach\Util\DefaultEquator
  • Peach\Util\HashMap
  • Peach\Util\HashMapEntry
  • Peach\Util\Strings
  • Peach\Util\Values

Interfaces

  • Peach\DF\Codec
  • Peach\DT\Format
  • Peach\DT\Time
  • Peach\Http\BodyRenderer
  • Peach\Http\Endpoint
  • Peach\Http\HeaderField
  • Peach\Http\MultiHeaderField
  • Peach\Http\SingleHeaderField
  • Peach\Markup\BreakControl
  • Peach\Markup\Component
  • Peach\Markup\Container
  • Peach\Markup\Helper
  • Peach\Markup\Node
  • Peach\Markup\Renderer
  • Peach\Util\Comparable
  • Peach\Util\Comparator
  • Peach\Util\Equator
  • Peach\Util\Map
  • Peach\Util\MapEntry
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: /*
 4:  * Copyright (c) 2015 @trashtoy
 5:  * https://github.com/trashtoy/
 6:  * 
 7:  * Permission is hereby granted, free of charge, to any person obtaining a copy of
 8:  * this software and associated documentation files (the "Software"), to deal in
 9:  * the Software without restriction, including without limitation the rights to use,
10:  * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
11:  * Software, and to permit persons to whom the Software is furnished to do so,
12:  * subject to the following conditions:
13:  * 
14:  * The above copyright notice and this permission notice shall be included in all
15:  * copies or substantial portions of the Software.
16:  * 
17:  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18:  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19:  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20:  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21:  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22:  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23:  */
24: /**
25:  * PHP class file.
26:  * @auhtor trashtoy
27:  * @since  2.2.0
28:  */
29: namespace Peach\Http\Body;
30: 
31: use Peach\DF\Codec;
32: use Peach\Http\BodyRenderer;
33: 
34: /**
35:  * Codec オブジェクトの Adapter として機能する Renderer クラスです.
36:  * このクラスの render メソッドは, インスタンス初期化時に指定した Codec オブジェクトの encode()
37:  * メソッドを実行して値を文字列に変換します.
38:  */
39: class CodecRenderer implements BodyRenderer
40: {
41:     /**
42:      * render() 内で値を文字列に変換するための Codec です.
43:      * 
44:      * @var Codec
45:      */
46:     private $codec;
47:     
48:     /**
49:      * 指定された Codec オブジェクトを使って render を行う CodecRenderer オブジェクトを構築します.
50:      * 
51:      * @param Codec $codec 任意の値を文字列に変換する Codec
52:      */
53:     public function __construct(Codec $codec)
54:     {
55:         $this->codec = $codec;
56:     }
57:     
58:     /**
59:      * このオブジェクトに登録されている Codec を使用して引数の値を文字列に変換します.
60:      * 
61:      * @param  mixed $var 変換対象の値
62:      * @return string     変換結果
63:      */
64:     public function render($var)
65:     {
66:         return $this->codec->encode($var);
67:     }
68: }
69: 
PEACH2 API documentation generated by ApiGen