Passed
Push — master ( 9b8d7a...13dd3e )
by Stefano
03:16
created

SystemHelper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMaxFileSize() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace App\View\Helper;
5
6
use Cake\View\Helper;
7
8
/**
9
 * System helper
10
 */
11
class SystemHelper extends Helper
12
{
13
    /**
14
     * Get the minimum value between post_max_size and upload_max_filesize.
15
     *
16
     * @return int
17
     */
18
    public function getMaxFileSize(): int
19
    {
20
        $postMaxSize = intVal(substr(ini_get('post_max_size'), 0, -1));
21
        $uploadMaxFilesize = intVal(substr(ini_get('upload_max_filesize'), 0, -1));
22
23
        return min($postMaxSize, $uploadMaxFilesize) * 1024 * 1024;
24
    }
25
}
26