$data Data. * @param list> $fields Fields. * @param list $notices Notices. */ protected function build_descriptor( BookingSession $session, array $data = [], array $fields = [], array $notices = [] ): StepDescriptor { $draft = $session->draft(); $summary = []; if ( null !== $draft->service_id() ) { $summary['service_id'] = $draft->service_id(); $summary['price_minor'] = $draft->price_minor(); $summary['currency'] = $draft->currency(); } return new StepDescriptor( $this->name(), $this->label(), $this->component(), [] !== $session->completed_steps(), false, $this->next_label(), $data, $fields, $summary, $notices ); } /** * Read a positive int from input. * * @param array $input Input. * @param string $key Key. */ protected function positive_int( array $input, string $key ): ?int { if ( ! isset( $input[ $key ] ) ) { return null; } $value = (int) $input[ $key ]; return $value > 0 ? $value : null; } /** * Read a string from input. * * @param array $input Input. * @param string $key Key. */ protected function string_value( array $input, string $key ): ?string { if ( ! isset( $input[ $key ] ) || ! is_string( $input[ $key ] ) ) { return null; } $trimmed = trim( $input[ $key ] ); return '' === $trimmed ? null : $trimmed; } }