Passed
Push — master ( b831b6...96f132 )
by John
06:04 queued 21s
created

LatexModel   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 11
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A info() 0 9 2
1
<?php
2
3
namespace App\Models\Latex;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Imagick;
7
8
class LatexModel extends Model
9
{
10
    public static function info($ltxsource, $type="png")
11
    {
12
        if(!in_array($type,['png','svg'])) return [];
13
        $url=route("latex.$type", ['ltxsource' => $ltxsource]);
14
        $image = new Imagick();
15
        $image->readImageBlob(Storage::get('latex-svg/'.urlencode($ltxsource).'.svg'));
0 ignored issues
show
Bug introduced by
The type App\Models\Latex\Storage was not found. Did you mean Storage? If so, make sure to prefix the type with \.
Loading history...
16
        $width = $image->getImageWidth();
17
        $height = $image->getImageHeight();
18
        return [$url,$width/5,$height/5];
19
    }
20
}
21