AimeosTypeConverter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A convertFrom() 0 7 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://www.gnu.org/copyleft/lgpl.html
5
 * @copyright Aimeos (aimeos.org), 2015-2016
6
 * @package flow
7
 * @subpackage Flow
8
 */
9
10
11
namespace Aimeos\Flow;
12
13
use Neos\Flow\Annotations as Flow;
14
use Neos\Flow\Property\TypeConverter\MediaTypeConverter;
15
use Neos\Flow\Property\TypeConverter\MediaTypeConverterInterface;
16
use Neos\Flow\Property\PropertyMappingConfigurationInterface;
17
18
19
/**
20
 * Converter which transforms strings to arrays using the configured strategy.
21
 * This TypeConverter is used by the Aimeos shop package to decode only the required content
22
 * of a HTTP request which excludes json and xml based media types.
23
 *
24
 * @package flow
25
 * @subpackage Flow
26
 * @api
27
 * @Flow\Scope("singleton")
28
 */
29
class AimeosTypeConverter extends MediaTypeConverter implements MediaTypeConverterInterface
30
{
31
	protected $priority = -2;
32
33
34
	/**
35
	 * Convert the given $source to $targetType depending on the MediaTypeConverterInterface::CONFIGURATION_MEDIA_TYPE property mapping configuration
36
	 *
37
	 * @param string $source the raw request body
38
	 * @param string $targetType must be "array"
39
	 * @param array $convertedChildProperties
40
	 * @param PropertyMappingConfigurationInterface $configuration
41
	 * @return array
42
	 * @api
43
	 */
44
	public function convertFrom($source, $targetType, array $convertedChildProperties = array(), PropertyMappingConfigurationInterface $configuration = NULL)
45
	{
46
		$result = array();
47
48
		parse_str($source, $result);
49
50
		return $result;
51
	}
52
}
53