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";
@@ 93-99 (lines=7) @@
90
    }
91
    try {
92
      $step = $event->getStep();
93
      if (function_exists('transliteration_clean_filename')) {
94
        $file_name = transliteration_clean_filename($step->getKeyword() . '_' . $step->getText());
95
      }
96
      else {
97
        $file_name = str_replace(' ', '_', $step->getKeyword() . '_' . $step->getText());
98
        $file_name = preg_replace('![^0-9A-Za-z_.-]!', '', $file_name);
99
      }
100
      $file_name = substr($file_name, 0, 30);
101
      $file_name = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'behat-failed__' . $file_name;
102
      $message = "Screenshot for failed step created in @file_name";