Showing 42 of 56 total issues
Method buildDefaultSubscriptionFeatures
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildDefaultSubscriptionFeatures(string $subscriptionInterval): SubscribedFeaturesCollection
{
$activeUntil = Subscription::calculateActiveUntil($subscriptionInterval);
$features = [];
Function calculateSubscriptionAmount
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function calculateSubscriptionAmount(): MoneyInterface
{
$total = new Money([MoneyInterface::BASE_AMOUNT => 0, MoneyInterface::CURRENCY => $this->getSubscription()->getCurrency()]);
/** @var FeatureInterface $feature */
- 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 setTax
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function setTax(float $rate, string $name): HasRecurringPricesInterface
{
$this->taxName = $name;
$this->taxRate = $rate;
- 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 setPrices
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function setPrices(array $settingPrices, string $pricesType)
{
$this->pricesType = $pricesType;
$priceProperty = FeatureInterface::PRICE_NET === $this->pricesType ? 'netPrices' : 'grossPrices';
$setPrices = $this->$priceProperty;
Method isFree
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function isFree(): bool
{
if (empty($this->netPrices) && empty($this->grossPrices)) {
return true;
}
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(string $kind, ?array $elements = [])
{
if (false === \in_array($kind, [ConfiguredFeaturesCollection::KIND, SubscribedFeaturesCollection::KIND])) {
throw new \InvalidArgumentException(sprintf('Features kind can be only "configured" or "subscribed". You passed "%s".', $kind));
}
Function setPacks
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function setPacks(array $packs, string $packClass): HasConfiguredPacksInterface
{
$pricesType = $packs[HasConfiguredPacksInterface::_PRICES_TYPES];
unset($packs[HasConfiguredPacksInterface::_PRICES_TYPES]);
- 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 updateSubscription
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function updateSubscription(SubscribedFeaturesCollection $newFeatures = null): void
{
if (null !== $newFeatures) {
/**
* Before all, update the features, setting the new enabled status or adding the feature if not already present.
- 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 refreshSubscription
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function refreshSubscription(): void
{
$subscription = $this->getSubscription();
/** @var FeatureInterface $feature */
- 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 processPackages
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function processPackages(array $packs, $subscriptionType): array
{
$subscriptionHasFreePackage = false;
foreach ($packs as $numOfUnits => $prices) {
switch ($subscriptionType) {
- 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 createFeaturesService
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function createFeaturesService(string $name, array $setConfig, ContainerBuilder $containerBuilder, Definition $invoicesManagerDefinition, Reference $formFactoryReference): void
Method createInvoicesService
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function createInvoicesService(string $name, array $setConfig, ContainerBuilder $containerBuilder, array $drawers, Definition $arrayWriterDefinition): Definition
Function populateSection
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function populateSection(InvoiceSection $section, array $addedFeatures = null): void
{
/** @var SubscribedBooleanFeature $feature */
foreach ($this->buildPopulatingFeatures($addedFeatures) as $feature) {
$grossPrice = null;
- 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 updateUntilDates
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function updateUntilDates(): void
{
$validUntil = $this->getSubscription()->getNextRenewOn();
/** @var array $feature */
- 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
Avoid too many return
statements within this method. Open
return $treeBuilder;
Avoid too many return
statements within this method. Open
return $this->processTree($tree);
Avoid too many return
statements within this method. Open
return $diff->y >= 1;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return $this->validateTree($tree);
Avoid too many return
statements within this method. Open
return $diff->m >= 1;