modules/custom/eml/lib/EmlDataSet.php

Summary

Maintainability
A
3 hrs
Test Coverage

Function getCustomUnitMetadata has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  public function getCustomUnitMetadata() {
    $nids = FieldHelper::getValues('node', $this->node, 'field_data_sources', 'target_id');
    $sources = node_load_multiple($nids);

    $custom_units = array();
Severity: Minor
Found in modules/custom/eml/lib/EmlDataSet.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

Method detectEmlChanges has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public function detectEmlChanges($check_unpublished = TRUE) {
    if ($check_unpublished && $this->node->status != NODE_PUBLISHED) {
      eml_debug("Skipping detectEmlChanges() since node @nid is not published.", array('@nid' => $this->node->nid));
      return FALSE;
    }
Severity: Minor
Found in modules/custom/eml/lib/EmlDataSet.php - About 1 hr to fix

    Function detectEmlChanges has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      public function detectEmlChanges($check_unpublished = TRUE) {
        if ($check_unpublished && $this->node->status != NODE_PUBLISHED) {
          eml_debug("Skipping detectEmlChanges() since node @nid is not published.", array('@nid' => $this->node->nid));
          return FALSE;
        }
    Severity: Minor
    Found in modules/custom/eml/lib/EmlDataSet.php - About 45 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

    Missing function doc comment
    Open

      public function setEmlValidationStatus($status = NULL) {

    Missing function doc comment
    Open

      public function getCustomUnitMetadata() {

    Missing function doc comment
    Open

      public static function getInstance($node) {

    Public method name "EmlDataSet::getPackageIDParts" is not in lowerCamel format
    Open

      public function getPackageIDParts() {

    Public method name "EmlDataSet::setEMLHash" is not in lowerCamel format
    Open

      public function setEMLHash($hash) {

    Public method name "EmlDataSet::getDOI" is not in lowerCamel format
    Open

      public function getDOI() {

    Missing function doc comment
    Open

      public function calculateEMLHash() {

    Missing function doc comment
    Open

      public function setEMLRevisionID($id) {

    Missing function doc comment
    Open

      public function __construct($node) {

    Public method name "EmlDataSet::getEML" is not in lowerCamel format
    Open

      public function getEML($reset = FALSE) {

    Missing function doc comment
    Open

      public function getNode() {

    Missing function doc comment
    Open

      public function setEMLHash($hash) {

    Public method name "EmlDataSet::getPackageID" is not in lowerCamel format
    Open

      public function getPackageID() {

    Missing function doc comment
    Open

      public function getEMLRevisionID() {

    Public method name "EmlDataSet::setEMLRevisionID" is not in lowerCamel format
    Open

      public function setEMLRevisionID($id) {

    Missing function doc comment
    Open

      public function incrementEMLRevisionID() {

    Return comment indentation must be 3 spaces, found 2 spaces
    Open

       *  This takes care of the   coding.

    Doc comment short description must be on a single line, further text should be a separate paragraph
    Open

     * Nov 2017 Added utf8 option to tidy statement at line 80, i.e. $tidy->repairString($xml, $config,'utf8') for &nbsp problem.

    Public method name "EmlDataSet::getEMLHash" is not in lowerCamel format
    Open

      public function getEMLHash() {

    Space before opening parenthesis of function call prohibited
    Open

          $xml = preg_replace ('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $xml);

    Public method name "EmlDataSet::calculateEMLHash" is not in lowerCamel format
    Open

      public function calculateEMLHash() {

    Missing function doc comment
    Open

      public function saveDOI($doi) {

    Missing function doc comment
    Open

      public function getPackageIDParts() {

    Public method name "EmlDataSet::getEMLRevisionID" is not in lowerCamel format
    Open

      public function getEMLRevisionID() {

    Public method name "EmlDataSet::incrementEMLRevisionID" is not in lowerCamel format
    Open

      public function incrementEMLRevisionID() {

    Return comment indentation must be 3 spaces, found 2 spaces
    Open

       *  Added utf8 encoding to the tidy statment

    Missing function doc comment
    Open

      public function getEMLHash() {

    Missing function doc comment
    Open

      public function getDOI() {

    Public method name "EmlDataSet::saveDOI" is not in lowerCamel format
    Open

      public function saveDOI($doi) {

    There are no issues that match your filters.

    Category
    Status