protected function isFileEmpty($value, $file = null)
    {
        $source   = null;
        $filename = null;

        if (is_string($value) && is_array($file)) {
            // Legacy Zend\Transfer API support
            $filename = $file['name'];
            $source   = $file['tmp_name'];
        } elseif (is_array($value)) {
            /** @noinspection UnSafeIsSetOverArrayInspection */
            if (isset($value['tmp_name'])) {
                $source = $value['tmp_name'];
            }

            /** @noinspection UnSafeIsSetOverArrayInspection */
            if (isset($value['name'])) {
                $filename = $value['name'];
            }
        } else {
            $source   = $value;
            $filename = basename($source);
        }

        /** @noinspection IsEmptyFunctionUsageInspection */
        return empty($source) || empty($filename);
    }