FileUnacceptableForCollection   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 6
dl 0
loc 19
ccs 0
cts 5
cp 0
rs 10
c 2
b 1
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createFromViolationsBag() 0 8 1
1
<?php
2
3
namespace ByTIC\MediaLibrary\Exceptions\FileCannotBeAdded;
4
5
use ByTIC\MediaLibrary\Collections\Collection;
6
use ByTIC\MediaLibrary\Exceptions\FileCannotBeAdded;
7
use ByTIC\MediaLibrary\Media\Media;
8
use ByTIC\MediaLibrary\Validation\Violations\ViolationsBag;
9
10
/**
11
 * Class FileUnacceptableForCollection.
12
 */
13
class FileUnacceptableForCollection extends FileCannotBeAdded
14
{
15
    public $violations;
16
17
    /**
18
     * @param mixed         $media
19
     * @param Collection    $collection
20
     * @param ViolationsBag $bag
21
     *
22
     * @return FileUnacceptableForCollection
23
     */
24
    public static function createFromViolationsBag($file, Collection $collection, ViolationsBag $bag)
0 ignored issues
show
Unused Code introduced by
The parameter $collection is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

24
    public static function createFromViolationsBag($file, /** @scrutinizer ignore-unused */ Collection $collection, ViolationsBag $bag)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $file is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

24
    public static function createFromViolationsBag(/** @scrutinizer ignore-unused */ $file, Collection $collection, ViolationsBag $bag)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
    {
26
        $exception = new static(
27
            'The media was not accepted into the collection'
28
        );
29
        $exception->violations = $bag;
30
31
        return $exception;
32
    }
33
}
34