Passed
Push — master ( fca16e...a09e23 )
by Alexander
04:10
created

Files   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 4 2
A __construct() 0 3 1
A replace() 0 4 1
1
<?php
2
3
/**
4
 * Lenevor Framework
5
 *
6
 * LICENSE
7
 *
8
 * This source file is subject to the new BSD license that is bundled
9
 * with this package in the file license.md.
10
 * It is also available through the world-wide-web at this URL:
11
 * https://lenevor.com/license
12
 * If you did not receive a copy of the license and are unable to
13
 * obtain it through the world-wide-web, please send an email
14
 * to [email protected] so we can send you a copy immediately.
15
 *
16
 * @package     Lenevor
17
 * @subpackage  Base
18
 * @link        https://lenevor.com
19
 * @copyright   Copyright (c) 2019 - 2023 Alexander Campo <[email protected]>
20
 * @license     https://opensource.org/licenses/BSD-3-Clause New BSD license or see https://lenevor.com/license or see /license.md
21
 */
22
23
namespace Syscodes\Components\Http\Loaders;
24
25
/**
26
 * Loads the files request.
27
 */
28
class Files extends Parameters
29
{
30
    /**
31
     * Constructor. The Files class instance.
32
     * 
33
     * @param  array  $parameters
34
     * 
35
     * @return void
36
     */
37
    public function __construct(array $parameters = [])
38
    {
39
        $this->replace($parameters);
40
    }
41
42
    /**
43
	 * Replaces the current parameters.
44
	 * 
45
	 * @param  array  $parameters
46
	 * 
47
	 * @return void
48
	 */
49
	public function replace(array $files = []): void
50
	{
51
		$this->parameters = [];
52
        $this->add($files);
53
	}
54
55
	/**
56
	 * Adds parameters.
57
	 * 
58
	 * @param  array  $parameters
59
	 * 
60
	 * @return void
61
	 */
62
	public function add(array $files = []): void
63
	{
64
        foreach ($files as $key => $file) {
65
            $this->set($key, $file);
66
        }
67
	}
68
}