1 | <?php |
||
7 | class ModuleOptions extends AbstractOptions implements CacheOptionsInterface, FilterOptionsInterface |
||
8 | { |
||
9 | protected $__strictMode__ = false; |
||
10 | |||
11 | protected $enableCache = true; |
||
12 | |||
13 | protected $imgSourcePathStack = []; |
||
14 | |||
15 | protected $imgSourceMap = []; |
||
16 | |||
17 | protected $driver = 'gd'; |
||
18 | |||
19 | protected $filters = []; |
||
20 | |||
21 | protected $webRoot = 'public'; |
||
22 | |||
23 | protected $imageResolvers = []; |
||
24 | |||
25 | protected $allowedDrivers = [ |
||
26 | 'gd', |
||
27 | 'imagick', |
||
28 | 'gmagick', |
||
29 | ]; |
||
30 | |||
31 | protected $filterLoaders = []; |
||
32 | |||
33 | protected $cachePath = 'htimg'; |
||
34 | |||
35 | protected $cacheExpiry = 86400; |
||
36 | |||
37 | protected $defaultImageLoader = 'FileSystem'; |
||
38 | |||
39 | 1 | public function setEnableCache($enableCache) |
|
45 | |||
46 | 1 | public function getEnableCache() |
|
50 | |||
51 | 1 | public function setImgSourcePathStack(array $imgSourcePathStack) |
|
57 | |||
58 | 3 | public function getImgSourcePathStack() |
|
62 | |||
63 | 1 | public function setImgSourceMap($imgSourceMap) |
|
69 | |||
70 | 2 | public function getImgSourceMap() |
|
74 | |||
75 | 2 | public function setDriver($driver) |
|
76 | { |
||
77 | 2 | $driver = strtolower($driver); |
|
78 | 2 | if (!in_array($driver, $this->allowedDrivers)) { |
|
79 | 1 | throw new Exception\InvalidArgumentException( |
|
80 | 1 | sprintf( |
|
81 | 1 | '%s expects parameter 1 to one of %s, %s provided instead', |
|
82 | 1 | __METHOD__, |
|
83 | 1 | implode(', ', $this->allowedDrivers), |
|
84 | $driver |
||
85 | 1 | ) |
|
86 | 1 | ); |
|
87 | } |
||
88 | 1 | $this->driver = $driver; |
|
89 | |||
90 | 1 | return $this; |
|
91 | } |
||
92 | |||
93 | 2 | public function getDriver() |
|
97 | |||
98 | 1 | public function setFilters(array $filters) |
|
104 | |||
105 | 6 | public function addFilter($filterName, array $filterOptions) |
|
111 | |||
112 | 8 | public function getFilters() |
|
116 | |||
117 | 1 | public function setWebRoot($webRoot) |
|
123 | |||
124 | 1 | public function getWebRoot() |
|
128 | |||
129 | 1 | public function setFilterLoaders(array $filterLoaders) |
|
135 | |||
136 | 2 | public function getFilterLoaders() |
|
140 | |||
141 | 1 | public function setCachePath($cachePath) |
|
147 | |||
148 | 1 | public function getCachePath() |
|
152 | |||
153 | 1 | public function setCacheExpiry($cacheExpiry) |
|
159 | |||
160 | 1 | public function getCacheExpiry() |
|
164 | |||
165 | 2 | public function setImageResolvers(array $imageResolvers) |
|
169 | |||
170 | 3 | public function getImageResolvers() |
|
174 | |||
175 | 1 | public function setDefaultImageLoader($defaultImageLoader) |
|
179 | |||
180 | 1 | public function getDefaultImageLoader() |
|
184 | } |
||
185 |