RequestInterface.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. /*
  3. * This file is part of the php-phantomjs.
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. */
  8. namespace JonnyW\PhantomJs\Http;
  9. /**
  10. * PHP PhantomJs
  11. *
  12. * @author Jon Wenmoth <contact@jonnyw.me>
  13. */
  14. interface RequestInterface
  15. {
  16. const METHOD_OPTIONS = 'OPTIONS';
  17. const METHOD_GET = 'GET';
  18. const METHOD_HEAD = 'HEAD';
  19. const METHOD_POST = 'POST';
  20. const METHOD_PUT = 'PUT';
  21. const METHOD_DELETE = 'DELETE';
  22. const METHOD_PATCH = 'PATCH';
  23. const REQUEST_TYPE_DEFAULT = 'default';
  24. const REQUEST_TYPE_CAPTURE = 'capture';
  25. /**
  26. * Get request type
  27. *
  28. * @access public
  29. * @return string
  30. */
  31. public function getType();
  32. /**
  33. * Set request method
  34. *
  35. * @access public
  36. * @param string $method
  37. */
  38. public function setMethod($method);
  39. /**
  40. * Get request method
  41. *
  42. * @access public
  43. * @return string
  44. */
  45. public function getMethod();
  46. /**
  47. * Set timeout period
  48. *
  49. * @access public
  50. * @param int $timeout
  51. */
  52. public function setTimeout($timeout);
  53. /**
  54. * Get timeout period
  55. *
  56. * @access public
  57. * @return int
  58. */
  59. public function getTimeout();
  60. /**
  61. * Set page load delay time.
  62. *
  63. * @access public
  64. * @param int $delay
  65. */
  66. public function setDelay($delay);
  67. /**
  68. * Get page load delay time.
  69. *
  70. * @access public
  71. * @return int
  72. */
  73. public function getDelay();
  74. /**
  75. * Set viewport size.
  76. *
  77. * @access public
  78. * @param int $width
  79. * @param int $height
  80. * @return void
  81. */
  82. public function setViewportSize($width, $height);
  83. /**
  84. * Get viewport width.
  85. *
  86. * @access public
  87. * @return int
  88. */
  89. public function getViewportWidth();
  90. /**
  91. * Get viewport height.
  92. *
  93. * @access public
  94. * @return int
  95. */
  96. public function getViewportHeight();
  97. /**
  98. * Set request URL
  99. *
  100. * @access public
  101. * @param string $url
  102. */
  103. public function setUrl($url);
  104. /**
  105. * Get request URL
  106. *
  107. * @access public
  108. * @return string
  109. */
  110. public function getUrl();
  111. /**
  112. * Get content body
  113. *
  114. * @access public
  115. * @return string
  116. */
  117. public function getBody();
  118. /**
  119. * Set request data
  120. *
  121. * @access public
  122. * @param array $data
  123. */
  124. public function setRequestData(array $data);
  125. /**
  126. * Get request data
  127. *
  128. * @access public
  129. * @param boolean $flat
  130. * @return array
  131. */
  132. public function getRequestData($flat = true);
  133. /**
  134. * Set headers
  135. *
  136. * @access public
  137. * @param array $headers
  138. */
  139. public function setHeaders(array $headers);
  140. /**
  141. * Add single header
  142. *
  143. * @access public
  144. * @param string $header
  145. * @param string $value
  146. */
  147. public function addHeader($header, $value);
  148. /**
  149. * Merge headers with existing
  150. *
  151. * @access public
  152. * @param array $headers
  153. */
  154. public function addHeaders(array $headers);
  155. /**
  156. * Get request headers
  157. *
  158. * @access public
  159. * @param string $format
  160. * @return array
  161. */
  162. public function getHeaders($format = 'default');
  163. }