ImageRepository   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A findImageFromFilename() 0 4 1
1
<?php
2
/**
3
 * This file is part of the IrishDan\ResponsiveImageBundle package.
4
 *
5
 * (c) Daniel Byrne <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE file that was distributed with this source
8
 * code.
9
 */
10
11
namespace IrishDan\ResponsiveImageBundle\Repository;
12
13
use Doctrine\ORM\EntityRepository;
14
use IrishDan\ResponsiveImageBundle\ResponsiveImageRepositoryInterface;
15
16
/**
17
 * Class ImageRepository
18
 *
19
 * @package IrishDan\ResponsiveImageBundle\Repository
20
 */
21
class ImageRepository extends EntityRepository implements ResponsiveImageRepositoryInterface
22
{
23
    /**
24
     * @param $filename
25
     *
26
     * @return mixed
27
     */
28
    public function findImageFromFilename($filename)
29
    {
30
        return $this->findOneByPath($filename);
0 ignored issues
show
Documentation Bug introduced by
The method findOneByPath does not exist on object<IrishDan\Responsi...sitory\ImageRepository>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
31
    }
32
}
33