PageRenderTime 49ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/www/libs/Zend/Http/Header/ContentMD5.php

https://bitbucket.org/Ppito/kawaiviewmodel2
PHP | 52 lines | 27 code | 11 blank | 14 comment | 1 complexity | ae95b6e044d39769d4387f9ef5ad049f 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-2012 Zend Technologies USA Inc. (http://www.zend.com)
  7. * @license http://framework.zend.com/license/new-bsd New BSD License
  8. * @package Zend_Http
  9. */
  10. namespace Zend\Http\Header;
  11. /**
  12. * @throws Exception\InvalidArgumentException
  13. * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.15
  14. */
  15. class ContentMD5 implements HeaderInterface
  16. {
  17. public static function fromString($headerLine)
  18. {
  19. $header = new static();
  20. list($name, $value) = explode(': ', $headerLine, 2);
  21. // check to ensure proper header type for this factory
  22. if (strtolower($name) !== 'content-md5') {
  23. throw new Exception\InvalidArgumentException('Invalid header line for Content-MD5 string: "' . $name . '"');
  24. }
  25. // @todo implementation details
  26. $header->value = $value;
  27. return $header;
  28. }
  29. public function getFieldName()
  30. {
  31. return 'Content-MD5';
  32. }
  33. public function getFieldValue()
  34. {
  35. return $this->value;
  36. }
  37. public function toString()
  38. {
  39. return 'Content-MD5: ' . $this->getFieldValue();
  40. }
  41. }