2025-01-13 19:04:02 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Data transfer object. Stores styling details for a single location.
|
|
|
|
*
|
|
|
|
* @package WooCommerce\PayPalCommerce\Settings\DTO;
|
|
|
|
*/
|
|
|
|
|
|
|
|
declare( strict_types = 1 );
|
|
|
|
|
|
|
|
namespace WooCommerce\PayPalCommerce\Settings\DTO;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DTO that collects all styling details of a single location
|
|
|
|
*
|
|
|
|
* Intentionally has no internal logic, sanitation or validation.
|
|
|
|
*/
|
|
|
|
class LocationStylingDTO {
|
|
|
|
/**
|
2025-01-17 18:06:45 +01:00
|
|
|
* The location name.
|
2025-01-13 19:04:02 +01:00
|
|
|
*
|
2025-01-17 18:06:45 +01:00
|
|
|
* @var string [cart|classic_checkout|express_checkout|mini_cart|product]
|
2025-01-13 19:04:02 +01:00
|
|
|
*/
|
2025-01-17 18:06:45 +01:00
|
|
|
public string $location;
|
2025-01-13 19:04:02 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether PayPal payments are enabled on this location.
|
|
|
|
*
|
|
|
|
* @var bool
|
|
|
|
*/
|
2025-01-17 18:06:45 +01:00
|
|
|
public bool $enabled;
|
2025-01-13 19:04:02 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* List of active payment methods, e.g., 'venmo', 'applepay', ...
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2025-01-17 18:06:45 +01:00
|
|
|
public array $methods;
|
2025-01-13 19:04:02 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shape of buttons on this location.
|
|
|
|
*
|
|
|
|
* @var string [rect|pill]
|
|
|
|
*/
|
2025-01-17 18:06:45 +01:00
|
|
|
public string $shape;
|
2025-01-13 19:04:02 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Label of the button on this location.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2025-01-17 18:06:45 +01:00
|
|
|
public string $label;
|
2025-01-13 19:04:02 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Color of the button on this location.
|
|
|
|
*
|
|
|
|
* @var string [gold|blue|silver|black|white]
|
|
|
|
*/
|
2025-01-17 18:06:45 +01:00
|
|
|
public string $color;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The button layout
|
|
|
|
*
|
|
|
|
* @var string [horizontal|vertical]
|
|
|
|
*/
|
|
|
|
public string $layout;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to show a tagline below the buttons.
|
|
|
|
*
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public bool $tagline;
|
2025-01-13 19:04:02 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*
|
|
|
|
* @param string $location The location name.
|
|
|
|
* @param bool $enabled Whether PayPal payments are enabled on this location.
|
|
|
|
* @param array $methods List of active payment methods.
|
|
|
|
* @param string $shape Shape of buttons on this location.
|
|
|
|
* @param string $label Label of the button on this location.
|
|
|
|
* @param string $color Color of the button on this location.
|
2025-01-17 18:06:45 +01:00
|
|
|
* @param string $layout Horizontal or vertical button layout.
|
|
|
|
* @param bool $tagline Whether to show a tagline below the buttons.
|
2025-01-13 19:04:02 +01:00
|
|
|
*/
|
|
|
|
public function __construct(
|
2025-01-17 18:06:45 +01:00
|
|
|
string $location = '',
|
|
|
|
bool $enabled = true,
|
|
|
|
array $methods = array(),
|
|
|
|
string $shape = 'rect',
|
|
|
|
string $label = 'pay',
|
|
|
|
string $color = 'gold',
|
|
|
|
string $layout = 'vertical',
|
|
|
|
bool $tagline = false
|
2025-01-13 19:04:02 +01:00
|
|
|
) {
|
|
|
|
$this->location = $location;
|
|
|
|
$this->enabled = $enabled;
|
|
|
|
$this->methods = $methods;
|
|
|
|
$this->shape = $shape;
|
|
|
|
$this->label = $label;
|
|
|
|
$this->color = $color;
|
2025-01-17 18:06:45 +01:00
|
|
|
$this->layout = $layout;
|
|
|
|
$this->tagline = $tagline;
|
2025-01-13 19:04:02 +01:00
|
|
|
}
|
|
|
|
}
|