vendor/braintree/braintree_php/lib/Braintree/MultipleValueNode.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Braintree;
use InvalidArgumentException;
/**
* Braintree MultipleValueNode
* MultipleValueNode is an object for elements with possible values returned from the Braintree API
*/
class MultipleValueNode
{
// 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
*
后面还有 7 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
