Code Duplication    Length = 19-20 lines in 2 locations

src/DataGrid.php 2 locations

@@ 2032-2050 (lines=19) @@
2029
	 * @param  string $column
2030
	 * @return void
2031
	 */
2032
	public function handleShowColumn($column)
2033
	{
2034
		$columns = $this->getSessionData('_grid_hidden_columns');
2035
2036
		if (!empty($columns)) {
2037
			$pos = array_search($column, $columns);
2038
2039
			if ($pos !== FALSE) {
2040
				unset($columns[$pos]);
2041
			}
2042
		}
2043
2044
		$this->saveSessionData('_grid_hidden_columns', $columns);
2045
		$this->saveSessionData('_grid_hidden_columns_manipulated', TRUE);
2046
2047
		$this->redrawControl();
2048
2049
		$this->onRedraw();
2050
	}
2051
2052
2053
	/**
@@ 2058-2077 (lines=20) @@
2055
	 * @param  string $column
2056
	 * @return void
2057
	 */
2058
	public function handleHideColumn($column)
2059
	{
2060
		/**
2061
		 * Store info about hiding a column to session
2062
		 */
2063
		$columns = $this->getSessionData('_grid_hidden_columns');
2064
2065
		if (empty($columns)) {
2066
			$columns = [$column];
2067
		} else if (!in_array($column, $columns)) {
2068
			array_push($columns, $column);
2069
		}
2070
2071
		$this->saveSessionData('_grid_hidden_columns', $columns);
2072
		$this->saveSessionData('_grid_hidden_columns_manipulated', TRUE);
2073
2074
		$this->redrawControl();
2075
2076
		$this->onRedraw();
2077
	}
2078
2079
2080
	public function handleActionCallback($__key, $__id)