newscoop/plugin-NewscoopPaywallBundle

View on GitHub

Showing 67 of 67 total issues

Avoid too many return statements within this method.
Open

        return array(
            'form' => $form->createView(),
            'formSpecification' => $formSpecification->createView(),
            'subscription_id' => $subscription->getId(),
            'ranges' => $subscription->getRanges()->toArray(),
Severity: Major
Found in Controller/AdminController.php - About 30 mins to fix

    Function countBy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function countBy(array $criteria)
        {
            $queryBuilder = $this->getEntityManager()->createQueryBuilder()
                ->select('count(u)')
                ->from($this->getEntityName(), 'u');
    Severity: Minor
    Found in Entity/Repository/UserSubscriptionRepository.php - About 25 mins to fix

    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 batchOrderAction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function batchOrderAction(Request $request, $currency)
        {
            $items = $request->request->get('batchorder', array());
            $response = new JsonResponse();
            if (empty($items)) {
    Severity: Minor
    Found in Controller/PurchaseController.php - About 25 mins to fix

    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 editAction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function editAction(Request $request, Discount $discount)
        {
            $this->hasPermission(Permissions::DISCOUNTS_MANAGE);
            $form = $this->createForm(new DiscountType(), $discount);
            $em = $this->get('em');
    Severity: Minor
    Found in Controller/DiscountController.php - About 25 mins to fix

    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 sendNotification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function sendNotification($code, array $recipients = array(), array $data = array())
        {
            if ($this->systemPreferences->PaywallEmailNotifyEnabled != '1') {
                return;
            }
    Severity: Minor
    Found in Services/NotificationsService.php - About 25 mins to fix

    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 runProcessing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private function runProcessing($now, $daysBefore, $level)
        {
            $notificationService = $this->getContainer()->getService('newscoop_paywall.notifications_service');
            $subscriptionsCount = $notificationService->getExpiringSubscriptionsCount(
                $now,
    Severity: Minor
    Found in Command/NotifierCommand.php - About 25 mins to fix

    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 editAction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function editAction(Request $request, Currency $currency)
        {
            $this->hasPermission(Permissions::CURRENCIES_MANAGE);
            $form = $this->createForm(new CurrencyType(), $currency);
            $em = $this->get('em');
    Severity: Minor
    Found in Controller/CurrencyController.php - About 25 mins to fix

    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

    Severity
    Category
    Status
    Source
    Language