%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom329039/wp-content/plugins/gravityforms/includes/config/
Upload File :
Create Path :
Current File : /dom329039/wp-content/plugins/gravityforms/includes/config/class-gf-config-data-parser.php

<?php

namespace Gravity_Forms\Gravity_Forms\Config;

/**
 * Parses a given data array to return either Live or Mock values, depending on the
 * environment and context.
 *
 * @since 2.6
 *
 * @package Gravity_Forms\Gravity_Forms\Config
 */
class GF_Config_Data_Parser {

	/**
	 * Parse the given $data array and get the correct values for the context.
	 *
	 * @since 2.6
	 *
	 * @param $data
	 *
	 * @return array
	 */
	public function parse( $data ) {
		$return = array();

		foreach( $data as $key => $value ) {
			$return[ $key ] = $this->get_correct_value( $value );
		}

		return $return;
	}

	/**
	 * Loop through each array key and get the correct value. Is called recursively for
	 * nested arrays.
	 *
	 * @since 2.6
	 *
	 * @param mixed $value
	 *
	 * @return array|mixed
	 */
	private function get_correct_value( $value ) {

		// Value isn't array - we've reached the final level for this branch.
		if ( ! is_array( $value ) ) {
			return $value;
		}

		// Value is an array with our defined value and default keys. Return either live or mock data.
		if ( array_key_exists( 'default', $value ) && array_key_exists( 'value', $value ) ) {
			return $this->is_mock() ? $value['default'] : $value['value'];
		}

		$data = array();

		// Value is an array - recursively call this method to dig into each level and return the correct value.
		foreach( $value as $key => $value ) {
			$data[ $key ] = $this->get_correct_value( $value );
		}

		return $data;
	}

	/**
	 * Determine whether the current environmental context is a Mock context.
	 *
	 * @since 2.6
	 *
	 * @return bool
	 */
	private function is_mock() {
		return defined( 'GFORMS_DOING_MOCK' ) && GFORMS_DOING_MOCK;
	}

}

Zerion Mini Shell 1.0
September 2018 - GMH Consulting Group LLC Skip to content

GMH CONSULTING GROUP LLC

  • Home
  • Services
  • Customer Success Stories
  • Contact Us
×
  • Home
  • Services
  • Customer Success Stories
  • Contact Us
  • Home
  • Services
  • Customer Success Stories
  • Contact Us
  • Home
  • Services
  • Customer Success Stories
  • Contact Us

GMH CONSULTING GROUP LLC

Archive for September 2018

SAP Cloud Integration Platform

By pwsadmin |
A picture of the sap logo on a computer screen.

Browse Projects Accomplished by Our Consulting Team

Read More

Recent Posts

  • Advantages of mRNA Vaccines
  • Digitalization of Vaccines Enabled by S/4 HANA
  • SAP Cloud Integration Platform

Recent Comments

No comments to show.
SITE LINKS
  • Home
  • Services
  • Customer Success Stories
  • Contact Us
CONNECT WITH US
CONTACT INFORMATION

Phone: (813) 808-5570

Email: gustavohidalgo@gmhconsultinggroup.com 

 

A logo of the gmh consulting group
SITE LINKS
  • Home
  • Services
  • Customer Success Stories
  • Contact Us
CONNECT WITH US
CONTACT INFORMATION

Phone: (813) 808-5570

Email: gustavohidalgo@gmhcgroup.com

A logo of the gmh consulting group

© 2026 GMH Consulting Group LLC. All Rights Reserved.

Scroll To Top