Passed
Push — master ( 041328...8c7a21 )
by IT
03:09
created

SubdirUniqDirectoryNamer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A directoryName() 0 7 2
1
<?php
2
3
namespace AppBundle\Services;
4
5
use App\Exception\MethodNotFoundException;
0 ignored issues
show
Bug introduced by
The type App\Exception\MethodNotFoundException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Doctrine\Common\Util\Inflector;
7
use Symfony\Component\Validator\Exception\NoSuchMetadataException;
8
use Vich\UploaderBundle\Mapping\PropertyMapping;
9
use Vich\UploaderBundle\Naming\DirectoryNamerInterface;
10
11
12
class SubdirUniqDirectoryNamer implements DirectoryNamerInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function directoryName($object, PropertyMapping $mapping)
18
    {
19
        if (method_exists(!$object, 'getId')) {
20
            throw new MethodNotFoundException();
21
        }
22
23
        return $object->getId();
24
    }
25
}
26