GalleryManager   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPager() 0 4 1
A update() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\MediaBundle\Document;
15
16
use Sonata\Doctrine\Document\BaseDocumentManager;
17
use Sonata\MediaBundle\Model\GalleryInterface;
18
use Sonata\MediaBundle\Model\GalleryManagerInterface;
19
20
/**
21
 * @final since sonata-project/media-bundle 3.21.0
22
 */
23
class GalleryManager extends BaseDocumentManager implements GalleryManagerInterface
24
{
25
    /**
26
     * BC Compatibility.
27
     *
28
     * NEXT_MAJOR: remove this method.
29
     *
30
     * @deprecated Please use save() from now
31
     */
32
    public function update(GalleryInterface $gallery): void
33
    {
34
        parent::save($gallery);
0 ignored issues
show
Documentation introduced by
$gallery is of type object<Sonata\MediaBundle\Model\GalleryInterface>, but the function expects a object<Sonata\Doctrine\Model\T>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Comprehensibility Bug introduced by
It seems like you call parent on a different method (save() instead of update()). Are you sure this is correct? If so, you might want to change this to $this->save().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
35
    }
36
37
    public function getPager(array $criteria, $page, $limit = 10, array $sort = []): void
38
    {
39
        throw new \RuntimeException('Not Implemented yet');
40
    }
41
}
42