Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

   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  }