for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Ivory Http Adapter package.
*
* (c) Eric GELOEN <[email protected]>
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/
namespace Ivory\HttpAdapter;
/**
* @author GeLo <[email protected]>
class FopenHttpAdapter extends AbstractStreamHttpAdapter
{
* {@inheritdoc}
public function getName()
return 'fopen';
}
protected function process($uri, $context)
$http_response_header = [];
$resource = @fopen($uri, 'rb', false, $context);
if (is_resource($resource)) {
$copy = @fopen('php://memory', 'rb+');
stream_copy_to_stream($resource, $copy);
fclose($resource);
} else {
$copy = $resource;
return [$copy, $http_response_header];