コード例 #1
0
 protected function setUp()
 {
     $factory = new Factory();
     $urlPrefix = 'https://www.example.tld/api/v1';
     $schemas = $factory->createContainer(['Author' => 'AuthorSchema']);
     $this->encoderA = $factory->createEncoder($schemas, new EncoderOptions(0, $urlPrefix));
     $this->encoderB = $factory->createEncoder($schemas, new EncoderOptions(JSON_BIGINT_AS_STRING, $urlPrefix));
     $this->encoderC = $factory->createEncoder($schemas, new EncoderOptions(JSON_PRETTY_PRINT, $urlPrefix, 123));
     $this->decoderA = new DocumentDecoder();
     $this->decoderB = new ArrayDecoder();
     $this->repository = new CodecMatcherRepository($factory);
     $this->repository->registerSchemas($schemas)->registerUrlPrefix($urlPrefix);
     $this->repository->configure($this->config);
 }
コード例 #2
0
 /**
  * @param SchemaContainerInterface $schemas
  * @param null $urlPrefix
  * @return CodecMatcherInterface
  */
 protected function createCodecMatcher(SchemaContainerInterface $schemas, $urlPrefix = null)
 {
     return $this->codecMatcherRepository->registerSchemas($schemas)->registerUrlPrefix($urlPrefix)->getCodecMatcher();
 }