Array.php
1 year ago
Broken.php
1 year ago
ClassWithCtor.php
1 year ago
ComplexClassWithCtor.php
1 year ago
DependencyInjector.php
1 year ago
DerivedClass.php
1 year ago
DerivedClass2.php
1 year ago
FactoryMethod.php
1 year ago
FactoryMethodWithError.php
1 year ago
JsonMapperCommentsDiscardedException.php
1 year ago
JsonMapperForCheckingAllowedPaths.php
1 year ago
Logger.php
1 year ago
MapsWithSetters.php
1 year ago
Php7TypedClass.php
1 year ago
Php7_1TypedClass.php
1 year ago
PrivateWithSetter.php
1 year ago
Simple.php
1 year ago
SimpleBase.php
1 year ago
SimpleBaseWithMissingDiscrimType.php
1 year ago
ValueObject.php
1 year ago
Simple.php
180 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Part of JsonMapper |
| 4 | * |
| 5 | * PHP version 5 |
| 6 | * |
| 7 | * @category Netresearch |
| 8 | * @package JsonMapper |
| 9 | * @author Christian Weiske <christian.weiske@netresearch.de> |
| 10 | * @license OSL-3.0 http://opensource.org/licenses/osl-3.0 |
| 11 | * @link http://www.netresearch.de/ |
| 12 | */ |
| 13 | |
| 14 | /** |
| 15 | * Unit test helper class for testing property mapping |
| 16 | * |
| 17 | * @category Netresearch |
| 18 | * @package JsonMapper |
| 19 | * @author Christian Weiske <christian.weiske@netresearch.de> |
| 20 | * @license OSL-3.0 http://opensource.org/licenses/osl-3.0 |
| 21 | * @link http://www.netresearch.de/ |
| 22 | */ |
| 23 | class JsonMapperTest_Simple |
| 24 | { |
| 25 | /** |
| 26 | * @var bool |
| 27 | */ |
| 28 | public $pbool; |
| 29 | |
| 30 | /** |
| 31 | * @var boolean |
| 32 | */ |
| 33 | public $pboolean; |
| 34 | |
| 35 | /** |
| 36 | * @var int |
| 37 | */ |
| 38 | public $pint; |
| 39 | |
| 40 | /** |
| 41 | * @var integer |
| 42 | */ |
| 43 | public $pinteger; |
| 44 | |
| 45 | /** |
| 46 | * @var int|null |
| 47 | */ |
| 48 | public $pnullable; |
| 49 | |
| 50 | /** |
| 51 | * @var float |
| 52 | */ |
| 53 | public $fl; |
| 54 | |
| 55 | /** |
| 56 | * @var double |
| 57 | */ |
| 58 | public $db; |
| 59 | |
| 60 | /** |
| 61 | * @var mixed |
| 62 | */ |
| 63 | public $mixed; |
| 64 | |
| 65 | /** |
| 66 | * @var string |
| 67 | */ |
| 68 | public $str; |
| 69 | |
| 70 | /** |
| 71 | * This property has no @-var type hint |
| 72 | */ |
| 73 | public $notype; |
| 74 | |
| 75 | /** |
| 76 | * @var \DateTime |
| 77 | */ |
| 78 | public $datetime; |
| 79 | |
| 80 | /** |
| 81 | * @var string A protected property without a setter method |
| 82 | */ |
| 83 | protected $protectedStrNoSetter; |
| 84 | /** |
| 85 | * @var JsonMapperTest_Simple |
| 86 | */ |
| 87 | public $simple; |
| 88 | |
| 89 | public $internalData; |
| 90 | |
| 91 | /** |
| 92 | * Variable name with underscore |
| 93 | * @var string |
| 94 | */ |
| 95 | public $under_score; |
| 96 | |
| 97 | /** |
| 98 | * @var |
| 99 | */ |
| 100 | public $empty; |
| 101 | |
| 102 | /** |
| 103 | * @var string |
| 104 | */ |
| 105 | public $setterPreferredOverProperty; |
| 106 | |
| 107 | /** |
| 108 | * Value object which needs to be set as an instance (without mapping) |
| 109 | * @var JsonMapperTest_ValueObject |
| 110 | */ |
| 111 | public $valueObject; |
| 112 | |
| 113 | public function setSimpleSetterOnlyTypeHint(JsonMapperTest_Simple $s) |
| 114 | { |
| 115 | $this->internalData['typehint'] = $s; |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * @param JsonMapperTest_Simple $s Some test object |
| 120 | */ |
| 121 | public function setSimpleSetterOnlyDocblock($s) |
| 122 | { |
| 123 | $this->internalData['docblock'] = $s; |
| 124 | } |
| 125 | |
| 126 | public function setSimpleSetterOnlyNoType($s) |
| 127 | { |
| 128 | $this->internalData['notype'] = $s; |
| 129 | } |
| 130 | |
| 131 | public function getProtectedStrNoSetter() |
| 132 | { |
| 133 | return $this->protectedStrNoSetter; |
| 134 | } |
| 135 | |
| 136 | public function setUnderScoreSetter($v) |
| 137 | { |
| 138 | $this->internalData['under_score_setter'] = $v; |
| 139 | } |
| 140 | |
| 141 | public function setSetterPreferredOverProperty($v) |
| 142 | { |
| 143 | $this->setterPreferredOverProperty = 'set via setter: ' . $v; |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * @return JsonMapperTest_ValueObject |
| 148 | */ |
| 149 | public function getValueObject() |
| 150 | { |
| 151 | return $this->valueObject; |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * @param JsonMapperTest_ValueObject $valueObject |
| 156 | */ |
| 157 | public function setValueObject(JsonMapperTest_ValueObject $valueObject) |
| 158 | { |
| 159 | $this->valueObject = $valueObject; |
| 160 | } |
| 161 | |
| 162 | public $additional = []; |
| 163 | |
| 164 | public function addAdditionalProperty($key, $value) |
| 165 | { |
| 166 | $this->additional[$key] = $value; |
| 167 | } |
| 168 | |
| 169 | private function privateAddAdditionalProperty($key, $value) |
| 170 | { |
| 171 | $this->additional[$key] = $value; |
| 172 | } |
| 173 | |
| 174 | public function brokenAddAdditionalProperty($value) |
| 175 | { |
| 176 | $this->additional[] = $value; |
| 177 | } |
| 178 | } |
| 179 | ?> |
| 180 |