class JsonEncoderContextBuilder
A helper providing autocompletion for available JsonEncoder options.
@author Mathias Arlaud <mathias.arlaud@gmail.com>
Hierarchy
- class \Symfony\Component\Serializer\Context\Encoder\JsonEncoderContextBuilder implements \Symfony\Component\Serializer\Context\ContextBuilderInterface uses \Symfony\Component\Serializer\Context\ContextBuilderTrait
Expanded class hierarchy of JsonEncoderContextBuilder
File
-
vendor/
symfony/ serializer/ Context/ Encoder/ JsonEncoderContextBuilder.php, line 24
Namespace
Symfony\Component\Serializer\Context\EncoderView source
final class JsonEncoderContextBuilder implements ContextBuilderInterface {
use ContextBuilderTrait;
/**
* Configures the json_encode flags bitmask.
*
* @see https://www.php.net/manual/en/json.constants.php
*
* @param positive-int|null $options
*/
public function withEncodeOptions(?int $options) : static {
return $this->with(JsonEncode::OPTIONS, $options);
}
/**
* Configures the json_decode flags bitmask.
*
* @see https://www.php.net/manual/en/json.constants.php
*
* @param positive-int|null $options
*/
public function withDecodeOptions(?int $options) : static {
return $this->with(JsonDecode::OPTIONS, $options);
}
/**
* Configures whether decoded objects will be given as
* associative arrays or as nested stdClass.
*/
public function withAssociative(?bool $associative) : static {
return $this->with(JsonDecode::ASSOCIATIVE, $associative);
}
/**
* Configures the maximum recursion depth.
*
* Must be strictly positive.
*
* @param positive-int|null $recursionDepth
*/
public function withRecursionDepth(?int $recursionDepth) : static {
return $this->with(JsonDecode::RECURSION_DEPTH, $recursionDepth);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ContextBuilderTrait::$context | private | property | |
ContextBuilderTrait::toArray | public | function | |
ContextBuilderTrait::with | protected | function | |
ContextBuilderTrait::withContext | public | function | |
JsonEncoderContextBuilder::withAssociative | public | function | Configures whether decoded objects will be given as associative arrays or as nested stdClass. |
JsonEncoderContextBuilder::withDecodeOptions | public | function | Configures the json_decode flags bitmask. |
JsonEncoderContextBuilder::withEncodeOptions | public | function | Configures the json_encode flags bitmask. |
JsonEncoderContextBuilder::withRecursionDepth | public | function | Configures the maximum recursion depth. |