| Total Complexity | 7 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class Loop extends DependencyAwareGenerator implements BlockInterface |
||
| 8 | { |
||
| 9 | use ScopedContentTrait; |
||
| 10 | |||
| 11 | public const TYPE_WHILE = 'while'; |
||
| 12 | public const TYPE_FOR = 'for'; |
||
| 13 | public const TYPE_FOREACH = 'foreach'; |
||
| 14 | public const TYPE_DO_WHILE = 'doWhile'; |
||
| 15 | |||
| 16 | private string $condition; |
||
| 17 | private string $type; |
||
| 18 | |||
| 19 | 3 | public function __construct(string $condition = '', $type = self::TYPE_WHILE) |
|
| 23 | 3 | } |
|
| 24 | |||
| 25 | 4 | public function generate(): string |
|
| 40 | } |
||
| 41 | CODE; |
||
| 42 | } |
||
| 43 | |||
| 44 | 1 | public static function while(string $condition) |
|
| 47 | } |
||
| 48 | |||
| 49 | 1 | public static function for(string $condition) |
|
| 50 | { |
||
| 51 | 1 | return new self($condition, self::TYPE_FOR); |
|
| 52 | } |
||
| 53 | |||
| 54 | 3 | public static function foreach(string $condition) |
|
| 57 | } |
||
| 58 | |||
| 59 | 1 | public static function doWhile(string $condition) |
|
| 64 |