-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTransformer.php
42 lines (37 loc) · 1009 Bytes
/
Transformer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Okapi\CodeTransformer;
use Okapi\CodeTransformer\Transformer\Code;
/**
* # Code Transformer
*
* This class provides a foundation for creating a transformer.
*
* Transformers extend this class and implement following methods:
* - `getTargetClass()` - Returns the target class name(s) that this transformer
* will be applied to.
*/
abstract class Transformer
{
/**
* The order in which the transformer will be applied.
*
* @var int
*/
public int $order = 0;
/**
* Get the target class name that this transformer will be applied to.
*
* Wildcards are supported. See Okapi/Wildcards for more information.
*
* @return class-string|class-string[]
*/
abstract public function getTargetClass(): string|array;
/**
* Transform the source code.
*
* @param Code $code
*
* @return void
*/
abstract public function transform(Code $code): void;
}