1<?php 2/** 3 * File containing the ezcConsoleArgumentAlreadyRegisteredException class. 4 * 5 * @package ConsoleTools 6 * @version 1.6.1 7 * @copyright Copyright (C) 2005-2010 eZ Systems AS. All rights reserved. 8 * @license http://ez.no/licenses/new_bsd New BSD License 9 */ 10 11/** 12 * There is already an argument registered with the given name or at the given place. 13 * 14 * @package ConsoleTools 15 * @version 1.6.1 16 */ 17class ezcConsoleArgumentAlreadyRegisteredException extends ezcConsoleException 18{ 19 /** 20 * The name of the argument is already in use. 21 */ 22 const NAMED = 1; 23 24 /** 25 * The position of the argument is already in use. Unset the position first and the re-register. 26 */ 27 const ORDERED = 2; 28 29 /** 30 * Creates a new exception object. 31 * The $type parameter can either be 32 * {@link ezcConsoleArgumentAlreadyRegisteredException::NAMED} or 33 * {@link ezcConsoleArgumentAlreadyRegisteredException::ORDERED}, indicating 34 * if the name of the parameter or its place are already taken. 35 * 36 * @param int $offset Offset of the already reagistered argument. 37 * @param int $type Type of the offset. 38 * @return void 39 */ 40 public function __construct( $offset, $type ) 41 { 42 switch ( $type ) 43 { 44 case self::NAMED: 45 $message = "Argument with name '$offset' already registered."; 46 break; 47 case self::ORDERED: 48 $message = "Argument at position '$offset' already registered."; 49 break; 50 } 51 parent::__construct( $message ); 52 } 53} 54?> 55