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

update_column_width::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 1
dl 0
loc 14
rs 10
c 0
b 0
f 0
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