public function setContext($context, array $options = array())
    {
        if (!isset($context)) {
            $context = stream_context_create((array) $context, $options);
        }

        if (!is_resource($context)) {
            throw new UnexpectedValueException('Stream context is not a valid resource');
        }

        $this->context = $context;
        return $this;
    }
public function setContext($context, array $options = array())
    {
        if (!isset($context)) {
            $context = stream_context_create((array) $context, $options);
        }

        if (!is_resource($context)) {
            throw new UnexpectedValueException('Stream context is not a valid resource');
        }

        $this->context = $context;
        return $this;
    }
public function setContext ( $ context , array $ options = array ( ) ) { if ( ! isset ( $ context ) ) { $ context = stream_context_create ( ( array ) $ context , $ options ) ; } if ( ! is_resource ( $ context ) ) { throw new UnexpectedValueException ( 'Stream context is not a valid resource' ) ; } $ this -> context = $ context ; return $ this ; }
Sets the context resource
@param resource|array $context
@param array $options
@return $this
@throws UnexpectedValueException
Sets the context resource