public function importDrupalConfig($reimport_attempts = 1, $localhost = false)
    {
        if ($this->getProjectVersion() >= 8) {
            try {
                $drush = (new DrushCommand(null, $localhost))
                    ->command('cr')
                    ->command('cim');

                $this->runDrushCommand($drush, false, $localhost);
            } catch (TaskResultRuntimeException $exception) {
                if ($reimport_attempts < 1) {
                    throw $exception;
                }
                $errors = 0;
                $result = null;

                // Attempt to resolve import issues by reimporting the
                // configurations again. This workaround was added due to
                // the following issue:
                // @see https://www.drupal.org/project/drupal/issues/2923899
                for ($i = 0; $i < $reimport_attempts; $i++) {
                    $result = $this->runDrushCommand('cim', false, $localhost);

                    if ($result->getExitCode() === ResultData::EXITCODE_OK) {
                        break;
                    }

                    ++$errors;
                }

                if (!isset($result)) {
                    throw new \Exception('Missing result object.');
                } else if ($errors == $reimport_attempts) {
                    throw new TaskResultRuntimeException($result);
                }
            }
        }

        return $this;
    }