-
-
Notifications
You must be signed in to change notification settings - Fork 179
/
Copy pathFileConfig.php
115 lines (104 loc) · 2.31 KB
/
FileConfig.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
namespace Pion\Laravel\ChunkUpload\Config;
/**
* Class FileConfig.
*
* Enables loading a config settings from the Laravel Config facade.
*/
class FileConfig extends AbstractConfig
{
/**
* The file name of the config.
*/
const FILE_NAME = 'chunk-upload';
/**
* Returns a list custom handlers (custom, override).
*
* @return array
*/
public function handlers()
{
return $this->get('handlers', []);
}
/**
* Returns the disk name to use for the chunk storage.
*
* @return string
*/
public function chunksDiskName()
{
return $this->get('storage.disk');
}
/**
* The storage path for the chunks.
*
* @return string the full path to the storage
*
* @see FileConfig::get()
*/
public function chunksStorageDirectory()
{
return $this->get('storage.chunks');
}
/**
* Returns the time stamp string for clear command.
*
* @return string
*
* @see FileConfig::get()
*/
public function clearTimestampString()
{
return $this->get('clear.timestamp');
}
/**
* Returns the shedule config array.
*
* @return array<enable,cron>
*/
public function scheduleConfig()
{
return $this->get('clear.schedule');
}
/**
* Should the chunk name add a session?
*
* @return bool
*/
public function chunkUseSessionForName()
{
return $this->get('chunk.name.use.session', true);
}
/**
* Should the chunk name add a ip address?
*
* @return bool
*/
public function chunkUseBrowserInfoForName()
{
return $this->get('chunk.name.use.browser', false);
}
/**
* Should the chunk name add a hash name instead of original file name?
*
* @return bool
*/
public function chunkUseHashNameForName()
{
return $this->get('chunk.name.use.hashName', false);
}
/**
* Returns a chunks config value.
*
* @param string $key the config name is prepended to the key value
* @param mixed|null $default
*
* @return mixed
*
* @see \Config::get()
*/
public function get($key, $default = null)
{
return config(self::FILE_NAME.'.'.$key, $default);
}
}