| 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 |
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead. |
| 66 |
*/ |
| 67 |
public function __toString() |
| 68 |
{ |
| 69 |
return $this->render(new OutputFormat()); |
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* @param OutputFormat|null $oOutputFormat |
| 74 |
* |
| 75 |
* @return string |
| 76 |
*/ |
| 77 |
public function render($oOutputFormat) |
| 78 |
{ |
| 79 |
$sResult = $oOutputFormat->comments($this); |
| 80 |
$sResult .= "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{"; |
| 81 |
$sResult .= $this->renderListContents($oOutputFormat); |
| 82 |
$sResult .= '}'; |
| 83 |
return $sResult; |
| 84 |
} |
| 85 |
|
| 86 |
/** |
| 87 |
* @return bool |
| 88 |
*/ |
| 89 |
public function isRootList() |
| 90 |
{ |
| 91 |
return false; |
| 92 |
} |
| 93 |
|
| 94 |
/** |
| 95 |
* @return string|null |
| 96 |
*/ |
| 97 |
public function atRuleName() |
| 98 |
{ |
| 99 |
return $this->vendorKeyFrame; |
| 100 |
} |
| 101 |
|
| 102 |
/** |
| 103 |
* @return string|null |
| 104 |
*/ |
| 105 |
public function atRuleArgs() |
| 106 |
{ |
| 107 |
return $this->animationName; |
| 108 |
} |
| 109 |
} |
| 110 |
|