MOON
Server: Apache
System: Linux server.netcommlabs.in 3.10.0-1160.83.1.el7.x86_64 #1 SMP Wed Jan 25 16:41:43 UTC 2023 x86_64
User: dermova (1051)
PHP: 5.4.45
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/dermova/www/india/wp-content/plugins/mailchimp-for-wp/includes/mailchimp/class-grouping.php
<?php

/**
 * Class MC4WP_MailChimp_Grouping
 *
 * Represents an Interest Grouping in MailChimp.
 *
 * @access public
 */
class MC4WP_MailChimp_Grouping {

	/**
	 * @var int
	 */
	public $id = 0;

	/**
	 * @var string
	 */
	public $name = '';

	/**
	 * @var string
	 */
	public $field_type = '';

	/**
	 * @var string[]
	 */
	public $groups = array();

	/**
	 * @param int $id
	 * @param string $name
	 * @param string $field_type
	 * @param array $groups
	 */
	public function __construct( $id, $name, $field_type, $groups = array() ) {
		$this->id = $id;
		$this->name = $name;
		$this->field_type = $field_type;
		$this->groups = $groups;
	}

	/**
	 * @param object $data
	 *
	 * @return MC4WP_MailChimp_Grouping
	 */
	public static function from_data( $data ) {

		$instance = new self( $data->id, $data->name, $data->form_field );

		// add group names as strings
		foreach( $data->groups as $group ) {
			$instance->groups[ $group->id ] = $group->name;
		}

		return $instance;
	}

}