Showing 20 of 213 total issues
Function initialize
has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring. Open
initialize: function () {
countryCodeChange.initialize();
$(document).ready(function () {
$('.address-autocomplete-input').once('initiate-autocomplete').each(function () {
- 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
Function initialize
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function () {
countryCodeChange.initialize();
$(document).ready(function () {
$('.address-autocomplete-input').once('initiate-autocomplete').each(function () {
Function initializeAutoComplete
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initializeAutoComplete($autocompleteField, oldAutocomplete) {
var apiKey = $autocompleteField.attr('data-api-key');
var language = $autocompleteField.attr('data-language');
var allowedCountries = $autocompleteField.attr('data-allowed-countries').split('|');
Function createAutoCompleteInstance
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createAutoCompleteInstance() {
var autocomplete,
componentForm = {
street_number: 'short_name',
Function getValuesForPlain
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function getValuesForPlain(AddressEmbeddable $addressEmbeddable, AddressFormat $address_format) {
$values = [];
foreach (AddressField::getAll() as $field) {
$getter = 'get' . ucfirst($field);
$values[$field] = $addressEmbeddable->$getter();
- 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
Method getValuesForPlain
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getValuesForPlain(AddressEmbeddable $addressEmbeddable, AddressFormat $address_format) {
$values = [];
foreach (AddressField::getAll() as $field) {
$getter = 'get' . ucfirst($field);
$values[$field] = $addressEmbeddable->$getter();
Function preSubmit
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function preSubmit(FormEvent $event): void
{
$data = $event->getData();
if (!is_array($data) || !array_key_exists('countryCode', $data)) {
return;
- 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
Method preSetData
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function preSetData(FormEvent $event): void
{
/** @var AddressEmbeddable $address */
$address = $event->getData();
$form = $event->getForm();
Method preSubmit
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function preSubmit(FormEvent $event): void
{
$data = $event->getData();
if (!is_array($data) || !array_key_exists('countryCode', $data)) {
return;
Function getValuesForDefault
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function getValuesForDefault(AddressEmbeddable $addressEmbeddable, AddressFormat $address_format) {
$values = [];
foreach (AddressField::getAll() as $field) {
$getter = 'get' . ucfirst($field);
$values[$field] = $addressEmbeddable->$getter();
- 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
Function preSetData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function preSetData(FormEvent $event): void
{
/** @var AddressEmbeddable $address */
$address = $event->getData();
$form = $event->getForm();
- 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
Function initialize
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function () {
$(document).ready(function () {
$('.address-embeddable').once('initiate-country-code-change').each(function () {
var id = $(this).attr('id');
Function fillInAddress
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fillInAddress(place)
{
if (typeof place.name === 'undefined') {
place.name = getPlaceName(place);
}
Function getFieldOverrides
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function getFieldOverrides(FormInterface $form): FieldOverrides
{
if (!$this->validator) {
return new FieldOverrides([]);
}
- 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
Method getFieldOverrides
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getFieldOverrides(FormInterface $form): FieldOverrides
{
if (!$this->validator) {
return new FieldOverrides([]);
}
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
FormFactoryInterface $factory,
CountryRepositoryInterface $countryRepository,
AddressFormatRepositoryInterface $addressFormatRepository,
SubdivisionRepositoryInterface $subdivisionRepository,
ValidatorInterface $validator = null
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
CountryRepositoryInterface $countryRepository,
AddressFormatRepositoryInterface $addressFormatRepository,
SubdivisionRepositoryInterface $subdivisionRepository,
string $gmapsApiKey,
RequestStack $requestStack
Avoid too many return
statements within this method. Open
return new FieldOverrides([]);
Avoid too many return
statements within this method. Open
return $constraint->fieldOverrides;
Function getAddressDefault
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getAddressDefault(AddressEmbeddable $addressEmbeddable): string
{
$country_code = $addressEmbeddable->getCountryCode();
$address_format = $this->addressFormatRepository->get($country_code);
- 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"