SVGExtensionGuesser::guess()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php
2
3
namespace Kunstmaan\MediaBundle\Helper\File;
4
5
use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesserInterface;
6
7
@trigger_error(sprintf('The "%s" class is deprecated since KunstmaanMediaBundle 5.7 and will be removed in KunstmaanMediaBundle 6.0. Use the "symfony/mime" component instead.', __CLASS__), E_USER_DEPRECATED);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
8
9
/**
10
 * @deprecated This class is deprecated since KunstmaanMediaBundle 5.7 and will be removed in KunstmaanMediaBundle 6.0. Use the "symfony/mime" component instead.
11
 */
12
class SVGExtensionGuesser implements ExtensionGuesserInterface
0 ignored issues
show
Deprecated Code introduced by
The interface Symfony\Component\HttpFo...tensionGuesserInterface has been deprecated with message: since Symfony 4.3, use {@link MimeTypesInterface} instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function guess($mimeType)
18
    {
19
        if ($mimeType === 'image/svg+xml') {
20
            return 'svg';
21
        }
22
23
        return null;
24
    }
25
}
26