PluginApplicationInterface.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 3.6.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Core;
  16. use Cake\Event\EventDispatcherInterface;
  17. /**
  18. * Interface for Applications that leverage plugins & events.
  19. *
  20. * Events can be bound to the application event manager during
  21. * the application's bootstrap and plugin bootstrap.
  22. */
  23. interface PluginApplicationInterface extends EventDispatcherInterface
  24. {
  25. /**
  26. * Add a plugin to the loaded plugin set.
  27. *
  28. * If the named plugin does not exist, or does not define a Plugin class, an
  29. * instance of `Cake\Core\BasePlugin` will be used. This generated class will have
  30. * all plugin hooks enabled.
  31. *
  32. * @param string|\Cake\Core\PluginInterface $name The plugin name or plugin object.
  33. * @param array $config The configuration data for the plugin if using a string for $name
  34. * @return $this
  35. */
  36. public function addPlugin($name, array $config = []);
  37. /**
  38. * Run bootstrap logic for loaded plugins.
  39. *
  40. * @return void
  41. */
  42. public function pluginBootstrap();
  43. /**
  44. * Run routes hooks for loaded plugins
  45. *
  46. * @param \Cake\Routing\RouteBuilder $routes The route builder to use.
  47. * @return \Cake\Routing\RouteBuilder
  48. */
  49. public function pluginRoutes($routes);
  50. /**
  51. * Run middleware hooks for plugins
  52. *
  53. * @param \Cake\Http\MiddlewareQueue $middleware The MiddlewareQueue to use.
  54. * @return \Cake\Http\MiddlewareQueue
  55. */
  56. public function pluginMiddleware($middleware);
  57. /**
  58. * Run console hooks for plugins
  59. *
  60. * @param \Cake\Console\CommandCollection $commands The CommandCollection to use.
  61. * @return \Cake\Console\CommandCollection
  62. */
  63. public function pluginConsole($commands);
  64. }