| Conditions | 4 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function normalize($ruleValue, string $ruleName = ''): array |
||
| 22 | { |
||
| 23 | if (null !== $this->normalized) { |
||
| 24 | return $this->normalized; |
||
| 25 | } |
||
| 26 | $normalized = [ |
||
| 27 | 'transform' => [], |
||
| 28 | ]; |
||
| 29 | $operations = preg_split('/\s+/i', $ruleValue); |
||
| 30 | foreach ($operations as $operation) { |
||
| 31 | $matches = []; |
||
| 32 | preg_match('/(rotate|scale|translate)\(([0-9]+)([a-z]+)?\)/i', $operation, $matches); |
||
| 33 | $normalizerName = static::getNormalizerClassName('transform-' . $matches[1]); |
||
| 34 | $normalizer = (new $normalizerName()) |
||
| 35 | ->setDocument($this->document) |
||
| 36 | ->setStyle($this->style) |
||
| 37 | ->init(); |
||
| 38 | foreach ($normalizer->normalize($matches[2], $matches[1]) as $name => $value) { |
||
| 39 | $normalized['transform'][] = [$name, $value]; |
||
| 40 | } |
||
| 41 | } |
||
| 42 | return $normalized; |
||
| 43 | } |
||
| 45 |