class RevsDiffNormalizer in Replication 8
Same name and namespace in other branches
- 8.2 src/Normalizer/RevsDiffNormalizer.php \Drupal\replication\Normalizer\RevsDiffNormalizer
Hierarchy
- class \Drupal\serialization\Normalizer\NormalizerBase implements \Symfony\Component\Serializer\SerializerAwareInterface, CacheableNormalizerInterface uses \Symfony\Component\Serializer\SerializerAwareTrait
- class \Drupal\replication\Normalizer\RevsDiffNormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface
Expanded class hierarchy of RevsDiffNormalizer
1 string reference to 'RevsDiffNormalizer'
1 service uses RevsDiffNormalizer
File
- src/
Normalizer/ RevsDiffNormalizer.php, line 10
Namespace
Drupal\replication\NormalizerView source
class RevsDiffNormalizer extends NormalizerBase implements DenormalizerInterface {
/**
* @var string[]
*/
protected $supportedInterfaceOrClass = [
'Drupal\\replication\\RevisionDiff\\RevisionDiffInterface',
];
/**
* @var string[]
*/
protected $format = [
'json',
];
/** @var \Drupal\replication\RevisionDiffFactoryInterface */
protected $revisionDiffFactory;
public function __construct(RevisionDiffFactoryInterface $revisiondiff_factory) {
$this->revisionDiffFactory = $revisiondiff_factory;
}
/**
* {@inheritdoc}
*/
public function normalize($rev_diff, $format = NULL, array $context = []) {
/** @var \Drupal\replication\RevisionDiff\RevisionDiffInterface $rev_diff */
$missing = $rev_diff
->getMissing();
return $missing ?: new \stdClass();
}
/**
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = NULL, array $context = []) {
if (!isset($context['workspace'])) {
throw new LogicException('A \'workspace\' context is required to denormalize revision diff data.');
}
return $this->revisionDiffFactory
->get($context['workspace'])
->setRevisionIds($data);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableNormalizerInterface:: |
constant | Name of key for bubbling cacheability metadata via serialization context. | ||
NormalizerBase:: |
protected | function | Adds cacheability if applicable. | |
NormalizerBase:: |
protected | function | Checks if the provided format is supported by this normalizer. | 2 |
NormalizerBase:: |
public | function | Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization() | 1 |
NormalizerBase:: |
public | function | Checks whether the given class is supported for normalization by this normalizer. | 1 |
RevsDiffNormalizer:: |
protected | property |
Overrides NormalizerBase:: |
|
RevsDiffNormalizer:: |
protected | property | @var \Drupal\replication\RevisionDiffFactoryInterface | |
RevsDiffNormalizer:: |
protected | property |
Overrides NormalizerBase:: |
|
RevsDiffNormalizer:: |
public | function | Denormalizes data back into an object of the given class. | |
RevsDiffNormalizer:: |
public | function | Normalizes an object into a set of arrays/scalars. | |
RevsDiffNormalizer:: |
public | function |