You are here

public function Issue::getViolations in Drupal 7 to 8/9 Module Upgrader 8

Returns all violations as an array of arrays, each of which has a 'file' key (required), and an optional 'line_number' key.

Return value

array

Overrides IssueInterface::getViolations

File

src/Issue.php, line 148

Class

Issue

Namespace

Drupal\drupalmoduleupgrader

Code

public function getViolations() {
  $return_violations = [];
  foreach ($this->violations as $file => $file_violations) {
    if ($file_violations) {
      foreach ($file_violations as $violation) {
        $violation['file'] = $file;
        $return_violations[] = $violation;
      }
    }
    else {
      $return_violations[] = [
        'file' => $file,
      ];
    }
  }
  return $return_violations;
}