RequestInterface.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. const REQUEST_TYPE_PDF = 'pdf';
  26. /**
  27. * Get request type
  28. *
  29. * @access public
  30. * @return string
  31. */
  32. public function getType();
  33. /**
  34. * Set request method
  35. *
  36. * @access public
  37. * @param string $method
  38. */
  39. public function setMethod($method);
  40. /**
  41. * Get request method
  42. *
  43. * @access public
  44. * @return string
  45. */
  46. public function getMethod();
  47. /**
  48. * Set timeout period
  49. *
  50. * @access public
  51. * @param int $timeout
  52. */
  53. public function setTimeout($timeout);
  54. /**
  55. * Get timeout period
  56. *
  57. * @access public
  58. * @return int
  59. */
  60. public function getTimeout();
  61. /**
  62. * Set page load delay time.
  63. *
  64. * @access public
  65. * @param int $delay
  66. */
  67. public function setDelay($delay);
  68. /**
  69. * Get page load delay time.
  70. *
  71. * @access public
  72. * @return int
  73. */
  74. public function getDelay();
  75. /**
  76. * Set viewport size.
  77. *
  78. * @access public
  79. * @param int $width
  80. * @param int $height
  81. * @return void
  82. */
  83. public function setViewportSize($width, $height);
  84. /**
  85. * Get viewport width.
  86. *
  87. * @access public
  88. * @return int
  89. */
  90. public function getViewportWidth();
  91. /**
  92. * Get viewport height.
  93. *
  94. * @access public
  95. * @return int
  96. */
  97. public function getViewportHeight();
  98. /**
  99. * Set request URL
  100. *
  101. * @access public
  102. * @param string $url
  103. */
  104. public function setUrl($url);
  105. /**
  106. * Get request URL
  107. *
  108. * @access public
  109. * @return string
  110. */
  111. public function getUrl();
  112. /**
  113. * Get content body
  114. *
  115. * @access public
  116. * @return string
  117. */
  118. public function getBody();
  119. /**
  120. * Set request data
  121. *
  122. * @access public
  123. * @param array $data
  124. */
  125. public function setRequestData(array $data);
  126. /**
  127. * Get request data
  128. *
  129. * @access public
  130. * @param boolean $flat
  131. * @return array
  132. */
  133. public function getRequestData($flat = true);
  134. /**
  135. * Set headers
  136. *
  137. * @access public
  138. * @param array $headers
  139. */
  140. public function setHeaders(array $headers);
  141. /**
  142. * Add single header
  143. *
  144. * @access public
  145. * @param string $header
  146. * @param string $value
  147. */
  148. public function addHeader($header, $value);
  149. /**
  150. * Merge headers with existing
  151. *
  152. * @access public
  153. * @param array $headers
  154. */
  155. public function addHeaders(array $headers);
  156. /**
  157. * Get request headers
  158. *
  159. * @access public
  160. * @return array|string
  161. */
  162. public function getHeaders();
  163. /**
  164. * Set body styles
  165. *
  166. * @access public
  167. * @param array $styles
  168. */
  169. public function setBodyStyles(array $styles);
  170. /**
  171. * Get body styles
  172. *
  173. * @access public
  174. * @return array|string
  175. */
  176. public function getBodyStyles();
  177. }