src/Phossa/Console/Option.php
/**
     * Check value with default values
     *
     * @param  mixed &$value value to check with
     * @return bool
     * @throws Exception\InvalidArgumentException
     *         if value is required but missing
     * @access protected
     */
Check value with default values
@param  mixed &$value value to check with
@return bool
@throws Exception\InvalidArgumentException
if value is required but missing
@access protected
Check value with default values @param mixed &$value value to check with @return bool @throws Exception \ InvalidArgumentException if value is required but missing @access protected
protected function checkDefault( &$value)
    {
        if (!$this->needValue()) return true;
        if ($this->isValueRequired() && $value === '') {
            throw new Exception\InvalidArgumentException(
                Message::get(Message::GETOPT_VALUE_REQUIRED, $this->name),
                Message::GETOPT_VALUE_REQUIRED
            );
        }
        if (is_null($this->rules['default'])) return true;
        $default = $this->rules['default'];
        if (is_array($default)) {
            if ($value === '') {
                $value = $default[0];
                return true;
            } else if (in_array($value, $default)) {
                return true;
            } else {
                return false;
            }
        } else {
            if ($value === '') $value = $default;
        }
        return true;
    }
protected function checkDefault ( & $ value ) { if ( ! $ this -> needValue ( ) ) return true ; if ( $ this -> isValueRequired ( ) && $ value === '' ) { throw new Exception \ InvalidArgumentException ( Message :: get ( Message :: GETOPT_VALUE_REQUIRED , $ this -> name ) , Message :: GETOPT_VALUE_REQUIRED ) ; } if ( is_null ( $ this -> rules [ 'default' ] ) ) return true ; $ default = $ this -> rules [ 'default' ] ; if ( is_array ( $ default ) ) { if ( $ value === '' ) { $ value = $ default [ 0 ] ; return true ; } else if ( in_array ( $ value , $ default ) ) { return true ; } else { return false ; } } else { if ( $ value === '' ) $ value = $ default ; } return true ; }
Check value with default values
 @param  mixed &$value value to check with
 @return bool
 @throws Exception\InvalidArgumentException
         if value is required but missing
 @access protected
Check value with default values @param mixed &$value value to check with @return bool @throws Exception \ InvalidArgumentException if value is required but missing @access protected
/*# string */ /*# : bool */ // no value needed // value is required but empty provided // no defaults // has defaults // enum defaults // set value to first default // value is in defaults // value is not right // non enum default // set value to default