if (!
isset($options['sink'
])) { // Use a default temp stream if no sink was set.
$options['sink'
] = \GuzzleHttp\Psr7\Utils::
tryFopen('php://temp', 'w+'
);
} $sink =
$options['sink'
];
if (!\
is_string($sink)) { $sink = \GuzzleHttp\Psr7\Utils::
streamFor($sink);
} elseif (!\
is_dir(\
dirname($sink))) { // Ensure that the directory exists before failing in curl.
throw new \
RuntimeException(\
sprintf('Directory %s does not exist for sink value of %s', \
dirname($sink),
$sink));
} else { $sink =
new LazyOpenStream($sink, 'w+'
);
} $easy->sink =
$sink;
$conf[\CURLOPT_WRITEFUNCTION
] =
static function D
$ch,
$write) use ($sink): int
{ return $sink->
write($write);
};
$timeoutRequiresNoSignal = false;
if (isset($options['timeout'
])) { $timeoutRequiresNoSignal |=
$options['timeout'
] < 1;
$conf[\CURLOPT_TIMEOUT_MS
] =
$options['timeout'
] * 1000;
}