Version 1
[yaffs-website] / vendor / drush / drush / lib / Drush / Boot / Boot.php
1 <?php
2
3 namespace Drush\Boot;
4
5 /**
6  * Defines the interface for a Boot classes.  Any CMS that wishes
7  * to work with Drush should extend BaseBoot.  If the CMS has a
8  * Drupal-Compatibility layer, then it should extend DrupalBoot.
9  *
10  * @todo Doc these methods.
11  */
12 interface Boot {
13   /**
14    * This function determines if the specified path points to
15    * the root directory of a CMS that can be bootstrapped by
16    * the specific subclass that implements it.
17    *
18    * These functions should be written such that one and only
19    * one class will return TRUE for any given $path.
20    *
21    * @param $path to a directory to test
22    *
23    * @return TRUE if $path is a valid root directory
24    */
25   function valid_root($path);
26
27
28   /**
29    * Given a site root directory, determine the exact version of the software.
30    *
31    * @param string $root
32    *   The full path to the site installation, with no trailing slash.
33    * @return string|NULL
34    *   The version string for the current version of the software, e.g. 8.1.3
35    */
36   function get_version($root);
37
38   /**
39    * Main entrypoint to bootstrap the selected CMS and
40    * execute the selected command.
41    *
42    * The implementation provided in BaseBoot should be
43    * sufficient; this method usually will not need to
44    * be overridden.
45    */
46   function bootstrap_and_dispatch();
47
48   /**
49    * Returns an array that determines what bootstrap phases
50    * are necessary to bootstrap this CMS.  This array
51    * should map from a numeric phase to the name of a method
52    * (string) in the Boot class that handles the bootstrap
53    * phase.
54    *
55    * @see \Drush\Boot\DrupalBoot::bootstrap_phases()
56    *
57    * @return array of PHASE index => method name.
58    */
59   function bootstrap_phases();
60
61   /**
62    * List of bootstrap phases where Drush should stop and look for commandfiles.
63    *
64    * This allows us to bootstrap to a minimum neccesary to find commands.
65    *
66    * Once a command is found, Drush will ensure a bootstrap to the phase
67    * declared by the command.
68    *
69    * @return array of PHASE indexes.
70    */
71   function bootstrap_init_phases();
72
73   /**
74    * Return an array of default values that should be added
75    * to every command (e.g. values needed in enforce_requirements(),
76    * etc.)
77    */
78   function command_defaults();
79
80   /**
81    * Called by Drush when a command is selected, but
82    * before it runs.  This gives the Boot class an
83    * opportunity to determine if any minimum
84    * requirements (e.g. minimum Drupal version) declared
85    * in the command have been met.
86    *
87    * @return TRUE if command is valid. $command['bootstrap_errors']
88    * should be populated with an array of error messages if
89    * the command is not valid.
90    */
91   function enforce_requirement(&$command);
92
93   /**
94    * Called by Drush if a command is not found, or if the
95    * command was found, but did not meet requirements.
96    *
97    * The implementation in BaseBoot should be sufficient
98    * for most cases, so this method typically will not need
99    * to be overridden.
100    */
101   function report_command_error($command);
102
103   /**
104    * This method is called during the shutdown of drush.
105    *
106    * @return void
107    */
108   public function terminate();
109 }