diff --git a/portal/columns.php b/portal/columns.php index 9393b664..a8e49a90 100644 --- a/portal/columns.php +++ b/portal/columns.php @@ -11,6 +11,7 @@ namespace board3\portal\portal; class columns { + /** @var array Column string to number map */ protected $column_map = array( 'left' => 1, 'center' => 2, @@ -19,6 +20,15 @@ class columns 'bottom' => 5, ); + /** @var array Column string to constant map */ + protected $constant_map = array( + 'top' => 1, + 'left' => 2, + 'center' => 4, + 'right' => 8, + 'bottom' => 16, + ); + /** * Convert column number to string equivalent * @@ -52,20 +62,6 @@ class columns */ public function string_to_constant($column) { - switch ($column) - { - case 'top': - return 1; - case 'left': - return 2; - case 'center': - return 4; - case 'right': - return 8; - case 'bottom': - return 16; - default: - return 0; - } + return (isset($this->constant_map[$column])) ? $this->constant_map[$column] : 0; } } \ No newline at end of file