Yaffs site version 1.1
[yaffs-website] / vendor / drupal / console-core / src / Utils / DrupalFinder.php
diff --git a/vendor/drupal/console-core/src/Utils/DrupalFinder.php b/vendor/drupal/console-core/src/Utils/DrupalFinder.php
new file mode 100644 (file)
index 0000000..1619bf9
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal\Console\Core\Utils\DrupalFinder.
+ */
+
+namespace Drupal\Console\Core\Utils;
+
+use DrupalFinder\DrupalFinder as DrupalFinderBase;
+
+/**
+ * Class DrupalFinder
+ *
+ * @package Drupal\Console\Core\Utils
+ */
+class DrupalFinder extends DrupalFinderBase
+{
+    public function locateRoot($start_path)
+    {
+        if (parent::locateRoot($start_path)) {
+            $composerRoot = $this->getComposerRoot();
+            $vendorDir = str_replace(
+                $composerRoot .'/', '', $this->getVendorDir()
+            );
+            if (!defined("DRUPAL_CONSOLE_CORE")) {
+                define(
+                    "DRUPAL_CONSOLE_CORE",
+                    "/{$vendorDir}/drupal/console-core/"
+                );
+            }
+            if (!defined("DRUPAL_CONSOLE")) {
+                define("DRUPAL_CONSOLE", "/{$vendorDir}/drupal/console/");
+            }
+            if (!defined("DRUPAL_CONSOLE_LANGUAGE")) {
+                define(
+                    "DRUPAL_CONSOLE_LANGUAGE",
+                    "/{$vendorDir}/drupal/console-%s/translations/"
+                );
+            }
+
+            return true;
+        }
+
+        return false;
+    }
+}