JsonParser.php 555 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\httpclient;
  8. use yii\base\Object;
  9. use yii\helpers\Json;
  10. /**
  11. * JsonParser parses HTTP message content as JSON.
  12. *
  13. * @author Paul Klimov <klimov.paul@gmail.com>
  14. * @since 2.0
  15. */
  16. class JsonParser extends Object implements ParserInterface
  17. {
  18. /**
  19. * @inheritdoc
  20. */
  21. public function parse(Response $response)
  22. {
  23. return Json::decode($response->getContent());
  24. }
  25. }