public static function writableDirectory($value)
    {
        if (empty($value)) {
            throw new \InvalidArgumentException("Empty path given.");
        }

        if (!is_dir($value)) {
            throw new \InvalidArgumentException("Given path is not a regular directory.");
        }

        if (!is_writable($value)) {
            throw new \InvalidArgumentException("Given directory is not writable.");
        }

        return $value;
    }
public static function writableDirectory($value)
    {
        if (empty($value)) {
            throw new \InvalidArgumentException("Empty path given.");
        }

        if (!is_dir($value)) {
            throw new \InvalidArgumentException("Given path is not a regular directory.");
        }

        if (!is_writable($value)) {
            throw new \InvalidArgumentException("Given directory is not writable.");
        }

        return $value;
    }
public static function writableDirectory ( $ value ) { if ( empty ( $ value ) ) { throw new \ InvalidArgumentException ( "Empty path given." ) ; } if ( ! is_dir ( $ value ) ) { throw new \ InvalidArgumentException ( "Given path is not a regular directory." ) ; } if ( ! is_writable ( $ value ) ) { throw new \ InvalidArgumentException ( "Given directory is not writable." ) ; } return $ value ; }
Validates the given path and throws an exception
if it is not a regular directory or writable.

@param string $value value to check

@return string path to valid directory

@throws \InvalidArgumentException in case of validation errors (empty value, irregular or non-writable directory)
Validates the given path and throws an exception if it is not a regular directory or writable .