Showing 26 of 26 total issues
Method getDefaultAttributes
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getDefaultAttributes(): array
{
return [
'name' => [
'type' => 'varchar',
Method _prepareForm
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _prepareForm(): self
{
parent::_prepareForm();
$form = $this->getForm();
Method __construct
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
Context $context,
Registry $registry,
ExtensionAttributesFactory $extensionFactory,
AttributeValueFactory $customAttributeFactory,
StoreManagerInterface $storeManager,
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Context $context,
Registry $registry,
FormFactory $formFactory,
Data $eavData,
YesnoFactory $yesnoFactory,
Method saveWebsiteIds
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function saveWebsiteIds(CustomEntityModel $entity): self
{
if ($this->storeManager->isSingleStoreMode()) {
$websiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
$entity->setWebsiteIds([$websiteId]);
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
CustomEntityFactory $customEntityFactory,
CustomEntityResource $customEntityResource,
StoreManagerInterface $storeManager,
MetadataPool $metadataPool,
ExtensibleDataObjectConverter $extensibleDataObjectConverter,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Context $context,
EncoderInterface $jsonEncoder,
TypeFactory $typeFactory,
GroupFactory $groupFactory,
CollectionFactory $collectionFactory,
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Context $context,
EntityManager $entityManager,
TypeFactory $typeFactory,
SetFactory $setFactory,
DefaultAttributes $defaultAttributes,
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
$name,
$primaryFieldName,
$requestFieldName,
CollectionFactory $collectionFactory,
array $addFieldStrategies = [],
Function saveWebsiteIds
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function saveWebsiteIds(CustomEntityModel $entity): self
{
if ($this->storeManager->isSingleStoreMode()) {
$websiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
$entity->setWebsiteIds([$websiteId]);
- 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 execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function execute(DataObject $object): void
{
foreach ($this->getMediaAttributes() as $attributeCode) {
$mediaFileName = $object->getData($attributeCode);
- 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 __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
CustomEntityRepositoryInterface $customEntityRepository,
Registry $registry,
PageFactory $resultPageFactory,
ForwardFactory $resultForwardFactory,
FilterManager $filterManager,
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
$name,
$primaryFieldName,
$requestFieldName,
PoolInterface $pool,
CollectionFactory $collectionFactory,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
AttributeSetRepositoryInterface $attributeSetRepository,
Registry $registry,
PageFactory $resultPageFactory,
ForwardFactory $resultForwardFactory,
FilterManager $filterManager,
Function modifyMetaConfig
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function modifyMetaConfig(array $metaConfig): array
{
if (isset($metaConfig['children'])) {
foreach ($metaConfig['children'] as $attributeCode => $attributeConfig) {
if ($this->startsWith($attributeCode, self::CONTAINER_PREFIX)) {
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Context $context,
DataViewModel $dataViewModel,
Builder $attributeBuilder,
ForwardFactory $resultForwardFactory,
JsonFactory $resultJsonFactory,
Function modifyData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function modifyData(array $data): array
{
if (!$this->locator->getEntity()->getId()) {
return $data;
}
- 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 __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Context $context,
Registry $registry,
FormFactory $formFactory,
Yesno $yesNo,
array $data = []
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
SitemapItemInterfaceFactory $itemFactory,
ConfigReader $configReader,
CustomEntityRepositoryInterface $customEntityRepository,
SearchCriteriaBuilder $searchCriteriaBuilder,
UrlInterface $urlBuilder
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
LoggerInterface $logger,
Registry $registry,
Config $eavConfig,
CustomEntityAttributeInterfaceFactory $attributeFactory,
CustomEntityAttributeRepositoryInterface $attributeRepository