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:  * Copyright (c) 2015 @trashtoy
  4:  * https://github.com/trashtoy/
  5:  * 
  6:  * Permission is hereby granted, free of charge, to any person obtaining a copy of
  7:  * this software and associated documentation files (the "Software"), to deal in
  8:  * the Software without restriction, including without limitation the rights to use,
  9:  * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
 10:  * Software, and to permit persons to whom the Software is furnished to do so,
 11:  * subject to the following conditions:
 12:  * 
 13:  * The above copyright notice and this permission notice shall be included in all
 14:  * copies or substantial portions of the Software.
 15:  * 
 16:  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 17:  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 18:  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 19:  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 20:  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 21:  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 22:  */
 23: /**
 24:  * PHP class file.
 25:  * @auhtor trashtoy
 26:  * @since  2.2.0
 27:  */
 28: namespace Peach\Http\Header;
 29: 
 30: use Peach\Http\SingleHeaderField;
 31: use Peach\Http\Util;
 32: use Peach\DT\Timestamp;
 33: use Peach\DT\HttpDateFormat;
 34: 
 35: /**
 36:  * Last-Modified や If-Modified-Since など, HTTP-date 形式の値を持つヘッダーです.
 37:  */
 38: class HttpDate implements SingleHeaderField
 39: {
 40:     /**
 41:      * ヘッダー名をあらわす文字列です.
 42:      * @var string
 43:      */
 44:     private $name;
 45:     
 46:     /**
 47:      * このヘッダーがあらわす時刻です. GMT ではなくこのシステムのタイムゾーンを基準とします.
 48:      * @var Timestamp
 49:      */
 50:     private $time;
 51:     
 52:     /**
 53:      * このヘッダーの時刻を書式化するための HttpDateFormat です.
 54:      * @var HttpDateFormat
 55:      */
 56:     private $format;
 57:     
 58:     /**
 59:      * 指定されたヘッダー名および時刻を持つ HttpDate オブジェクトを構築します.
 60:      * オプションとして第 3 引数に任意の HttpDateFormat を指定することができます.
 61:      * デフォルトではシステムのタイムゾーンを基準としてヘッダーを書式化しますが,
 62:      * 特定のタイムゾーンを基準にしたい場合に使用してください.
 63:      * 
 64:      * @param string         $name   ヘッダー名
 65:      * @param Timestamp      $time   時刻 (GMT ではなくシステムのタイムゾーンを基準とする)
 66:      * @param HttpDateFormat $format ヘッダー値を書式化するための HttpDateFormat
 67:      */
 68:     public function __construct($name, Timestamp $time, HttpDateFormat $format = null)
 69:     {
 70:         Util::validateHeaderName($name);
 71:         $this->name   = $name;
 72:         $this->time   = $time;
 73:         $this->format = ($format === null) ? HttpDateFormat::getInstance() : $format;
 74:     }
 75:     
 76:     /**
 77:      * このヘッダーの時刻を HTTP-date 形式で書式化します.
 78:      * 
 79:      * @return string HTTP-date 形式の文字列
 80:      */
 81:     public function format()
 82:     {
 83:         return $this->time->format($this->format);
 84:     }
 85:     
 86:     /**
 87:      * このヘッダーの名前を返します.
 88:      * 
 89:      * @return string ヘッダー名
 90:      */
 91:     public function getName()
 92:     {
 93:         return $this->name;
 94:     }
 95:     
 96:     /**
 97:      * このヘッダーが表現する時刻を返します.
 98:      * 
 99:      * @return Timestamp このヘッダーが表現する時刻
100:      */
101:     public function getValue()
102:     {
103:         return $this->time;
104:     }
105: }
106: 
PEACH2 API documentation generated by ApiGen