src/Internal/JsonElementWriter.php 1 location
|
@@ 154-164 (lines=11) @@
|
| 151 |
|
* @return JsonWritable |
| 152 |
|
* @throws \LogicException |
| 153 |
|
*/ |
| 154 |
|
public function name(string $name): JsonWritable |
| 155 |
|
{ |
| 156 |
|
if ($this->stackStates[$this->stackSize - 1] !== self::STATE_OBJECT_NAME) { |
| 157 |
|
throw new LogicException('Cannot call name() at this point. Either name() has already been called or object serialization has not been started'); |
| 158 |
|
} |
| 159 |
|
|
| 160 |
|
$this->pendingName = $name; |
| 161 |
|
$this->stackStates[$this->stackSize - 1] = self::STATE_OBJECT_VALUE; |
| 162 |
|
|
| 163 |
|
return $this; |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
/** |
| 167 |
|
* Write an integer value |
src/Internal/JsonEncodeWriter.php 1 location
|
@@ 149-159 (lines=11) @@
|
| 146 |
|
* @return JsonWritable |
| 147 |
|
* @throws \LogicException |
| 148 |
|
*/ |
| 149 |
|
public function name(string $name): JsonWritable |
| 150 |
|
{ |
| 151 |
|
if ($this->stackStates[$this->stackSize - 1] !== self::STATE_OBJECT_NAME) { |
| 152 |
|
throw new LogicException('Cannot call name() at this point. Either name() has already been called or object serialization has not been started'); |
| 153 |
|
} |
| 154 |
|
|
| 155 |
|
$this->pendingName = $name; |
| 156 |
|
$this->stackStates[$this->stackSize - 1] = self::STATE_OBJECT_VALUE; |
| 157 |
|
|
| 158 |
|
return $this; |
| 159 |
|
} |
| 160 |
|
|
| 161 |
|
/** |
| 162 |
|
* Write an integer value |