modules/custom/deims_d6_migration/migration/DeimsMigration.php

Summary

Maintainability
A
3 hrs
Test Coverage

Function prepareEntityTranslations has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  public function prepareEntityTranslations($entity_type, $entity) {
    if (entity_translation_enabled($entity_type)) {
      if ($handler = entity_translation_get_handler($entity_type, $entity)) {

        // Fetch all the languages that have field data for this entity.
Severity: Minor
Found in modules/custom/deims_d6_migration/migration/DeimsMigration.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function prepare has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  public function prepare($object, $row) {
    // Note there is no parent::prepare($object, $row) here since there is no
    // parent to call.

    // Apply entity-generic alterations before the entity object is saved.
Severity: Minor
Found in modules/custom/deims_d6_migration/migration/DeimsMigration.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function getEntityFieldLangcodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  public function getEntityFieldLangcodes($entity_type, $entity) {
    list(, , $bundle) = entity_extract_ids($entity_type, $entity);
    $instances = field_info_instances($entity_type, $bundle);
    $langcodes = array();
    foreach (array_keys($instances) as $field) {
Severity: Minor
Found in modules/custom/deims_d6_migration/migration/DeimsMigration.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
Open

    // in each

If the line declaring an array spans longer than 80 characters, each element should be broken into its own line
Open

      foreach (array('language', 'created', 'status', 'promote', 'sticky', 'uid') as $key) {

Missing function doc comment
Open

  public function getEntityFieldLangcodes($entity_type, $entity) {

Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
Open

        // Before saving any translations, ensure

Missing function doc comment
Open

  public function prepare($object, $row) {

Missing @var tag in member variable comment
Open

   */

The closing brace for the class must have an empty line before it
Open

}

Missing function doc comment
Open

  public function __construct($group = NULL) {

Missing function doc comment
Open

  public function prepareEntityTranslations($entity_type, $entity) {

No space found before comment text; expected "// $handler->initTranslations();" but found "//$handler->initTranslations();"
Open

          //$handler->initTranslations();

Comments may not appear after statements
Open

              'status' => 1, // Set translations to published by default.

Missing function doc comment
Open

  public function preserveValues($node) {

Expected 1 blank line after function; 0 found
Open

  }

Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
Open

    // Always call the parent constructor first for basic setup

There are no issues that match your filters.

Category
Status