Done !
| Server IP : 46.105.57.169 / Your IP : 216.73.216.67 Web Server : Apache System : Linux webm002.cluster120.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : verseaumee ( 152031) PHP Version : 8.5.7 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/v/e/r/verseaumee/blueversion/wp-content/plugins/give/src/FormAPI/ |
Upload File : |
<?php
namespace Give\FormAPI;
use Give\Framework\Exceptions\Primitives\InvalidArgumentException;
/**
* Class Options
*
* @package Give\Form\Theme
* @since 2.7.0
*/
final class Section
{
/**
* Group id.
*
* @since 2.7.0
* @var string
*/
public $id;
/**
* Name of group
*
* @since 2.7.0
* @var string
*/
public $name;
/**
* Description og group.
*
* @since 2.7.0
* @var string
*/
public $desc;
/**
* Array fo fields
*
* @since 2.7.0
* @var Fields[]
*/
public $fields = [];
/**
* Convert array into Group class object.
*
* @since 2.7.0
*
* @param array $array
*
* @return static
*/
public static function fromArray($array)
{
$group = new static();
$group->validate($array);
$group->id = $array['id'];
$group->name = $array['name'];
$group->desc = isset($array['desc']) ? $array['desc'] : null;
foreach ($array['fields'] as $field) {
$group->fields[] = Fields::fromArray($field);
}
return $group;
}
/**
* Validate group arguments
*
* @since 2.7.0
*
* @param $array
*/
private function validate($array)
{
$required = ['id', 'name', 'fields'];
if (array_diff($required, array_keys($array))) {
throw new InvalidArgumentException(
__('To create a Group object, please provide id, name and fields.', 'give')
);
}
}
}