Debian Codegraph @

vendor/sabberworm/php-css-parser/src/CSSList/KeyFrame.php

raw
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Sabberworm\CSS\CSSList;
6
7 use Sabberworm\CSS\OutputFormat;
8 use Sabberworm\CSS\Property\AtRule;
9
10 class KeyFrame extends CSSList implements AtRule
11 {
12 /**
13 * @var non-empty-string
14 */
15 private $vendorKeyFrame = 'keyframes';
16
17 /**
18 * @var non-empty-string
19 */
20 private $animationName = 'none';
21
22 /**
23 * @param non-empty-string $vendorKeyFrame
24 */
25 public function setVendorKeyFrame(string $vendorKeyFrame): void
26 {
27 $this->vendorKeyFrame = $vendorKeyFrame;
28 }
29
30 /**
31 * @return non-empty-string
32 */
33 public function getVendorKeyFrame(): string
34 {
35 return $this->vendorKeyFrame;
36 }
37
38 /**
39 * @param non-empty-string $animationName
40 */
41 public function setAnimationName(string $animationName): void
42 {
43 $this->animationName = $animationName;
44 }
45
46 /**
47 * @return non-empty-string
48 */
49 public function getAnimationName(): string
50 {
51 return $this->animationName;
52 }
53
54 /**
55 * @return non-empty-string
56 */
57 public function render(OutputFormat $outputFormat): string
58 {
59 $formatter = $outputFormat->getFormatter();
60 $result = $formatter->comments($this);
61 $result .= "@{$this->vendorKeyFrame} {$this->animationName}{$formatter->spaceBeforeOpeningBrace()}{";
62 $result .= $this->renderListContents($outputFormat);
63 $result .= '}';
64 return $result;
65 }
66
67 public function isRootList(): bool
68 {
69 return false;
70 }
71
72 /**
73 * @return non-empty-string
74 */
75 public function atRuleName(): string
76 {
77 return $this->vendorKeyFrame;
78 }
79
80 /**
81 * @return non-empty-string
82 */
83 public function atRuleArgs(): string
84 {
85 return $this->animationName;
86 }
87 }