Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| NoTransform | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| getInstance | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| apply | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MobileFrontend\Transforms; |
| 4 | |
| 5 | use Wikimedia\Parsoid\DOM\Element; |
| 6 | |
| 7 | class NoTransform implements IMobileTransform { |
| 8 | |
| 9 | /** @var self */ |
| 10 | private static $instance; |
| 11 | |
| 12 | /** |
| 13 | * Returns a static instance of NoTransform class. |
| 14 | * |
| 15 | * Note: There's no need in many instances of this class as it does nothing. |
| 16 | * So it's a common pre-optimization to make such classes as singleton, what's |
| 17 | * rather a matter of convenience than real optimization. |
| 18 | */ |
| 19 | public static function getInstance(): self { |
| 20 | if ( self::$instance === null ) { |
| 21 | self::$instance = new self(); |
| 22 | } |
| 23 | return self::$instance; |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Does nothing. |
| 28 | * @param Element $node to be transformed |
| 29 | */ |
| 30 | public function apply( Element $node ) { |
| 31 | // nothing happens |
| 32 | } |
| 33 | } |