src/Plugin/Field/FieldWidget/LocalistUrlWidget.php
File LocalistUrlWidget.php
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
Wontfix
<?php
namespace Drupal\stanford_fields\Plugin\Field\FieldWidget;
use Drupal\Component\Utility\NestedArray;
Method formElement
has 41 lines of code (exceeds 40 allowed). Consider refactoring. Wontfix
Wontfix
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element = parent::formElement($items, $delta, $element, $form, $form_state);
// Fallback to inherited link widget if the base_url is not set.
if (!$this->getSetting('base_url')) {
return $element;
Function massageFormValues
has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring. Wontfix
Wontfix
public function massageFormValues(array $values, array $form, FormStateInterface $form_state) {
if (!$this->getSetting('base_url')) {
return parent::massageFormValues($values, $form, $form_state);
}
- Read upRead up
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
syntax error, unexpected ','
Open
Open
id: 'localist_url',
- Exclude checks
Doc comment short description must start with a capital letter Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Doc comment short description must start with a capital letter Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Doc comment short description must start with a capital letter Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Doc comment short description must start with a capital letter Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Doc comment short description must start with a capital letter Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Doc comment short description must end with a full stop Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Doc comment short description must end with a full stop Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Doc comment short description must start with a capital letter Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Missing class doc comment Open
Open
class LocalistUrlWidget extends LinkWidget {
- Exclude checks
Doc comment short description must end with a full stop Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Perl-style comments are not allowed; use "// Comment" instead Open
Open
#[FieldWidget(
- Exclude checks
Doc comment short description must end with a full stop Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Doc comment short description must start with a capital letter Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Doc comment short description must end with a full stop Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 2 Open
Open
id: 'localist_url',
- Exclude checks
Doc comment short description must end with a full stop Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks
Unused use statement Open
Open
use Drupal\Core\Field\Attribute\FieldWidget;
- Exclude checks
Doc comment short description must end with a full stop Wontfix
Wontfix
* {@inheritDoc}
- Exclude checks