open-orchestra/open-orchestra-media-admin-bundle

View on GitHub

Showing 67 of 89 total issues

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

        Filesystem $fileSystem,
        MediaStorageManagerInterface $mediaStorageManager,
        VideoManagerInterface $videoManager,
        ImageManagerInterface $imageManager,
        $tmpDir,
Severity: Minor
Found in MediaAdmin/FileAlternatives/Strategy/VideoStrategy.php - About 45 mins to fix

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

    public function cropAlternative(MediaInterface $media, $x, $y, $h, $w, $formatName)
Severity: Minor
Found in MediaAdmin/FileAlternatives/Strategy/ImageStrategy.php - About 45 mins to fix

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

        Filesystem $fileSystem,
        MediaStorageManagerInterface $mediaStorageManager,
        ImageManagerInterface $imageManager,
        $tmpDir,
        array $thumbnailFormat,
Severity: Minor
Found in MediaAdmin/FileAlternatives/Strategy/ImageStrategy.php - About 45 mins to fix

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

    public function cropAndResize($filePath, $x, $y, $h, $w, array $format);
Severity: Minor
Found in MediaAdmin/FileUtils/Image/ImageManagerInterface.php - About 45 mins to fix

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

    public function cropAndResize($filePath, $x, $y, $h, $w, array $format)
Severity: Minor
Found in MediaAdmin/FileUtils/Image/ImagickImageManager.php - About 45 mins to fix

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

        $fileName,
        $folderReference,
        $name,
        array $keywordReferencesArray,
        array $languagesArray
Severity: Minor
Found in MediaAdminBundle/DataFixtures/MongoDB/LoadMediaData.php - About 35 mins to fix

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

    protected function generateFolder(array $names, $id, $folderId, $type, $siteId)
Severity: Minor
Found in MediaAdminBundle/Tests/Transformer/FolderTreeTransformerTest.php - About 35 mins to fix

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

    protected function checkRemoveReferencesToEntity($entity, $entityId, array $medias, $entityType, $itemRepository)

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

    protected function checkAddReferencesToEntity($entity, $entityId, array $medias, $entityType, $itemRepository)

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

        FolderRepositoryInterface $folderRepository,
        EventDispatcherInterface $eventDispatcher,
        FolderEventFactory $folderEventFactory,
        GroupRepositoryInterface $groupRepository,
        SiteRepositoryInterface $siteRepository
Severity: Minor
Found in MediaAdmin/EventSubscriber/FolderSubscriber.php - About 35 mins to fix

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

        Filesystem                   $fileSystem,
        MediaStorageManagerInterface $mediaStorageManager,
        ImageManagerInterface        $imageManager,
        $tmpDir,
        array $thumbnailFormat
Severity: Minor
Found in MediaAdmin/FileAlternatives/Strategy/PdfStrategy.php - About 35 mins to fix

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

        ContextBackOfficeInterface $currentSiteManager,
        $mediaClass,
        array $frontLanguages,
        array $thumbnailConfig,
        MediaStorageManagerInterface $storageManager
Severity: Minor
Found in MediaAdminBundle/Form/Type/MediaImageType.php - About 35 mins to fix

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

        $facadeClass = null,
        FolderRepositoryInterface $folderRepository,
        EventDispatcherInterface $eventDispatcher,
        FolderEventFactory $folderEventFactory,
        MultiLanguagesChoiceManagerInterface $multiLanguageChoiceManager
Severity: Minor
Found in MediaAdminBundle/Transformer/FolderTransformer.php - About 35 mins to fix

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

    public function isInPerimeter($item, PerimeterInterface $perimeter)
    {
        if ($perimeter->getType() == $this->getType() && is_string($item)) {
            foreach ($perimeter->getItems() as $path) {
                if (0 === strpos($item, $path)) {
Severity: Minor
Found in MediaAdmin/Perimeter/Strategy/MediaFolderPerimeterStrategy.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

Avoid too many return statements within this function.
Open

        return seconds + ' second' + this._numberEnding(seconds)

Avoid too many return statements within this method.
Open

        return $this->voteForSomeoneElseSubject($attribute, $subject, $token);
Severity: Major
Found in MediaAdmin/Security/Authorization/Voter/AbstractMediaFolderVoter.php - About 30 mins to fix

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

    _hasPerimeter(foldersTree) {
        for (let i = 0; i < foldersTree.length; i++) {
            if (foldersTree[i].get('folder').get('rights').can_create_media) {
                return true;
            }

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

    public function addReferencesToEntity($entity)
    {
        if ($this->support($entity)) {
            $mediaIds = $this->extractMediasFromElement($entity->getAttributes());

Severity: Minor
Found in MediaAdmin/Reference/Strategies/MediaInBlockReferenceStrategy.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 preSetData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function preSetData(FormEvent $event)
    {
        if ($event->getData() instanceof SiteInterface) {
            $currentSiteId = $event->getData()->getSiteId();
            $choices = $this->getChoices($currentSiteId);
Severity: Minor
Found in MediaAdmin/EventSubscriber/MediaLibrarySharingSubscriber.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 extractMediasFromElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function extractMediasFromElement($element)
    {
        $references = array();
        if ($this->isMediaAttribute($element)) {
            $references[] = $element['id'];
Severity: Minor
Found in MediaAdmin/Reference/Strategies/AbstractMediaReferenceStrategy.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