Completed
Push — output_formatting ( 5c6062...211baf )
by Emlyn
04:17 queued 01:36
created

Noop   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 26
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A canActivate() 0 4 1
A format() 0 11 1
1
<?php
2
/**
3
 * @package    Fuel\Foundation
4
 * @version    2.0
5
 * @author     Fuel Development Team
6
 * @license    MIT License
7
 * @copyright  2010 - 2017 Fuel Development Team
8
 * @link       http://fuelphp.com
9
 */
10
11
declare(strict_types=1);
12
13
namespace Fuel\Foundation\Formatter;
14
15
use Fuel\Foundation\Response\ResponseInterface;
16
use Zend\Diactoros\CallbackStream;
17
18
/**
19
 * Dummy formatter that simply passes the response right through.
20
 */
21
class Noop extends AbstractFormatter
22
{
23
24
	/**
25
	 * {@inheritdoc}
26
	 */
27 1
	public function canActivate($data) : bool
28
	{
29 1
		return true;
30
	}
31
32
	/**
33
	 * {@inheritdoc}
34
	 */
35 1
	public function format($data) : ResponseInterface
36
	{
37
		/** @var ResponseInterface $response */
38 1
		$response = $this->getContainer()->get('fuel.application.response');
39
40 1
		return $response->withBody(new CallbackStream(
41 1
			function() use ($data) {
42 1
				return $data;
43 1
			}
44
		));
45
	}
46
}
47