-
Notifications
You must be signed in to change notification settings - Fork 208
/
ContentTypeGroupRefList.php
65 lines (58 loc) · 1.88 KB
/
ContentTypeGroupRefList.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* File containing the ContentTypeGroupRefList parser class
*
* @copyright Copyright (C) 1999-2014 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version //autogentag//
*/
namespace eZ\Publish\Core\REST\Client\Input\Parser;
use eZ\Publish\Core\REST\Common\Input\ParserTools;
use eZ\Publish\Core\REST\Common\Input\BaseParser;
use eZ\Publish\Core\REST\Common\Input\ParsingDispatcher;
use eZ\Publish\Core\REST\Client\Values;
use eZ\Publish\API\Repository\ContentTypeService;
/**
* Parser for ContentTypeGroupRefList
*/
class ContentTypeGroupRefList extends BaseParser
{
/**
* @var \eZ\Publish\Core\REST\Common\Input\ParserTools
*/
protected $parserTools;
/**
* @var \eZ\Publish\API\Repository\ContentTypeService
*/
protected $contentTypeService;
/**
* @param ParserTools $parserTools
* @param \eZ\Publish\API\Repository\ContentTypeService $contentTypeService
*/
public function __construct( ParserTools $parserTools, ContentTypeService $contentTypeService )
{
$this->parserTools = $parserTools;
$this->contentTypeService = $contentTypeService;
}
/**
* Parse input structure
*
* @param array $data
* @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
*
* @return \eZ\Publish\Core\REST\Client\Values\ContentTypeGroupRefList
*/
public function parse( array $data, ParsingDispatcher $parsingDispatcher )
{
$contentTypeGroupReferences = array();
foreach ( $data['ContentTypeGroupRef'] as $groupData )
{
$contentTypeGroupReferences[] = $groupData["_href"];
}
return new Values\ContentTypeGroupRefList(
$this->contentTypeService,
$data["_href"],
$contentTypeGroupReferences
);
}
}