<?php
namespace nur\sery\wip\schema\types;

use nur\sery\php\nur_func;
use nur\sery\ValueException;
use nur\sery\wip\schema\Result;
use nur\sery\wip\schema\Schema;
use stdClass;

class tcallable extends _tsimple {
  static function ensure_callable(&$callable): void {
    if (!is_callable($callable)) throw ValueException::invalid_type($callable, "callable");
  }

  static function ensure_ncallable(&$callable): void {
    if ($callable !== null) self::ensure_callable($callable);
  }

  function isValid($value, ?bool &$normalized=null): bool {
    $normalized = is_callable($value);
    return nur_func::check_func($value, stdClass::class);
  }

  function verifix(&$value, Result &$result, Schema $schema): bool {
  }

  function format($value, $format=null): string {
  }
}
