<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yoanm / jsonrpc-params-symfony-constraint-doc-sdk example snippets
use Yoanm\JsonRpcParamsSymfonyConstraintDoc\App\Helper\ConstraintPayloadDocHelper;
use Yoanm\JsonRpcParamsSymfonyConstraintDoc\App\Helper\DocTypeHelper;
use Yoanm\JsonRpcParamsSymfonyConstraintDoc\App\Helper\MinMaxHelper;
use Yoanm\JsonRpcParamsSymfonyConstraintDoc\App\Helper\StringDocHelper;
use Yoanm\JsonRpcParamsSymfonyConstraintDoc\App\Helper\TypeGuesser;
use Yoanm\JsonRpcParamsSymfonyConstraintDoc\Infra\Transformer\ConstraintToParamsDocTransformer;
$constraintPayloadDocHelper = new ConstraintPayloadDocHelper();
$transformer = new ConstraintToParamsDocTransformer(
new DocTypeHelper(
$constraintPayloadDocHelper,
new TypeGuesser()
),
new StringDocHelper(),
new MinMaxHelper(),
$constraintPayloadDocHelper
);
use Symfony\Component\Validator\Constraints as ConstraintNS;
use Yoanm\JsonRpcServerDoc\Domain\Model\Type\ObjectDoc;
use Yoanm\JsonRpcServerDoc\Domain\Model\Type\StringDoc;
$constraint = new ConstraintNS\Collection([
'a' => new ConstraintNS\Type('string'),
'b' => new ConstraintNS\Type('integer'),
'c' => new ConstraintNS\Type('bool')
]);
/** @var ObjectDoc $constraintDoc */
$constraintDoc = $transformer->transform($constraint);
/** @var StringDoc $constraintDoc2 */
$constraintDoc2 = $transformer->transformList([
new ConstraintNS\Type('string'),
new ConstraintNS\NotNull()
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.