Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | 88 | public function transform( string $segment ): string { |
|
18 | |||
19 | 88 | preg_match_all( '|<x[^>]*?equiv-text="([^"]*?)"[^>]*?/>|', $segment, $xTags, PREG_SET_ORDER ); |
|
20 | 88 | foreach ( $xTags as $group ) { |
|
21 | 5 | $segment = preg_replace( |
|
22 | 5 | '/' . preg_quote( $group[ 0 ], '/' ) . '/', |
|
23 | 5 | '<ph id="' . $this->getPipeline()->getNextId() . '" ctype="' . CTypeEnum::ORIGINAL_X . '" x-orig="' . base64_encode( $group[ 0 ] ) . '" equiv-text="base64:' . base64_encode( $group[ 1 ] ) . '"/>', |
|
24 | 5 | $segment, |
|
25 | 5 | 1 |
|
26 | 5 | ); |
|
27 | } |
||
28 | |||
29 | 88 | return $segment; |
|
30 | |||
37 |