SU-SWS/stanford_profile_helper

View on GitHub
src/Plugin/Field/FieldWidget/SamlRoleMappingWidget.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Method formElement has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {

    // If the form is newly built, the form state storage will be null. If the
    // form is being rebuilt from an ajax, the storage will be some type of
    // array.
Severity: Minor
Found in src/Plugin/Field/FieldWidget/SamlRoleMappingWidget.php - About 1 hr to fix

    syntax error, unexpected ','
    Open

      id: "saml_role_mapping",

    Line indented incorrectly; expected 0 spaces, found 2
    Open

      id: "saml_role_mapping",

    Unused use statement
    Open

    use Drupal\Core\Field\Attribute\FieldWidget;

    Variable $role_id is undefined.
    Invalid

          ->load($role_id);

    Variable $comparison is undefined.
    Invalid

        [$role_id, $comparison] = explode(':', $role_mapping_string, 2);

    Variable $comparison is undefined.
    Invalid

        $exploded_comparison = explode(',', $comparison, 3);

    Perl-style comments are not allowed; use "// Comment" instead
    Open

    #[FieldWidget(

    Missing class doc comment
    Open

    class SamlRoleMappingWidget extends WidgetBase {

    Variable $role_id is undefined.
    Invalid

        [$role_id, $comparison] = explode(':', $role_mapping_string, 2);

    Variable $role_id is undefined.
    Invalid

          ['#markup' => $role ? $role->label() : $this->t('Broken: @id', ['@id' => $role_id])],

    There are no issues that match your filters.

    Category
    Status