'title' => 'Website URL',
'default' => null,
'type' => 'url',
+ 'required' => true,
),
'bwidth' => array(
'title' => 'Browser width',
*/
'swidth' => array(
'title' => 'Screenshot width',
- 'default' => 300,
+ 'default' => null,
'type' => 'int',
'min' => 16,
'max' => 8192,
foreach (static::$options as $name => $arOption) {
$this->values[$name] = $arOption['default'];
if (!isset($arValues[$name])) {
+ if (isset($arOption['required'])) {
+ throw new \InvalidArgumentException(
+ $name . ' parameter missing'
+ );
+ }
continue;
}
+
if ($arOption['type'] == 'url') {
$this->values[$name] = $this->validateUrl($arValues[$name]);
} else if ($arOption['type'] == 'int') {
protected function calcPageSize()
{
+ if ($this->values['swidth'] === null) {
+ $this->values['swidth'] = $this->values['bwidth'];
+ }
if ($this->values['smode'] == 'page') {
return;
}