PageRenderTime 36ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/monica/monica/vendor/zendframework/zendframework/library/Zend/Http/Header/ContentMD5.php

https://bitbucket.org/alexandretaz/maniac_divers
PHP | 50 lines | 27 code | 10 blank | 13 comment | 1 complexity | 580813fc06c678041c462217a9ee92b1 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * Zend Framework (http://framework.zend.com/)
  4. *
  5. * @link http://github.com/zendframework/zf2 for the canonical source repository
  6. * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
  7. * @license http://framework.zend.com/license/new-bsd New BSD License
  8. */
  9. namespace Zend\Http\Header;
  10. /**
  11. * @throws Exception\InvalidArgumentException
  12. * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.15
  13. */
  14. class ContentMD5 implements HeaderInterface
  15. {
  16. public static function fromString($headerLine)
  17. {
  18. $header = new static();
  19. list($name, $value) = explode(': ', $headerLine, 2);
  20. // check to ensure proper header type for this factory
  21. if (strtolower($name) !== 'content-md5') {
  22. throw new Exception\InvalidArgumentException('Invalid header line for Content-MD5 string: "' . $name . '"');
  23. }
  24. // @todo implementation details
  25. $header->value = $value;
  26. return $header;
  27. }
  28. public function getFieldName()
  29. {
  30. return 'Content-MD5';
  31. }
  32. public function getFieldValue()
  33. {
  34. return $this->value;
  35. }
  36. public function toString()
  37. {
  38. return 'Content-MD5: ' . $this->getFieldValue();
  39. }
  40. }