$value ) { if ( ! in_array( $key, array( 'price_cents', 'duration_minutes', 'buffer_before_minutes', 'buffer_after_minutes' ), true ) && ( ! array_key_exists( $key, $result ) || $result[ $key ] !== $value ) ) { throw new \DomainException( 'booking_quote_identity' ); } } foreach ( array( 'price_cents' => array( 0, 2147483647 ), 'duration_minutes' => array( 1, 1440 ), 'buffer_before_minutes' => array( 0, 1440 ), 'buffer_after_minutes' => array( 0, 1440 ) )as$key => $bounds ) { if ( ! isset( $result[ $key ] ) || filter_var( $result[ $key ], FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => $bounds[0], 'max_range' => $bounds[1] ) ) ) === false ) { throw new \DomainException( 'booking_quote_value' ); } } if ( ! isset( $result['_booking_quote'] ) && ( isset( $input['variant_id'] ) || isset( $input['extras'] ) || isset( $input['answers'] ) ) ) { throw new \DomainException( 'booking_options_unavailable' ); } Currency::validate( (int) $service['price_cents'], (string) $service['currency'] ); Currency::validate( (int) $result['price_cents'], (string) $result['currency'] ); return $result; } }