Server : Apache System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64 User : tradze ( 1001) PHP Version : 8.1.34 Disable Function : NONE Directory : /home/tradze/www/vendor/braintree/braintree_php/lib/Braintree/ |
<?php
namespace Braintree;
use InvalidArgumentException;
/**
* Braintree MultipleValueNode
* MultipleValueNode is an object for elements with possible values returned from the Braintree API
*/
class MultipleValueNode
{
public $name;
public $items;
public $allowedValues;
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
public function __construct($name, $allowedValues = [])
{
$this->name = $name;
$this->items = [];
$this->allowedValues = $allowedValues;
}
/**
* Sets the value of the object's items key to $values
*
* @param array $values to be set
*
* @throws InvalidArgumentException
*
* @return object
*/
public function in($values)
{
$bad_values = array_diff($values, $this->allowedValues);
if (count($this->allowedValues) > 0 && count($bad_values) > 0) {
$message = 'Invalid argument(s) for ' . $this->name . ':';
foreach ($bad_values as $bad_value) {
$message .= ' ' . $bad_value;
}
throw new InvalidArgumentException($message);
}
$this->items = $values;
return $this;
}
/**
* Sets the value of the object's items key to [$value]
*
* @param object $value to be set
*
* @return object
*/
public function is($value)
{
return $this->in([$value]);
}
/**
* Retrieves items(params) from the object
*
* @return object
*/
public function toParam()
{
return $this->items;
}
}