protected static function swapArgs(&$optional, &$swap, $default = null, $swap_required = true)
    {
        $is_swapped = false;
        if (empty($swap) && !empty($optional)) {
            $swap       = $optional;
            $optional   = $default;
            $is_swapped = true;
        }
        if ($swap_required && !$swap) {
            if (is_string($swap_required)) {
                $message = "Argument '{$swap_required}' is required.";
            } else {
                $message = "Missing argument.";
            }
            throw new Exceptions\InvalidArgumentException($message);
        }
        
        return $is_swapped;
    }
protected static function swapArgs(&$optional, &$swap, $default = null, $swap_required = true)
    {
        $is_swapped = false;
        if (empty($swap) && !empty($optional)) {
            $swap       = $optional;
            $optional   = $default;
            $is_swapped = true;
        }
        if ($swap_required && !$swap) {
            if (is_string($swap_required)) {
                $message = "Argument '{$swap_required}' is required.";
            } else {
                $message = "Missing argument.";
            }
            throw new Exceptions\InvalidArgumentException($message);
        }
        
        return $is_swapped;
    }
protected static function swapArgs ( & $ optional , & $ swap , $ default = null , $ swap_required = true ) { $ is_swapped = false ; if ( empty ( $ swap ) && ! empty ( $ optional ) ) { $ swap = $ optional ; $ optional = $ default ; $ is_swapped = true ; } if ( $ swap_required && ! $ swap ) { if ( is_string ( $ swap_required ) ) { $ message = "Argument '{$swap_required}' is required." ; } else { $ message = "Missing argument." ; } throw new Exceptions \ InvalidArgumentException ( $ message ) ; } return $ is_swapped ; }
Swaps two values when the second is empty and the first is not

Returns true when the arguments were swapped, and false if not.

Example:
```php
$env    = "live";
$values = null;
public function fetch($env, $values = null)
{
$is_swapped = $this->swapArgs($env, $values, "dev");
var_dump($is_swapped);
var_dump($env);
var_dump($values);

// Outputs:
// bool(true)
// string(4) "dev"
// string(4) "live"
}
```

@param mixed $optional       Swap when this value is not empty
@param mixed $swap           Swap when this value is empty
@param null  $default        The new value for $optional when swapped
@param bool  $swap_required  Is the $swap argument required?

@throws Exceptions\InvalidArgumentException When the $swap value is required and is empty

@return bool
Swaps two values when the second is empty and the first is not