public function parse( array $args = null, $ignoreExceptions = false, $skipFirstArgument = true ) {

		if( $args === null ) {
			$args = $GLOBALS['argv'];
		}

		if( $skipFirstArgument ) {
			array_shift($args);
		}

		list($longParams, $shortParams, $this->arguments) = $this->splitArguments($args, $this->definedFlags);

		foreach( $longParams as $name => $value ) {
			if( !isset($this->definedFlags[$name]) ) {
				if( !$ignoreExceptions ) {
					throw new InvalidFlagParamException('Unknown option: --' . $name);
				}
			} else {
				$defined_flag =& $this->definedFlags[$name];

				if( $this->validateType($defined_flag[self::DEF_TYPE], $value) ) {
					$defined_flag[self::DEF_VALUE]  = $value;
					$defined_flag[self::DEF_PARSED] = true;
				} else {
					if( !$ignoreExceptions ) {
						throw new InvalidFlagTypeException('Option --' . $name . ' expected type: "' . $defined_flag[self::DEF_TYPE] . '"');
					}
				}
			}
		}

		foreach( $shortParams as $char => $value ) {
			if( !isset($this->definedShortFlags[$char]) ) {
				if( !$ignoreExceptions ) {
					throw new InvalidFlagParamException('Unknown option: -' . $char);
				}
			} else {
				$this->definedShortFlags[$char][self::DEF_VALUE] = $value;
			}
		}

		foreach( $this->definedFlags as $name => $data ) {
			if( $data[self::DEF_VALUE] === null ) {
				if( !$ignoreExceptions ) {
					throw new MissingFlagParamException('Expected option --' . $name . ' missing.');
				}
			}
		}

		$this->parsed = true;
	}