dc7278a9b5808d9b55fdbb64d90a61e6cf78c216
[yaffs-website] / vendor / drush / drush / src / Boot / Kernels.php
1 <?php
2
3 namespace Drush\Boot;
4
5 use Drush\Drupal\DrupalKernel as DrushDrupalKernel;
6 use Drush\Drupal\UpdateKernel as DrushUpdateKernel;
7 use Drush\Drupal\InstallerKernel as DrushInstallerKernel;
8
9 /**
10  * Defines the available kernels that can be bootstrapped.
11  */
12 final class Kernels
13 {
14
15     /**
16      * The default kernel that is used on standard requests.
17      *
18      * @var string
19      */
20     const DRUPAL = 'drupal';
21
22     /**
23      * The kernel that is used during database updates.
24      *
25      * @var string
26      */
27     const UPDATE = 'update';
28
29     /**
30      * The kernel that is used during site installation.
31      *
32      * @var string
33      */
34     const INSTALLER = 'installer';
35
36     /**
37      * Returns the available kernels.
38      */
39     public static function availableKernels()
40     {
41         return [
42             static::DRUPAL,
43             static::UPDATE,
44             static::INSTALLER,
45         ];
46     }
47
48     /**
49      * Returns the factory method that can be used to retrieve the given kernel.
50      *
51      * @param string $kernel
52      *   The kernel to retrieve.
53      *
54      * @return callable
55      *   The factory method.
56      */
57     public static function getKernelFactory($kernel)
58     {
59         $factories = [
60             Kernels::DRUPAL => [DrushDrupalKernel::class, 'createFromRequest'],
61             Kernels::UPDATE => [DrushUpdateKernel::class, 'createFromRequest'],
62             Kernels::INSTALLER => [DrushInstallerKernel::class, 'createFromRequest'],
63         ];
64         return $factories[$kernel];
65     }
66 }