Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

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

   1  <?php
   2  
   3  namespace Sabberworm\CSS\Value;
   4  
   5  use Sabberworm\CSS\OutputFormat;
   6  
   7  class CSSFunction extends ValueList
   8  {
   9      /**
  10       * @var string
  11       */
  12      protected $sName;
  13  
  14      /**
  15       * @param string $sName
  16       * @param RuleValueList|array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aArguments
  17       * @param string $sSeparator
  18       * @param int $iLineNo
  19       */
  20      public function __construct($sName, $aArguments, $sSeparator = ',', $iLineNo = 0)
  21      {
  22          if ($aArguments instanceof RuleValueList) {
  23              $sSeparator = $aArguments->getListSeparator();
  24              $aArguments = $aArguments->getListComponents();
  25          }
  26          $this->sName = $sName;
  27          $this->iLineNo = $iLineNo;
  28          parent::__construct($aArguments, $sSeparator, $iLineNo);
  29      }
  30  
  31      /**
  32       * @return string
  33       */
  34      public function getName()
  35      {
  36          return $this->sName;
  37      }
  38  
  39      /**
  40       * @param string $sName
  41       *
  42       * @return void
  43       */
  44      public function setName($sName)
  45      {
  46          $this->sName = $sName;
  47      }
  48  
  49      /**
  50       * @return array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
  51       */
  52      public function getArguments()
  53      {
  54          return $this->aComponents;
  55      }
  56  
  57      /**
  58       * @return string
  59       */
  60      public function __toString()
  61      {
  62          return $this->render(new OutputFormat());
  63      }
  64  
  65      /**
  66       * @return string
  67       */
  68      public function render(OutputFormat $oOutputFormat)
  69      {
  70          $aArguments = parent::render($oOutputFormat);
  71          return "{$this->sName}({$aArguments})";
  72      }
  73  }