11<?php
22
3- namespace Davereid \ DrupalEnvironment ;
3+ namespace DrupalEnvironment ;
44
55/**
66 * Helpers for working with the Drupal environment.
77 *
8- * @todo Add Platform.sh support
9- *
108 * @method static string getEnvironment()
119 * @method static bool isAcquia()
1210 * @method static bool isPantheon()
1311 * @method static bool isProduction()
1412 * @method static bool isStaging()
1513 * @method static bool isDevelopment()
1614 * @method static bool isPreview()
15+ * @method static bool isTugboat()
1716 * @method static bool isCi()
1817 * @method static bool isGitHubWorkflow()
1918 * @method static bool isGitLabCi()
@@ -27,11 +26,12 @@ class Environment
2726 * The currently supported environment classes.
2827 */
2928 public const CLASSES = [
30- 'isAcquia ' => AcquiaEnvironment::class,
31- 'isPantheon ' => PantheonEnvironment::class,
32- 'isGitHubWorkflow ' => GitHubWorkflowEnvironment::class,
33- 'isGitLabCi ' => GitLabCiEnvironment::class,
34- 'isCircleCi ' => CircleCiEnvironment::class,
29+ 'isAcquia ' => Acquia::class,
30+ 'isPantheon ' => Pantheon::class,
31+ 'isTugboat ' => Tugboat::class,
32+ 'isGitHubWorkflow ' => GitHubWorkflow::class,
33+ 'isGitLabCi ' => GitLabCi::class,
34+ 'isCircleCi ' => CircleCi::class,
3535 null => DefaultEnvironment::class,
3636 ];
3737
@@ -41,14 +41,13 @@ class Environment
4141 * @return string
4242 * The class name.
4343 */
44- public static function getEnvironmentClass ()
44+ public static function getEnvironmentClass (): string
4545 {
4646 static $ class ;
4747 if (!isset ($ class )) {
4848 if ($ class = static ::get ('DRUPAL_ENVIRONMENT_CLASS ' )) {
4949 // Do nothing. The class was assigned in the if.
50- }
51- else {
50+ } else {
5251 // Intentionally re-assigning the class variable here so that a match
5352 // breaks the foreach loop, or we fall back to the default class.
5453 foreach (static ::CLASSES as $ class ) {
@@ -131,19 +130,6 @@ public static function isLando(): bool
131130 return (bool )static ::get ('LANDO_INFO ' );
132131 }
133132
134- /**
135- * Determine if this is a Tugboat environment.
136- *
137- * @return bool
138- * TRUE if this is a Tugboat environment.
139- *
140- * @todo Should this be its own environment class?
141- */
142- public static function isTugboat (): bool
143- {
144- return static ::getEnvironment () === 'tugboat ' ;
145- }
146-
147133 /**
148134 * Determines whether the current request is a command-line one.
149135 *
@@ -190,8 +176,7 @@ public static function getComposerFilename(): string
190176 */
191177 public static function getComposerLockFilename (): string
192178 {
193- $ composer_filename = static ::getComposerFilename ();
194- return pathinfo ($ composer_filename , PATHINFO_FILENAME ) . '.lock ' ;
179+ $ filename = static ::getComposerFilename ();
180+ return pathinfo ($ filename , PATHINFO_FILENAME ) . '.lock ' ;
195181 }
196-
197182}
0 commit comments