Comment.php
64 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP\Sabberworm\CSS\Comment; |
| 4 | |
| 5 | use IAWP\Sabberworm\CSS\OutputFormat; |
| 6 | use IAWP\Sabberworm\CSS\Renderable; |
| 7 | class Comment implements Renderable |
| 8 | { |
| 9 | /** |
| 10 | * @var int |
| 11 | */ |
| 12 | protected $iLineNo; |
| 13 | /** |
| 14 | * @var string |
| 15 | */ |
| 16 | protected $sComment; |
| 17 | /** |
| 18 | * @param string $sComment |
| 19 | * @param int $iLineNo |
| 20 | */ |
| 21 | public function __construct($sComment = '', $iLineNo = 0) |
| 22 | { |
| 23 | $this->sComment = $sComment; |
| 24 | $this->iLineNo = $iLineNo; |
| 25 | } |
| 26 | /** |
| 27 | * @return string |
| 28 | */ |
| 29 | public function getComment() |
| 30 | { |
| 31 | return $this->sComment; |
| 32 | } |
| 33 | /** |
| 34 | * @return int |
| 35 | */ |
| 36 | public function getLineNo() |
| 37 | { |
| 38 | return $this->iLineNo; |
| 39 | } |
| 40 | /** |
| 41 | * @param string $sComment |
| 42 | * |
| 43 | * @return void |
| 44 | */ |
| 45 | public function setComment($sComment) |
| 46 | { |
| 47 | $this->sComment = $sComment; |
| 48 | } |
| 49 | /** |
| 50 | * @return string |
| 51 | */ |
| 52 | public function __toString() |
| 53 | { |
| 54 | return $this->render(new OutputFormat()); |
| 55 | } |
| 56 | /** |
| 57 | * @return string |
| 58 | */ |
| 59 | public function render(OutputFormat $oOutputFormat) |
| 60 | { |
| 61 | return '/*' . $this->sComment . '*/'; |
| 62 | } |
| 63 | } |
| 64 |