Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
| tao_install_services_Data | |
0.00% |
0 / 9 |
|
0.00% |
0 / 7 |
56 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| getContent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setContent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getEncoding | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setEncoding | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getMimeType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setMimeType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg |
| 19 | * (under the project TAO & TAO2); |
| 20 | * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung |
| 21 | * (under the project TAO-TRANSFER); |
| 22 | * 2009-2012 (update and modification) Public Research Centre Henri Tudor |
| 23 | * (under the project TAO-SUSTAIN & TAO-DEV); |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | /** |
| 28 | * Represents a bunch of Data consumed and/or returned by a tao_install_services_Service. |
| 29 | * |
| 30 | * @access public |
| 31 | * @author Jerome Bogaerts, <jerome@taotesting.com> |
| 32 | * @package tao |
| 33 | |
| 34 | */ |
| 35 | class tao_install_services_Data |
| 36 | { |
| 37 | /** |
| 38 | * The actual data. Services are expecting JSON encoded data. |
| 39 | */ |
| 40 | private $content; |
| 41 | |
| 42 | /** |
| 43 | * The mime type of the content. |
| 44 | */ |
| 45 | private $mimeType; |
| 46 | |
| 47 | /** |
| 48 | * The content encoding. |
| 49 | */ |
| 50 | private $encoding; |
| 51 | |
| 52 | /** |
| 53 | * Creates a new instance of tao_install_services_Data. Services expect the content to be |
| 54 | * JSON encoded data. |
| 55 | * @param string $content A JSON encoded content. |
| 56 | * @param string $encoding The content encoding. |
| 57 | * @param string $mimeType The content mime type. |
| 58 | */ |
| 59 | public function __construct($content, $encoding = 'UTF-8', $mimeType = 'application/json') |
| 60 | { |
| 61 | $this->setContent($content); |
| 62 | $this->setEncoding($encoding); |
| 63 | $this->setMimeType($mimeType); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Gets the actual content of the data (JSON encoded). |
| 68 | * @return string JSON encoded value. |
| 69 | */ |
| 70 | public function getContent() |
| 71 | { |
| 72 | return $this->content; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Sets the actual content of the data (JSON encoded). |
| 77 | * @param string $content Some JSON encoded content. |
| 78 | * @return void |
| 79 | */ |
| 80 | public function setContent($content) |
| 81 | { |
| 82 | $this->content = $content; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Sets the encoding of the Data content. |
| 87 | * @return string A content encoding such as 'UTF-8'. |
| 88 | */ |
| 89 | public function getEncoding() |
| 90 | { |
| 91 | return $this->encoding; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Sets the encoding of the Data content. |
| 96 | * @param string $encoding A content encoding such as 'UTF-8'. |
| 97 | * @return void |
| 98 | */ |
| 99 | protected function setEncoding($encoding) |
| 100 | { |
| 101 | $this->encoding = $encoding; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Gets the content mime type for the actual content of this Data. |
| 106 | * @return string A content mime type such as 'application/json'. |
| 107 | */ |
| 108 | public function getMimeType() |
| 109 | { |
| 110 | return $this->mimeType; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Sets the content mime type for the actual content of this Data. |
| 115 | * @param string $mimeType A content mime type such as 'text/html'. |
| 116 | * @return void |
| 117 | */ |
| 118 | public function setMimeType($mimeType) |
| 119 | { |
| 120 | $this->mimeType = $mimeType; |
| 121 | } |
| 122 | } |