*/ public static function date(): array { return array( 'type' => 'string', 'pattern' => '^\d{4}-\d{2}-\d{2}$', ); } /** * Comparison mode. * * @return array */ public static function compare(): array { return array( 'type' => 'string', 'enum' => array( 'none', 'previous_period', 'previous_year' ), 'default' => 'none', ); } /** * Object schema wrapper. * * @param array> $properties Properties. * @param string[] $required Required keys. * @return array */ public static function object( array $properties, array $required = array() ): array { return array( 'type' => 'object', 'properties' => $properties, 'required' => $required, 'additionalProperties' => false, ); } /** * The period from start_date and end_date arguments. * * @param array $args Arguments. */ public static function period( array $args ): Period { return Period::from_dates( (string) $args['start_date'], (string) $args['end_date'] ); } }