open-orchestra/open-orchestra-display-bundle

View on GitHub

Showing 22 of 22 total issues

Method provideNodesAndTrees has 255 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideNodesAndTrees()
    {
        $rootNodeId = 'rootNodeId';
        $rootParentId = 'root';
        $childNodeId = 'childNodeId';
Severity: Major
Found in DisplayBundle/Tests/Manager/TreeManagerTest.php - About 1 day to fix

File TreeManagerTest.php has 276 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace OpenOrchestra\DisplayBundle\Tests\Manager;

use OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractBaseTestCase;
Severity: Minor
Found in DisplayBundle/Tests/Manager/TreeManagerTest.php - About 2 hrs to fix

Method show has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function show(ReadBlockInterface $block)
    {
        $currentRequest = $this->requestStack->getCurrentRequest();

        $routeAttributes = array_merge(
Severity: Major
Found in DisplayBundle/DisplayBlock/Strategies/ContactStrategy.php - About 2 hrs to fix

Function show has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function show(ReadBlockInterface $block)
    {
        $parameters = $this->requestStack->getMasterRequest()->get('_route_params');
        if (!array_key_exists('siteId', $parameters) || !array_key_exists('nodeId', $parameters)) {
            throw new RouteNotFoundException();
Severity: Minor
Found in DisplayBundle/DisplayBlock/Strategies/LanguageListStrategy.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 renderNav has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function renderNav($numberOfPages, $currentPage = 1, $queryParameters = array(), $maxPagesDisplayedAroundCurrent = 2)
    {
        $navigation = array();

        $firstPageDisplayed = 1;
Severity: Minor
Found in DisplayBundle/Twig/NavigatorExtension.php - About 1 hr to fix

Method generateHtml has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function generateHtml(BBcodeElementNodeInterface $el, $preview = false)
    {
        $children = $el->getChildren();
        $option = $el->getAttribute();
        if ($preview) {
Severity: Minor
Found in DisplayBundle/BBcode/InternalLinkDefinition.php - About 1 hr to fix

Function renderNav has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function renderNav($numberOfPages, $currentPage = 1, $queryParameters = array(), $maxPagesDisplayedAroundCurrent = 2)
    {
        $navigation = array();

        $firstPageDisplayed = 1;
Severity: Minor
Found in DisplayBundle/Twig/NavigatorExtension.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 show has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function show(ReadBlockInterface $block)
    {
        $template = 'OpenOrchestraDisplayBundle:Block/Video:show.html.twig';
        $parameters = array(
            'class' => $block->getStyle(),
Severity: Minor
Found in DisplayBundle/DisplayBlock/Strategies/VideoStrategy.php - About 1 hr to fix

Method show has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function show(ReadBlockInterface $block)
    {
        $parameters = $this->requestStack->getMasterRequest()->get('_route_params');
        if (!array_key_exists('siteId', $parameters) || !array_key_exists('nodeId', $parameters)) {
            throw new RouteNotFoundException();
Severity: Minor
Found in DisplayBundle/DisplayBlock/Strategies/LanguageListStrategy.php - About 1 hr to fix

Method getYoutubeParameters has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getYoutubeParameters(ReadBlockInterface $block)
    {
        $urlParams = array();
        foreach (array('youtubeAutoplay', 'youtubeShowinfo', 'youtubeFs', 'youtubeRel', 'youtubeDisablekb', 'youtubeLoop') as $key) {
            if ($block->getAttribute($key) === true) {
Severity: Minor
Found in DisplayBundle/DisplayBlock/Strategies/VideoStrategy.php - About 1 hr to fix

Function getDailymotionParameters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getDailymotionParameters(ReadBlockInterface $block)
    {
        $urlParams = array();

        foreach (array('dailymotionAutoplay', 'dailymotionChromeless') as $key) {
Severity: Minor
Found in DisplayBundle/DisplayBlock/Strategies/VideoStrategy.php - About 55 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 testSetPublicResponseCacheParameters has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function testSetPublicResponseCacheParameters($maxAge, $expectedMaxAge, $type, $hasEsi, $maxAgeCount, $sharedMaxAgeCount)
Severity: Minor
Found in DisplayBundle/Tests/Manager/CacheableManagerTest.php - About 45 mins to fix

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

        EngineInterface $templating,
        CacheableManager $cacheableManager,
        TagManager $tagManager,
        ContextInterface $currentSiteIdInterface,
        EventDispatcherInterface $dispatcher
Severity: Minor
Found in DisplayBundle/DisplayBlock/DisplayBlockManager.php - About 35 mins to fix

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

        ReadContentRepositoryInterface $contentRepository,
        ReadNodeRepositoryInterface $nodeRepository,
        TagManager $tagManager,
        TokenStorageInterface $tokenStorage,
        AuthorizationCheckerInterface $authorizationChecker
Severity: Minor
Found in DisplayBundle/DisplayBlock/Strategies/ContentListStrategy.php - About 35 mins to fix

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

        ReadNodeRepositoryInterface $nodeRepository,
        RequestStack $requestStack,
        TagManager $tagManager,
        AuthorizationCheckerInterface $authorizationChecker,
        TokenStorageInterface $tokenStorage
Severity: Minor
Found in DisplayBundle/DisplayBlock/Strategies/SubMenuStrategy.php - About 35 mins to fix

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

    public function testRenderNav($nbPages, $curPage, $params, $maxPages, $expected)
Severity: Minor
Found in DisplayBundle/Tests/Twig/NavigatorExtensionTest.php - About 35 mins to fix

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

    protected function getVimeoParameters(ReadBlockInterface $block)
    {
        $urlParams = array();

        foreach (array('vimeoAutoplay', 'vimeoFullscreen', 'vimeoLoop') as $key) {
Severity: Minor
Found in DisplayBundle/DisplayBlock/Strategies/VideoStrategy.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 getStrategy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getStrategy(ReadBlockInterface $block)
    {
        if (isset($this->cachedStrategies[$block->getId()])) {
            return $this->cachedStrategies[$block->getId()];
        }
Severity: Minor
Found in DisplayBundle/DisplayBlock/DisplayBlockManager.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 getYoutubeParameters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getYoutubeParameters(ReadBlockInterface $block)
    {
        $urlParams = array();
        foreach (array('youtubeAutoplay', 'youtubeShowinfo', 'youtubeFs', 'youtubeRel', 'youtubeDisablekb', 'youtubeLoop') as $key) {
            if ($block->getAttribute($key) === true) {
Severity: Minor
Found in DisplayBundle/DisplayBlock/Strategies/VideoStrategy.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 generateHtml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function generateHtml(BBcodeElementNodeInterface $el, $preview = false)
    {
        $children = $el->getChildren();
        $option = $el->getAttribute();
        if ($preview) {
Severity: Minor
Found in DisplayBundle/BBcode/InternalLinkDefinition.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