ImageUtils   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 4
c 1
b 1
f 0
dl 0
loc 27
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getImageWidth() 0 3 1
A getImageDimensions() 0 3 1
A getImageHeight() 0 3 1
1
<?php
2
3
namespace Jackal\ImageMerge\Utils;
4
5
/**
6
 * Class ImageUtils
7
 * @package Jackal\ImageMerge\Utils
8
 */
9
class ImageUtils
10
{
11
    /**
12
     * @param $filePathName
13
     * @return int
14
     */
15
    public static function getImageWidth($filePathName)
16
    {
17
        return self::getImageDimensions($filePathName)[0];
18
    }
19
20
    /**
21
     * @param $filePathName
22
     * @return int
23
     */
24
    public static function getImageHeight($filePathName)
25
    {
26
        return self::getImageDimensions($filePathName)[1];
27
    }
28
29
    /**
30
     * @param $filePathName
31
     * @return array
32
     */
33
    private static function getImageDimensions($filePathName)
34
    {
35
        return getimagesize($filePathName);
0 ignored issues
show
Bug Best Practice introduced by
The expression return getimagesize($filePathName) could also return false which is incompatible with the documented return type array. Did you maybe forget to handle an error condition?

If the returned type also contains false, it is an indicator that maybe an error condition leading to the specific return statement remains unhandled.

Loading history...
36
    }
37
}
38