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