DataChunk.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpClient\Chunk;
  11. use Symfony\Contracts\HttpClient\ChunkInterface;
  12. /**
  13. * @author Nicolas Grekas <p@tchwork.com>
  14. *
  15. * @internal
  16. */
  17. class DataChunk implements ChunkInterface
  18. {
  19. /**
  20. * @var int
  21. */
  22. private $offset = 0;
  23. /**
  24. * @var string
  25. */
  26. private $content = '';
  27. /**
  28. * @param int $offset
  29. * @param string $content
  30. */
  31. public function __construct($offset = 0, $content = '')
  32. {
  33. $this->offset = $offset;
  34. $this->content = $content;
  35. }
  36. public function isTimeout()
  37. {
  38. return false;
  39. }
  40. public function isFirst()
  41. {
  42. return false;
  43. }
  44. public function isLast()
  45. {
  46. return false;
  47. }
  48. public function getInformationalStatus()
  49. {
  50. return null;
  51. }
  52. public function getContent()
  53. {
  54. return $this->content;
  55. }
  56. public function getOffset()
  57. {
  58. return $this->offset;
  59. }
  60. public function getError()
  61. {
  62. return null;
  63. }
  64. }