public function headerCallback($resource, $string)
    {
        if (!strpos($string, ':')) {
            return strlen($string);
        }

        list($name, $value) = array_map('trim', explode(':', $string, 2));

        $name = strtolower($name);

        if (!isset($this->headers[$name])) {
            $this->headers[$name] = [];
        }

        $this->headers[$name][] = $value;

        if ($this->onHeader === null || call_user_func($this->onHeader, $name, $value, $this->data) !== false) {
            return strlen($string);
        }

        return -1;
    }
public function headerCallback($resource, $string)
    {
        if (!strpos($string, ':')) {
            return strlen($string);
        }

        list($name, $value) = array_map('trim', explode(':', $string, 2));

        $name = strtolower($name);

        if (!isset($this->headers[$name])) {
            $this->headers[$name] = [];
        }

        $this->headers[$name][] = $value;

        if ($this->onHeader === null || call_user_func($this->onHeader, $name, $value, $this->data) !== false) {
            return strlen($string);
        }

        return -1;
    }
public function headerCallback ( $ resource , $ string ) { if ( ! strpos ( $ string , ':' ) ) { return strlen ( $ string ) ; } list ( $ name , $ value ) = array_map ( 'trim' , explode ( ':' , $ string , 2 ) ) ; $ name = strtolower ( $ name ) ; if ( ! isset ( $ this -> headers [ $ name ] ) ) { $ this -> headers [ $ name ] = [ ] ; } $ this -> headers [ $ name ] [ ] = $ value ; if ( $ this -> onHeader === null || call_user_func ( $ this -> onHeader , $ name , $ value , $ this -> data ) !== false ) { return strlen ( $ string ) ; } return - 1 ; }
Callback used to collect the headers.

@param resource $resource
@param string   $string

@return int
Callback used to collect the headers .