createFromViolationsBag()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 3
dl 0
loc 8
ccs 0
cts 5
cp 0
crap 2
rs 10
c 1
b 0
f 0
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