Builder.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php namespace Ixudra\Curl;
  2. class Builder {
  3. protected $curlObject = null;
  4. protected $curlOptions = array(
  5. 'RETURN_TRANSFER' => true,
  6. 'FAIL_ON_ERROR' => true,
  7. 'FOLLOW_LOCATION' => false,
  8. 'CONNECT_TIMEOUT' => '',
  9. 'TIMEOUT' => 30,
  10. 'USER_AGENT' => '',
  11. 'URL' => '',
  12. 'POST' => false,
  13. 'HTTP_HEADER' => array(),
  14. );
  15. protected $packageOptions = array(
  16. 'url' => '',
  17. 'parameters' => array(),
  18. 'asJson' => false,
  19. );
  20. /**
  21. * Set the URL to which the request is to be sent
  22. * @return $this
  23. */
  24. public function to($url)
  25. {
  26. return $this;
  27. }
  28. /**
  29. * Set the request timeout (default 30 seconds)
  30. * @return $this
  31. */
  32. public function withTimeout($timeout = 30)
  33. {
  34. return $this;
  35. }
  36. /**
  37. * Configure the package to encode and decode the request data
  38. * @return $this
  39. */
  40. public function asJson()
  41. {
  42. return $this;
  43. }
  44. /**
  45. * Send the request over a secure connection
  46. * @return $this
  47. */
  48. public function secure()
  49. {
  50. return $this;
  51. }
  52. /**
  53. * Set any specific cURL option
  54. * @param $key string The name of the cURL option
  55. * @param $value string The value to which the option is to be set
  56. * @return $this
  57. */
  58. public function withOption($key, $value)
  59. {
  60. return $this;
  61. }
  62. /**
  63. * Send a GET request to a URL using the specified cURL options
  64. */
  65. public function get()
  66. {
  67. return null;
  68. }
  69. /**
  70. * Send a POST request to a URL using the specified cURL options
  71. */
  72. public function post()
  73. {
  74. return null;
  75. }
  76. /**
  77. * Send a PUT request to a URL using the specified cURL options
  78. */
  79. public function put()
  80. {
  81. return null;
  82. }
  83. /**
  84. * Send a DELETE request to a URL using the specified cURL options
  85. */
  86. public function delete()
  87. {
  88. return null;
  89. }
  90. }