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) 2014 @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.0.0
 27:  */
 28: namespace Peach\Markup;
 29: use Peach\Util\Values;
 30: 
 31: /**
 32:  * マークアップ言語のコメントをあらわすクラスです.
 33:  * 単なるコメントとしての用途だけでなく, 任意のノードをコメントアウトすることも出来ます.
 34:  */
 35: class Comment implements Container, Node
 36: {
 37:     /**
 38:      * 子ノードの一覧です.
 39:      * @var NodeList
 40:      */
 41:     private $nodeList;
 42:     
 43:     /**
 44:      * コメントの先頭に付与される文字列です.
 45:      * この値がセットされている場合, コメントの先頭は
 46:      * "<!--prefix" のようにレンダリングされます.
 47:      * 
 48:      * @var string
 49:      */
 50:     private $prefix;
 51:     
 52:     /**
 53:      * コメントの末尾に付与される文字列です.
 54:      * この値がセットされている場合, コメントの末尾は
 55:      * "suffix-->" のようにレンダリングされます.
 56:      * 
 57:      * @var string
 58:      */
 59:     private $suffix;
 60:     
 61:     /**
 62:      * 指定された prefix と suffix を持つ Comment オブジェクトを構築します.
 63:      * prefix と suffix は, 主に条件付きコメントの先頭 ("[if IE 6]>" など) と
 64:      * 末尾 ("<![endif]" など) に使用されます.
 65:      * 引数を指定しない場合は通常のコメントノードを生成します.
 66:      * 
 67:      * @param string $prefix コメントの冒頭 ("[if IE 6]>" など)
 68:      * @param string $suffix コメントの末尾 ("<![endif]" など)
 69:      */
 70:     public function __construct($prefix = "", $suffix = "")
 71:     {
 72:         $this->nodeList = new NodeList(null, $this);
 73:         $this->prefix   = Values::stringValue($prefix);
 74:         $this->suffix   = Values::stringValue($suffix);
 75:     }
 76:     
 77:     /**
 78:      * コメントの冒頭の文字列を返します.
 79:      * 
 80:      * @return string コメントの冒頭文字列. 存在しない場合は空文字列
 81:      */
 82:     public function getPrefix()
 83:     {
 84:         return $this->prefix;
 85:     }
 86:     
 87:     /**
 88:      * コメントの末尾の文字列を返します.
 89:      * 
 90:      * @return string コメントの末尾の文字列. 存在しない場合は空文字列
 91:      */
 92:     public function getSuffix()
 93:     {
 94:         return $this->suffix;
 95:     }
 96:     
 97:     /**
 98:      * 指定された Context にこのノードを処理させます.
 99:      * {@link Context::handleComment()} を呼び出します.
100:      * 
101:      * @param Context $context このノードを処理する Context
102:      */
103:     public function accept(Context $context)
104:     {
105:         $context->handleComment($this);
106:     }
107:     
108:     /**
109:      * このコメントにテキストまたはノードを追加します.
110:      * ノードを追加した場合, このコメントノードは引数のノードのコメントアウトとして働きます.
111:      * @param mixed $var このコメントに追加するテキストまたはノード
112:      */
113:     public function appendNode($var)
114:     {
115:         $this->nodeList->appendNode($var);
116:     }
117:     
118:     /**
119:      * このコメントノードに含まれる子ノードの一覧を返します.
120:      * 
121:      * @return array 子ノードの一覧
122:      */
123:     public function getChildNodes()
124:     {
125:         return $this->nodeList->getChildNodes();
126:     }
127:     
128:     /**
129:      * このオブジェクトを {@link Container::appendNode()} に指定した場合,
130:      * このオブジェクト自身が追加されます.
131:      * 
132:      * @return NodeList このオブジェクトを 1 つだけ含んだ NodeList
133:      */
134:     public function getAppendee()
135:     {
136:         return new NodeList($this);
137:     }
138: }
139: 
PEACH2 API documentation generated by ApiGen