Code Duplication    Length = 17-19 lines in 2 locations

src/Inspectors/Drupal6Inspector.php 1 location

@@ 8-24 (lines=17) @@
5
use VersionTool\Info\VersionInfo;
6
use VersionTool\Util\ComposerInfo;
7
8
class Drupal6Inspector implements InspectorInterface
9
{
10
    /**
11
     * @inheritdoc
12
     */
13
    public function valid(ComposerInfo $composer_info)
14
    {
15
        $drupal_root = $composer_info->projectRoot();
16
        if (file_exists("$drupal_root/index.php")) {
17
            $candidate = 'includes/common.inc';
18
            if (file_exists($drupal_root . '/' . $candidate) && file_exists($drupal_root . '/misc/drupal.js') && !file_exists($drupal_root . '/modules/field/field.module')) {
19
                    return new VersionInfo('Drupal', $composer_info, $drupal_root, '/modules/system/system.module', "#define\('VERSION', '([0-9.a-z-]*)'\);#m");
20
            }
21
        }
22
        return false;
23
    }
24
}
25

src/Inspectors/Drupal7Inspector.php 1 location

@@ 8-26 (lines=19) @@
5
use VersionTool\Info\VersionInfo;
6
use VersionTool\Util\ComposerInfo;
7
8
class Drupal7Inspector implements InspectorInterface
9
{
10
    /**
11
     * @inheritdoc
12
     */
13
    public function valid(ComposerInfo $composer_info)
14
    {
15
        $drupal_root = $composer_info->projectRoot();
16
        if (file_exists("$drupal_root/index.php")) {
17
            // Additional check for the presence of core/composer.json to
18
            // grant it is not a Drupal 7 site with a base folder named "core".
19
            $candidate = 'includes/common.inc';
20
            if (file_exists($drupal_root . '/' . $candidate) && file_exists($drupal_root . '/misc/drupal.js') && file_exists($drupal_root . '/modules/field/field.module')) {
21
                    return new VersionInfo('Drupal', $composer_info, $drupal_root, '/includes/bootstrap.inc', "#define\('VERSION', '([0-9.a-z-]*)'\);#m");
22
            }
23
        }
24
        return false;
25
    }
26
}
27