Code Duplication    Length = 19-20 lines in 2 locations

src/DataGrid.php 2 locations

@@ 2014-2032 (lines=19) @@
2011
	 * @param  string $column
2012
	 * @return void
2013
	 */
2014
	public function handleShowColumn($column)
2015
	{
2016
		$columns = $this->getSessionData('_grid_hidden_columns');
2017
2018
		if (!empty($columns)) {
2019
			$pos = array_search($column, $columns);
2020
2021
			if ($pos !== FALSE) {
2022
				unset($columns[$pos]);
2023
			}
2024
		}
2025
2026
		$this->saveSessionData('_grid_hidden_columns', $columns);
2027
		$this->saveSessionData('_grid_hidden_columns_manipulated', TRUE);
2028
2029
		$this->redrawControl();
2030
2031
		$this->onRedraw();
2032
	}
2033
2034
2035
	/**
@@ 2040-2059 (lines=20) @@
2037
	 * @param  string $column
2038
	 * @return void
2039
	 */
2040
	public function handleHideColumn($column)
2041
	{
2042
		/**
2043
		 * Store info about hiding a column to session
2044
		 */
2045
		$columns = $this->getSessionData('_grid_hidden_columns');
2046
2047
		if (empty($columns)) {
2048
			$columns = [$column];
2049
		} else if (!in_array($column, $columns)) {
2050
			array_push($columns, $column);
2051
		}
2052
2053
		$this->saveSessionData('_grid_hidden_columns', $columns);
2054
		$this->saveSessionData('_grid_hidden_columns_manipulated', TRUE);
2055
2056
		$this->redrawControl();
2057
2058
		$this->onRedraw();
2059
	}
2060
2061
2062
	public function handleActionCallback($__key, $__id)