Passed
Push — develop-webpack ( 7a1ea0...251399 )
by Daniel
04:27
created

update_column_width   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 14 1
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2019 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\sitemaker\services\blocks\action;
11
12
class update_column_width extends base_action
13
{
14
	/**
15
	 * {@inheritdoc}
16
	 */
17
	public function execute($style_id)
18
	{
19
		$position = $this->request->variable('position', '');
20
		$width = $this->request->variable('width', '');
21
22
		$column_widths = (array) json_decode($this->config['sitemaker_column_widths'], true);
23
		$column_widths[$style_id][$position] = $width;
24
25
		// clean up
26
		$column_widths[$style_id] = array_filter($column_widths[$style_id]);
27
28
		$this->config->set('sitemaker_column_widths', json_encode(array_filter($column_widths)));
29
30
		return array();
31
	}
32
}
33