Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 458 Bytes

CallbackPolicy.md

File metadata and controls

21 lines (15 loc) · 458 Bytes

CallbackPolicy

<?php

use Chubbyphp\Serialization\Normalizer\NormalizerContextInterface;
use Chubbyphp\Serialization\Policy\CallbackPolicy;
use MyProject\Model\Model;

$model = new Model();

/** @var NormalizerContextInterface $context */
$context = ...;

$policy = new CallbackPolicy(function (string $path, object $object, NormalizerContextInterface $context) {
    return true;
});

echo $policy->isCompliant('path', $model, $context);
// 1