Code Duplication    Length = 13-14 lines in 2 locations

src/AssetFactory.php 2 locations

@@ 47-59 (lines=13) @@
44
     * @throws  Exception\FactoryException  If the file could not be loaded
45
     * @return  Asset
46
     */
47
    public static function createFromSplFileInfo(\SplFileInfo $file)
48
    {
49
        $asset = new Asset();
50
        $guesser = MimeTypeGuesser::getInstance();
51
        return $asset
52
            ->setFilename($file->getFilename())
53
            ->setExtension($file->getExtension())
54
            ->setPathname($file->getPathname())
55
            ->setMimeType($guesser->guess($file->getPathname()))
56
            ->setClientOriginalName($file->getFilename())
57
            ->setClientOriginalExtension($file->getExtension())
58
        ;
59
    }
60
61
    /**
62
     * Creates an Asset from an UploadedFile instance
@@ 68-81 (lines=14) @@
65
     * @throws  Exception\FactoryException  If the file could not be loaded
66
     * @return  Asset
67
     */
68
    public static function createFromUploadedFile(UploadedFile $file)
69
    {
70
        $asset = new Asset();
71
        $guesser = MimeTypeGuesser::getInstance();
72
        return $asset
73
            ->setFilename($file->getFilename())
74
            ->setExtension($file->getExtension())
75
            ->setPathname($file->getPathname())
76
            ->setMimeType($guesser->guess($file->getPathname()))
77
            ->setClientOriginalName($file->getClientOriginalName())
78
            ->setClientOriginalExtension($file->getClientOriginalExtension())
79
            ->setClientMimeType($file->getClientMimeType())
80
        ;
81
    }
82
83
    /**
84
     * Creates an Asset from a URI