1<?php 2/** 3 * Unit tests for HTTP_Request2 package 4 * 5 * PHP version 5 6 * 7 * LICENSE 8 * 9 * This source file is subject to BSD 3-Clause License that is bundled 10 * with this package in the file LICENSE and available at the URL 11 * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE 12 * 13 * @category HTTP 14 * @package HTTP_Request2 15 * @author Alexey Borzov <avb@php.net> 16 * @copyright 2008-2021 Alexey Borzov <avb@php.net> 17 * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License 18 * @link http://pear.php.net/package/HTTP_Request2 19 */ 20 21/** 22 * Makes a 3 second delay before sending the request body 23 */ 24class HTTP_Request2_Adapter_SlowpokeBody extends HTTP_Request2_MultipartBody 25{ 26 protected $doSleep; 27 28 public function rewind() 29 { 30 $this->doSleep = true; 31 parent::rewind(); 32 } 33 34 public function read($length) 35 { 36 if ($this->doSleep) { 37 sleep(3); 38 $this->doSleep = false; 39 } 40 return parent::read($length); 41 } 42} 43?> 44