PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.2.2
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.2.2
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / Libraries / Sabberworm / CSS / src / Value / URL.php

URL.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.2.2, at back/Libraries/Sabberworm/CSS/src/Value/URL.php

83 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sabberworm\CSS\Value;
4
5 use Sabberworm\CSS\OutputFormat;
6 use Sabberworm\CSS\Parsing\ParserState;
7 use Sabberworm\CSS\Parsing\SourceException;
8 use Sabberworm\CSS\Parsing\UnexpectedEOFException;
9 use Sabberworm\CSS\Parsing\UnexpectedTokenException;
10
11 class URL extends PrimitiveValue
12 {
13 /**
14 * @var CSSString
15 */
16 private $oURL;
17
18 /**
19 * @param int $iLineNo
20 */
21 public function __construct(CSSString $oURL, $iLineNo = 0)
22 {
23 parent::__construct($iLineNo);
24 $this->oURL = $oURL;
25 }
26
27 /**
28 * @return URL
29 *
30 * @throws SourceException
31 * @throws UnexpectedEOFException
32 * @throws UnexpectedTokenException
33 */
34 public static function parse(ParserState $oParserState)
35 {
36 $bUseUrl = $oParserState->comes('url', true);
37 if ($bUseUrl) {
38 $oParserState->consume('url');
39 $oParserState->consumeWhiteSpace();
40 $oParserState->consume('(');
41 }
42 $oParserState->consumeWhiteSpace();
43 $oResult = new URL(CSSString::parse($oParserState), $oParserState->currentLine());
44 if ($bUseUrl) {
45 $oParserState->consumeWhiteSpace();
46 $oParserState->consume(')');
47 }
48 return $oResult;
49 }
50
51 /**
52 * @return void
53 */
54 public function setURL(CSSString $oURL)
55 {
56 $this->oURL = $oURL;
57 }
58
59 /**
60 * @return CSSString
61 */
62 public function getURL()
63 {
64 return $this->oURL;
65 }
66
67 /**
68 * @return string
69 */
70 public function __toString()
71 {
72 return $this->render(new OutputFormat());
73 }
74
75 /**
76 * @return string
77 */
78 public function render(OutputFormat $oOutputFormat)
79 {
80 return "url({$this->oURL->render($oOutputFormat)})";
81 }
82 }
83