Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 14 |
|
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 2 |
| IslandType | |
0.00% |
0 / 6 |
|
0.00% |
0 / 13 |
|
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 1 |
| description | |
0.00% |
0 / 6 |
|
0.00% |
0 / 13 |
|
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
56 | |||
| IslandTypeViewDisplay | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| regions | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Drupal\display_builder; |
| 6 | |
| 7 | use Drupal\Core\StringTranslation\TranslatableMarkup; |
| 8 | |
| 9 | /** |
| 10 | * List the island types for display builder. |
| 11 | */ |
| 12 | enum IslandType: string { |
| 13 | |
| 14 | // Islands acting as part of view island. |
| 15 | case Library = 'library'; |
| 16 | case Contextual = 'contextual'; |
| 17 | case View = 'view'; |
| 18 | case Button = 'button'; |
| 19 | case Menu = 'menu'; |
| 20 | |
| 21 | /** |
| 22 | * Get the string description for this enum. |
| 23 | * |
| 24 | * @param string $type |
| 25 | * The enum string name. |
| 26 | * |
| 27 | * @return \Drupal\Core\StringTranslation\TranslatableMarkup |
| 28 | * The enum string description. |
| 29 | */ |
| 30 | public static function description(string $type): TranslatableMarkup { |
| 31 | return match ($type) { |
| 32 | self::View->value => new TranslatableMarkup('Panels shown as a main area tab or as a sidebar.'), |
| 33 | self::Library->value => new TranslatableMarkup('Panels available as tab in the Library panel.'), |
| 34 | self::Button->value => new TranslatableMarkup('Toolbar buttons allowing direct actions in the builder.'), |
| 35 | self::Contextual->value => new TranslatableMarkup('Panels visible only when the a source is selected.'), |
| 36 | self::Menu->value => new TranslatableMarkup('Items available in the contextual menu.'), |
| 37 | default => new TranslatableMarkup('Unknown island type.'), |
| 38 | }; |
| 39 | } |
| 40 | |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * List the island sub types for IslandType::View. |
| 45 | */ |
| 46 | enum IslandTypeViewDisplay: string { |
| 47 | |
| 48 | case Sidebar = 'sidebar'; |
| 49 | case Main = 'main'; |
| 50 | |
| 51 | /** |
| 52 | * Get the type list regions. |
| 53 | * |
| 54 | * @return array |
| 55 | * The type list regions as key => description. |
| 56 | */ |
| 57 | public static function regions(): array { |
| 58 | return [ |
| 59 | IslandTypeViewDisplay::Sidebar->value => new TranslatableMarkup('Sidebar'), |
| 60 | IslandTypeViewDisplay::Main->value => new TranslatableMarkup('Main area (Tabs)'), |
| 61 | ]; |
| 62 | } |
| 63 | |
| 64 | } |
Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not
necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once.
Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 30 | public static function description(string $type): TranslatableMarkup { |
| 31 | return match ($type) { |
| 32 | self::View->value => new TranslatableMarkup('Panels shown as a main area tab or as a sidebar.'), |
| 33 | self::Library->value => new TranslatableMarkup('Panels available as tab in the Library panel.'), |
| 34 | self::Button->value => new TranslatableMarkup('Toolbar buttons allowing direct actions in the builder.'), |
| 35 | self::Contextual->value => new TranslatableMarkup('Panels visible only when the a source is selected.'), |
| 36 | self::Menu->value => new TranslatableMarkup('Items available in the contextual menu.'), |
| 36 | self::Menu->value => new TranslatableMarkup('Items available in the contextual menu.'), |
| 32 | self::View->value => new TranslatableMarkup('Panels shown as a main area tab or as a sidebar.'), |
| 33 | self::Library->value => new TranslatableMarkup('Panels available as tab in the Library panel.'), |
| 34 | self::Button->value => new TranslatableMarkup('Toolbar buttons allowing direct actions in the builder.'), |
| 35 | self::Contextual->value => new TranslatableMarkup('Panels visible only when the a source is selected.'), |
| 36 | self::Menu->value => new TranslatableMarkup('Items available in the contextual menu.'), |
| 37 | default => new TranslatableMarkup('Unknown island type.'), |
| 37 | default => new TranslatableMarkup('Unknown island type.'), |
| 59 | IslandTypeViewDisplay::Sidebar->value => new TranslatableMarkup('Sidebar'), |
| 60 | IslandTypeViewDisplay::Main->value => new TranslatableMarkup('Main area (Tabs)'), |
| 12 | enum IslandType: string { |
| 13 | |
| 14 | // Islands acting as part of view island. |
| 15 | case Library = 'library'; |
| 16 | case Contextual = 'contextual'; |
| 17 | case View = 'view'; |
| 18 | case Button = 'button'; |
| 19 | case Menu = 'menu'; |
| 20 | |
| 21 | /** |
| 22 | * Get the string description for this enum. |
| 23 | * |
| 24 | * @param string $type |
| 25 | * The enum string name. |
| 26 | * |
| 27 | * @return \Drupal\Core\StringTranslation\TranslatableMarkup |
| 28 | * The enum string description. |
| 29 | */ |
| 30 | public static function description(string $type): TranslatableMarkup { |
| 31 | return match ($type) { |
| 32 | self::View->value => new TranslatableMarkup('Panels shown as a main area tab or as a sidebar.'), |
| 33 | self::Library->value => new TranslatableMarkup('Panels available as tab in the Library panel.'), |
| 34 | self::Button->value => new TranslatableMarkup('Toolbar buttons allowing direct actions in the builder.'), |
| 35 | self::Contextual->value => new TranslatableMarkup('Panels visible only when the a source is selected.'), |
| 36 | self::Menu->value => new TranslatableMarkup('Items available in the contextual menu.'), |
| 37 | default => new TranslatableMarkup('Unknown island type.'), |
| 38 | }; |
| 39 | } |
| 40 | |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * List the island sub types for IslandType::View. |
| 45 | */ |
| 46 | enum IslandTypeViewDisplay: string { |
| 47 | |
| 48 | case Sidebar = 'sidebar'; |
| 49 | case Main = 'main'; |
| 50 | |
| 51 | /** |
| 52 | * Get the type list regions. |
| 53 | * |
| 54 | * @return array |
| 55 | * The type list regions as key => description. |
| 56 | */ |
| 57 | public static function regions(): array { |
| 58 | return [ |
| 59 | IslandTypeViewDisplay::Sidebar->value => new TranslatableMarkup('Sidebar'), |
| 60 | IslandTypeViewDisplay::Main->value => new TranslatableMarkup('Main area (Tabs)'), |
| 61 | ]; |
| 62 | } |
| 63 |