File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -173,4 +173,16 @@ public static function hasDirection(string $str): bool
173173 {
174174 return preg_match ('/\b(top|bottom|right|left)\b/i ' , $ str );
175175 }
176+
177+ /**
178+ * check if string include other string
179+ *
180+ * @param string $str
181+ * @param string $needle
182+ * @return bool
183+ */
184+ public static function strIncludes (string $ str , string $ needle ): bool
185+ {
186+ return strpos ($ str , $ needle ) !== false ;
187+ }
176188}
Original file line number Diff line number Diff line change @@ -43,14 +43,21 @@ public static function complement($value): void
4343 */
4444 public static function negate ($ value ): void
4545 {
46- if ($ value instanceof ValueList) {
46+ if ($ value instanceof CSSFunction && Helpers::strIncludes ($ value ->getName (), 'calc ' )) {
47+ $ arguments = implode ($ value ->getListSeparator (), $ value ->getArguments ());
48+ $ arguments = "-1*( $ arguments) " ;
49+ $ value ->setListComponents ([$ arguments ]);
50+
51+ } else if ($ value instanceof ValueList) {
4752 foreach ($ value ->getListComponents () as $ part ) {
4853 self ::negate ($ part );
4954 }
55+
5056 } else if ($ value instanceof Size) {
5157 if ($ value ->getSize () != 0 ) {
5258 $ value ->setSize (-$ value ->getSize ());
5359 }
60+
5461 }
5562 }
5663}
You can’t perform that action at this time.
0 commit comments