'object', 'properties' => array( 'method' => array( 'enum' => array( 'fixed' ) ), 'amount' => array( 'type' => array( 'string', 'number' ) ), ), ); } /** * {@inheritDoc} * * @param array $pricing Raw block. */ public function sanitize( array $pricing ): array { return array( 'method' => 'fixed', 'amount' => $this->non_negative_decimal( $pricing['amount'] ?? '0' ), ); } /** * {@inheritDoc} * * @param array $pricing Pricing block. * @param Extra $extra Extra. * @param Selection $selection Selection. * @param Context $context Context. */ public function calculate( array $pricing, Extra $extra, Selection $selection, Context $context ): string { return $this->non_negative_decimal( $pricing['amount'] ?? '0' ); } }