TYPO3 CMS  TYPO3_7-6
Response.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
20 class Response
21 {
22  const STATUS_Success = 'success';
23  const STATUS_Failure = 'failure';
24 
28  protected $status;
29 
33  protected $content;
34 
38  protected $error;
39 
43  protected $responseSection;
44 
50  public function __construct($status, $content, $error)
51  {
52  $this->status = $status;
53  $this->content = $content;
54  $this->error = $error;
55  }
56 
60  public function getStatus()
61  {
62  return $this->status;
63  }
64 
68  public function getContent()
69  {
70  return $this->content;
71  }
72 
76  public function getError()
77  {
78  return $this->error;
79  }
80 
84  public function getResponseContent()
85  {
86  if (!isset($this->responseContent)) {
87  $this->responseContent = new ResponseContent($this);
88  }
89  return $this->responseContent;
90  }
91 
95  public function getResponseSections()
96  {
97  $sectionIdentifiers = func_get_args();
98 
99  if (empty($sectionIdentifiers)) {
100  $sectionIdentifiers = ['Default'];
101  }
102 
103  $sections = [];
104  foreach ($sectionIdentifiers as $sectionIdentifier) {
105  $sections[] = $this->getResponseContent()->getSection($sectionIdentifier);
106  }
107 
108  return $sections;
109  }
110 }