Completed
Push — master ( 8bf511...3127ce )
by Korotkov
03:22 queued 01:40
created

Files   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 33
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getLoaded() 0 3 1
A isLoaded() 0 5 2
A isFileType() 0 3 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author    : Jagepard <[email protected]">
7
 * @copyright Copyright (c) 2019, Jagepard
8
 * @license   https://mit-license.org/ MIT
9
 */
10
11
namespace Rudra\Container;
12
13
class Files extends Container
14
{
15
    /**
16
     * @param  string  $key
17
     * @param  string  $fieldName
18
     * @param  string  $formName
19
     * @return string
20
     */
21
    public function getLoaded(string $key, string $fieldName, string $formName = 'upload'): string
22
    {
23
        return $this->data[$formName][$fieldName][$key];
24
    }
25
26
    /**
27
     * @param  string  $value
28
     * @param  string  $formName
29
     * @return bool
30
     */
31
    public function isLoaded(string $value, string $formName = 'upload'): bool
32
    {
33
        return isset($this->data[$formName]['name'][$value])
34
            ? ($this->data[$formName]['name'][$value] !== '')
35
            : false;
36
    }
37
38
    /**
39
     * @param  string  $key
40
     * @param  string  $value
41
     * @return bool
42
     */
43
    public function isFileType(string $key, string $value): bool
44
    {
45
        return ($this->data['type'][$key] == $value) ? true : false;
46
    }
47
}
48