Completed
Pull Request — master (#2668)
by Jeroen
07:52 queued 02:11
created

ExtensionGuesserFactory::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Kunstmaan\MediaBundle\Helper;
4
5
use Kunstmaan\MediaBundle\Helper\File\SVGExtensionGuesser;
6
use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser;
7
use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesserInterface;
8
9
@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...
10
11
/**
12
 * @deprecated This class is deprecated since KunstmaanMediaBundle 5.7 and will be removed in KunstmaanMediaBundle 6.0. Use the symfony/mime component instead.
13
 */
14
class ExtensionGuesserFactory implements ExtensionGuesserFactoryInterface
0 ignored issues
show
Deprecated Code introduced by
The interface Kunstmaan\MediaBundle\He...GuesserFactoryInterface has been deprecated with message: This class is deprecated since KunstmaanMediaBundle 5.7 and will be removed in KunstmaanMediaBundle 6.0. Use the symfony/mime component 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...
15
{
16
    /**
17
     * Should return an extension guesser instance, used for file uploads
18
     *
19
     * NOTE: If you override this, you'll probably still have to register the SVGExtensionGuesser as last guesser...
20
     *
21
     * @return ExtensionGuesserInterface
22
     */
23
    public function get()
24
    {
25
        $guesser = ExtensionGuesser::getInstance();
26
        $guesser->register(new SVGExtensionGuesser());
0 ignored issues
show
Deprecated Code introduced by
The class Kunstmaan\MediaBundle\He...ile\SVGExtensionGuesser has been deprecated with message: This class is deprecated since KunstmaanMediaBundle 5.7 and will be removed in KunstmaanMediaBundle 6.0. Use the "symfony/mime" component 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...
27
28
        return $guesser;
29
    }
30
}
31