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\CSSList;
   4  
   5  use Sabberworm\CSS\OutputFormat;
   6  use Sabberworm\CSS\Property\AtRule;
   7  
   8  class KeyFrame extends CSSList implements AtRule
   9  {
  10      /**
  11       * @var string|null
  12       */
  13      private $vendorKeyFrame;
  14  
  15      /**
  16       * @var string|null
  17       */
  18      private $animationName;
  19  
  20      /**
  21       * @param int $iLineNo
  22       */
  23      public function __construct($iLineNo = 0)
  24      {
  25          parent::__construct($iLineNo);
  26          $this->vendorKeyFrame = null;
  27          $this->animationName = null;
  28      }
  29  
  30      /**
  31       * @param string $vendorKeyFrame
  32       */
  33      public function setVendorKeyFrame($vendorKeyFrame)
  34      {
  35          $this->vendorKeyFrame = $vendorKeyFrame;
  36      }
  37  
  38      /**
  39       * @return string|null
  40       */
  41      public function getVendorKeyFrame()
  42      {
  43          return $this->vendorKeyFrame;
  44      }
  45  
  46      /**
  47       * @param string $animationName
  48       */
  49      public function setAnimationName($animationName)
  50      {
  51          $this->animationName = $animationName;
  52      }
  53  
  54      /**
  55       * @return string|null
  56       */
  57      public function getAnimationName()
  58      {
  59          return $this->animationName;
  60      }
  61  
  62      /**
  63       * @return string
  64       */
  65      public function __toString()
  66      {
  67          return $this->render(new OutputFormat());
  68      }
  69  
  70      /**
  71       * @return string
  72       */
  73      public function render(OutputFormat $oOutputFormat)
  74      {
  75          $sResult = "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{";
  76          $sResult .= parent::render($oOutputFormat);
  77          $sResult .= '}';
  78          return $sResult;
  79      }
  80  
  81      /**
  82       * @return bool
  83       */
  84      public function isRootList()
  85      {
  86          return false;
  87      }
  88  
  89      /**
  90       * @return string|null
  91       */
  92      public function atRuleName()
  93      {
  94          return $this->vendorKeyFrame;
  95      }
  96  
  97      /**
  98       * @return string|null
  99       */
 100      public function atRuleArgs()
 101      {
 102          return $this->animationName;
 103      }
 104  }