Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Cosray\Plugin; |
| 6 | |
| 7 | /** |
| 8 | * A runtime plugin installed via Composer and registered in the app |
| 9 | * bootstrap: `$app->plugin(ShopPlugin::class)` or through the |
| 10 | * `plugins` config key. |
| 11 | * |
| 12 | * Plugins must be constructible without arguments; everything they |
| 13 | * need arrives through the Registrar. Optional behavior comes from app |
| 14 | * config: options live at '{id}.{option}' settings keys and are read |
| 15 | * via Registrar::option() with an inline default, so a plugin works |
| 16 | * with zero configuration. |
| 17 | */ |
| 18 | interface Plugin |
| 19 | { |
| 20 | /** |
| 21 | * Stable identifier, e.g. 'acme-shop'. |
| 22 | * |
| 23 | * Lowercase letters, digits and dashes, with at least one dash — |
| 24 | * like custom element names; dashless names stay reserved for |
| 25 | * cosray's own config keys. Used as the config namespace and for |
| 26 | * asset URLs, template namespaces and error messages. |
| 27 | */ |
| 28 | public function id(): string; |
| 29 | |
| 30 | public function register(Registrar $cms): void; |
| 31 | } |