<?php
namespace Opis\JsonSchema\Parsers\Keywords;
use Opis\JsonSchema\Keyword;
use Opis\JsonSchema\Info\SchemaInfo;
use Opis\JsonSchema\Keywords\SlotsKeyword;
use Opis\JsonSchema\Parsers\{KeywordParser, SchemaParser};
class SlotsKeywordParser extends KeywordParser
{
public function type(): string
{
return self::TYPE_APPEND;
}
public function parse(SchemaInfo $info, SchemaParser $parser, object $shared): ?Keyword
{
$schema = $info->data();
if (!$parser->option('allowSlots') || !$this->keywordExists($schema)) {
return null;
}