Code Duplication    Length = 7-7 lines in 2 locations

src/DrupalExtension/Context/ScreenShotContext.php 2 locations

@@ 60-66 (lines=7) @@
57
          catch (\Exception $e) {
58
            // Use the step test in the filename.
59
            $step = $event->getStep();
60
            if (function_exists('transliteration_clean_filename')) {
61
              $file_name = transliteration_clean_filename($step->getKeyword() . '_' . $step->getText());
62
            }
63
            else {
64
              $file_name = str_replace(' ', '_', $step->getKeyword() . '_' . $step->getText());
65
              $file_name = preg_replace('![^0-9A-Za-z_.-]!', '', $file_name);
66
            }
67
            $file_name = substr($file_name, 0, 30);
68
            $file_name = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'behat-notice__' . $file_name;
69
            $message = "Screenshot for behat notice in step created in @file_name";
@@ 92-98 (lines=7) @@
89
      return;
90
    }
91
    $step = $event->getStep();
92
    if (function_exists('transliteration_clean_filename')) {
93
      $file_name = transliteration_clean_filename($step->getKeyword() . '_' . $step->getText());
94
    }
95
    else {
96
      $file_name = str_replace(' ', '_', $step->getKeyword() . '_' . $step->getText());
97
      $file_name = preg_replace('![^0-9A-Za-z_.-]!', '', $file_name);
98
    }
99
    $file_name = substr($file_name, 0, 30);
100
    $file_name = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'behat-failed__' . $file_name;
101
    $message = "Screenshot for failed step created in @file_name";