Passed
Push — dev ( b45126...5faaf1 )
by 世昌
02:13
created

ExceptionContentWrapper::getContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
namespace suda\application\wrapper;
3
4
use suda\framework\Response;
5
use suda\framework\http\Stream;
6
use suda\framework\http\stream\StringStream;
7
use suda\application\template\ExceptionTemplate;
8
use suda\framework\response\AbstractContentWrapper;
9
10
/**
11
 * 异常类型响应包装器
12
 */
13
class ExceptionContentWrapper extends AbstractContentWrapper
14
{
15
    /**
16
     * 获取内容
17
     *
18
     * @param Response $response
19
     * @return Stream
20
     */
21
    public function getWrappedContent(Response $response):Stream
22
    {
23
        $content = $this->content;
24
        $template = new ExceptionTemplate($content);
25
        return new StringStream($template->getRenderedString());
26
    }
27
}
28