PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.0
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.0
2.4.0 2.4.1 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.2.0 2.1.21 2.1.20 2.1.19 2.1.18 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.2 All 57 releases
easy-invoice / vendor / sabberworm / php-css-parser / src / Settings.php

Settings.php in Easy Invoice – Invoice Generator, PDF Quotes & Payments 2.4.0, at vendor/sabberworm/php-css-parser/src/Settings.php

107 lines 2.6 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;
4
5 /**
6 * Parser settings class.
7 *
8 * Configure parser behaviour here.
9 */
10 class Settings
11 {
12 /**
13 * Multi-byte string support.
14 *
15 * If `true` (`mbstring` extension must be enabled), will use (slower) `mb_strlen`, `mb_convert_case`, `mb_substr`
16 * and `mb_strpos` functions. Otherwise, the normal (ASCII-Only) functions will be used.
17 *
18 * @var bool
19 *
20 * @internal since 8.8.0, will be made private in 9.0.0
21 */
22 public $bMultibyteSupport;
23
24 /**
25 * The default charset for the CSS if no `@charset` declaration is found. Defaults to utf-8.
26 *
27 * @var string
28 *
29 * @internal since 8.8.0, will be made private in 9.0.0
30 */
31 public $sDefaultCharset = 'utf-8';
32
33 /**
34 * Whether the parser silently ignore invalid rules instead of choking on them.
35 *
36 * @var bool
37 *
38 * @internal since 8.8.0, will be made private in 9.0.0
39 */
40 public $bLenientParsing = true;
41
42 private function __construct()
43 {
44 $this->bMultibyteSupport = extension_loaded('mbstring');
45 }
46
47 /**
48 * @return self new instance
49 */
50 public static function create()
51 {
52 return new Settings();
53 }
54
55 /**
56 * Enables/disables multi-byte string support.
57 *
58 * If `true` (`mbstring` extension must be enabled), will use (slower) `mb_strlen`, `mb_convert_case`, `mb_substr`
59 * and `mb_strpos` functions. Otherwise, the normal (ASCII-Only) functions will be used.
60 *
61 * @param bool $bMultibyteSupport
62 *
63 * @return self fluent interface
64 */
65 public function withMultibyteSupport($bMultibyteSupport = true)
66 {
67 $this->bMultibyteSupport = $bMultibyteSupport;
68 return $this;
69 }
70
71 /**
72 * Sets the charset to be used if the CSS does not contain an `@charset` declaration.
73 *
74 * @param string $sDefaultCharset
75 *
76 * @return self fluent interface
77 */
78 public function withDefaultCharset($sDefaultCharset)
79 {
80 $this->sDefaultCharset = $sDefaultCharset;
81 return $this;
82 }
83
84 /**
85 * Configures whether the parser should silently ignore invalid rules.
86 *
87 * @param bool $bLenientParsing
88 *
89 * @return self fluent interface
90 */
91 public function withLenientParsing($bLenientParsing = true)
92 {
93 $this->bLenientParsing = $bLenientParsing;
94 return $this;
95 }
96
97 /**
98 * Configures the parser to choke on invalid rules.
99 *
100 * @return self fluent interface
101 */
102 public function beStrict()
103 {
104 return $this->withLenientParsing(false);
105 }
106 }
107