newscoop/plugin-NewscoopPaywallBundle

View on GitHub

Showing 67 of 67 total issues

Method loadProperMessageTemplateBy has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function loadProperMessageTemplateBy($code)
    {
        switch ($code) {
            case Emails::USER_CONFIRMATION:
                $message = $this->templatesService->fetchTemplate(
Severity: Minor
Found in Services/NotificationsService.php - About 1 hr to fix

    Method sidebar has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function sidebar(PluginHooksEvent $event)
        {
            $user = $this->userService->getCurrentUser();
            if (!$this->pluginsService->isEnabled(LifecycleSubscriber::PLUGIN_NAME) || !$user->hasPermission(Permissions::SIDEBAR)) {
                return;
    Severity: Minor
    Found in EventListener/HookListener.php - About 1 hr to fix

      Method onMenuConfigure has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function onMenuConfigure(ConfigureMenuEvent $event)
          {
              $menu = $event->getMenu();
              $labelPlugins = $this->translator->trans('Plugins');
              $labelPluginName = $this->translator->trans('paywall.title');
      Severity: Minor
      Found in EventListener/ConfigureMenuListener.php - About 1 hr to fix

        Function durationAction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function durationAction(Request $request, $id = null)
            {
                $em = $this->getDoctrine()->getManager();
                $duration = new Duration();
                $form = $this->createForm(new DurationType(), $duration);
        Severity: Minor
        Found in Controller/AdminController.php - About 1 hr 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

        Method batchOrderAction has 26 lines of code (exceeds 25 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 1 hr to fix

          Function installAdapters has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function installAdapters()
              {
                  if (!isset($this->config['gateways'])) {
                      return;
                  }
          Severity: Minor
          Found in EventListener/AdaptersListener.php - About 45 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

          Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function __construct($em, $dispatcher, $scheduler, $systemPreferences, $pluginsService, $translator)
          Severity: Minor
          Found in EventListener/LifecycleSubscriber.php - About 45 mins to fix

            Function getListByCriteria has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getListByCriteria($criteria, $returnQuery = false)
                {
                    $qb = $this->createQueryBuilder('s');
            
                    $qb->select('s', 'r', 'd')
            Severity: Minor
            Found in Entity/Repository/SubscriptionRepository.php - About 45 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

            Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    EmailService $emailService,
                    SystemPreferencesService $systemPreferences,
                    TemplatesService $templatesService,
                    PlaceholdersService $placeholdersService,
                    EntityManager $em,
            Severity: Minor
            Found in Services/NotificationsService.php - About 45 mins to fix

              Function createItemAction has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function createItemAction(Request $request, Order $order)
                  {
                      $this->hasPermission(Permissions::ORDERS_MANAGE);
                      $em = $this->get('em');
                      $activeOnes = $this->getActiveSubscriptions($request->getLocale());
              Severity: Minor
              Found in Controller/UserOrderController.php - About 45 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

              Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      OrderService $orderService,
                      PaymentService $paymentService,
                      GatewayAdapter $adapter,
                      EntityManager $entityManager,
                      EventDispatcherInterface $dispatcher
              Severity: Minor
              Found in Services/PurchaseService.php - About 35 mins to fix

                Method getExpiringSubscriptions has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function getExpiringSubscriptions($offset, $batch, $now, $notify, $days = 7)
                Severity: Minor
                Found in Entity/Repository/UserSubscriptionRepository.php - About 35 mins to fix

                  Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          $templating,
                          $entityManager,
                          $templatesProvider,
                          $pluginsService,
                          $userService
                  Severity: Minor
                  Found in EventListener/HookListener.php - About 35 mins to fix

                    Function findActiveBy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function findActiveBy($locale = null, $specs = array())
                        {
                            $queryBuilder = $this
                                ->createQueryBuilder('s')
                                ->select('s', 'r')
                    Severity: Minor
                    Found in Entity/Repository/SubscriptionRepository.php - About 35 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 getErrorMessages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function getErrorMessages(\Symfony\Component\Form\Form $form)
                        {
                            $errors = array();
                            if (count($form) > 0) {
                                foreach ($form->all() as $child) {
                    Severity: Minor
                    Found in Controller/AdminController.php - About 35 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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function __construct($subscription = null)
                        {
                            if (!$subscription instanceof UserSubscription) {
                                $em = \Zend_Registry::get('container')->getService('em');
                                if (!$subscription) {
                    Severity: Minor
                    Found in Meta/MetaSubscription.php - About 35 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 createAction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function createAction(Request $request)
                        {
                            $this->hasPermission(Permissions::CURRENCIES_MANAGE);
                            $currency = $this->getRepository()->createNew();
                            $form = $this->createForm(new CurrencyType(), $currency);
                    Severity: Minor
                    Found in Controller/CurrencyController.php - About 35 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 loadProperMessageTemplateBy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function loadProperMessageTemplateBy($code)
                        {
                            switch ($code) {
                                case Emails::USER_CONFIRMATION:
                                    $message = $this->templatesService->fetchTemplate(
                    Severity: Minor
                    Found in Services/NotificationsService.php - About 35 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 filterMySubscriptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function filterMySubscriptions(array $items = array())
                        {
                            $orderItems = new ArrayCollection($items);
                            foreach ($orderItems as $item) {
                                foreach ($orderItems as $value) {
                    Severity: Minor
                    Found in Services/PaywallService.php - About 35 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 createAction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function createAction(Request $request)
                        {
                            $this->hasPermission(Permissions::DISCOUNTS_MANAGE);
                            $discount = new Discount();
                            $form = $this->createForm(new DiscountType(), $discount);
                    Severity: Minor
                    Found in Controller/DiscountController.php - About 35 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