You are here

public function JsonSchemaEncoder::supportsEncoding in Schemata 8

Overrides JsonEncoder::supportsEncoding

File

schemata_json_schema/src/Encoder/JsonSchemaEncoder.php, line 42

Class

JsonSchemaEncoder
Encodes data into json_schema.

Namespace

Drupal\schemata_json_schema\Encoder

Code

public function supportsEncoding($format) {
  $parts = explode(':', $format, 2);
  if (count($parts) < 2 || empty($parts[1])) {

    // Require sub type.
    return FALSE;
  }
  list($base, $encoded) = $parts;

  // Verify the correct base and that the sub type is supported by inner.
  return $base === $this->baseFormat && $this->innerEncoder
    ->supportsEncoding($encoded);
}