Skip to content

Commit

Permalink
Fix constant definition (#160)
Browse files Browse the repository at this point in the history
* [console] Remove constants.php file.

* [console] Extend DrupalFinder class.

* [console] Fix docblock.
  • Loading branch information
jmolivas committed May 7, 2017
1 parent 64c4f8d commit 501ff65
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 7 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"prefer-stable": true,
"autoload": {
"files": [
"src/constants.php",
"src/functions.php"
],
"psr-4": {"Drupal\\Console\\Core\\": "src"}
Expand Down
47 changes: 47 additions & 0 deletions src/Utils/DrupalFinder.php
Original file line number Diff line number Diff line change
@@ -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;
}
}
6 changes: 0 additions & 6 deletions src/constants.php

This file was deleted.

0 comments on commit 501ff65

Please sign in to comment.