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