# Cdata.class.php

Go to the documentation of this file.

    00001 <?php
    00002 /***************************************************************************
    00003  *   Copyright (C) 2007 by Ivan Y. Khvostishkov                            *
    00004  *                                                                         *
    00005  *   This program is free software; you can redistribute it and/or modify  *
    00006  *   it under the terms of the GNU Lesser General Public License as        *
    00007  *   published by the Free Software Foundation; either version 3 of the    *
    00008  *   License, or (at your option) any later version.                       *
    00009  *                                                                         *
    00010  ***************************************************************************/
    00011
    00016     final class Cdata extends SgmlToken
    00017     {
    00018         private $data   = null;
    00019
    00020         private $strict = false;
    00021
    00025         public static function create()
    00026         {
    00027             return new self;
    00028         }
    00029
    00033         public function setData($data)
    00034         {
    00035             $this->data = $data;
    00036
    00037             return $this;
    00038         }
    00039
    00040         public function getData()
    00041         {
    00042             if ($this->strict)
    00043                 return '<![CDATA['.$this->data.']]>';
    00044             else
    00045                 return $this->data;
    00046         }
    00047
    00048         public function getRawData()
    00049         {
    00050             return $this->data;
    00051         }
    00052
    00056         public function setStrict($isStrict)
    00057         {
    00058             Assert::isBoolean($isStrict);
    00059
    00060             $this->strict = $isStrict;
    00061
    00062             return $this;
    00063         }
    00064
    00065         public function isStrict()
    00066         {
    00067             return $this->strict;
    00068         }
    00069     }
    00070 ?>