Decode and decrypt values from a previously set environment variable.

@param string $group
@return array
167422
public function getVariables($group)
    {
        $encodedValues = $this->getEnvironmentVariable($group);

        if ($encodedValues === null) {
            return null;
        }

        return $this->decode($encodedValues);
    }
441972
private function sortGroup(array $group)
    {
        if (empty($group)) {
            return [];
        }

        if ($this->sortType == self::SORT_TYPE_LENGTH) {
            usort($group, function ($a, $b) {
                $cmp = strlen($b) - strlen($a);

                if ($cmp === 0) {
                    $a = strtolower($a);
                    $b = strtolower($b);

                    $cmp = strcmp($b, $a);
                }

                return $cmp;
            });
        } elseif ($this->sortType == self::SORT_TYPE_ALPHABETIC) {
            usort($group, function ($a, $b) {
                $a = strtolower($a);
                $b = strtolower($b);

                $cmp = strcmp($b, $a);
                if ($cmp === 0) {
                    $cmp = strlen($b) - strlen($a);
                }

                return $cmp;
            });
        }

        if ($this->sortDirection == self::SORT_DIRECTION_ASC) {
            $group = array_reverse($group);
        }

        return $group;
    }
331176
public function fetchAll(string $group = null)
    {
        if (static::$options === null) {
            static::$options = $this
                ->createModel()
                ->when($group, function ($query, $group) {
                    return $query->where('group', $group);
                })
                ->orderBy('group', 'asc')
                ->orderBy('key', 'asc')
                ->get();
        }

        return static::$options;
    }
1154207
public static function getInstance($group)
	{
		static $instances;

		// Set instances array
		if (!isset($instances))
		{
			$instances = array();
		}

		// Do we have a matching instance?
		if (!isset($instances[$group]))
		{
			// If an ID is passed, check for a match in existing instances
			if (is_numeric($group))
			{
				foreach ($instances as $instance)
				{
					if ($instance && $instance->get('gidNumber') == $group)
					{
						// Match found
						return $instance;
						break;
					}
				}
			}

			// No matches
			// Create group object
			$hzg = new self();

			if ($hzg->read($group) === false)
			{
				$instances[$group] = false;
			}
			else
			{
				$instances[$group] = $hzg;
			}
		}

		// Return instance
		return $instances[$group];
	}
213239
public function decrypt($payload)
    {
        $payload = $this->_getJsonPayload($payload);
        $iv = base64_decode($payload['iv']);
        $decrypted = openssl_decrypt($payload['value'], $this->_cipher, $this->_key, 0, $iv);

        if ($decrypted === false) {
            throw new AnEncrypterException('Could not decrypt the data.');
        }

        return unserialize($decrypted);
    }
350323
public function decode($value)
    {
        $json = parent::decode($value);

        $values = json_decode($json, true);

        $this->handleJsonError('Failed to decode group values from JSON');

        return $values;
    }
966412
public function getRuleResultsByGroup($group)
    {
        $results = [];
        foreach ($this->getRuleResults() as $rule => $ruleResult) {
            if (in_array($group, $ruleResult->getGroups())) {
                $results[$rule] = $ruleResult;
            }
        }

        return $results;
    }
1333445
public function getGroupField($group = 'all')
    {
        $toExclude = array();
        $toAdd = array();
        if (strpos($group, ',') !== false) {
            foreach (explode(',', $group) as $g) {
                if ($g[0] === '-') {
                    $toExclude[] = substr($g, 1);
                } else {
                    $toAdd[] = $g;
                }
            }
        } else {
            $toAdd = array($group);
        }

        $fields = array();
        foreach ($this->elements as $el) {
            if (!($el instanceof $this->field_class)) {
                continue;
            }
            $elGroup = $el->group();
            if (!in_array($elGroup, $toExclude)
                && (
                    in_array('all', $toAdd)
                    || in_array($elGroup, $toAdd)
                )
            ) {
                $fields[] = $el->short_name;
            }
        }

        return $fields;
    }
1042662
public function load($environment, $group, $namespace = null)
    {
        $result = array();

        $db = Database::getActiveConnection();
        $query = $db->createQueryBuilder();

        $query
            ->select('configValue', 'configItem')
            ->from('Config', 'c')
            ->where('configGroup = ?')
            ->setParameter(0, $group);

        if ($namespace) {
            $query->andWhere('configNamespace = ?')->setParameter(1, $namespace);
        } else {
            $query->andWhere('configNamespace = ? OR configNamespace IS NULL')->setParameter(1, '');
        }

        $results = $query->execute();

        while ($row = $results->fetch()) {
            array_set($result, $row['configItem'], $row['configValue']);
        }

        return $result;
    }
1097248
protected function defaultLoad($environment, $group, $namespace = null)
    {
        $items = [];

        // First we'll get the root configuration path for the environment which is
        // where all of the configuration files live for that namespace, as well
        // as any environment folders with their specific configuration items.
        $path = $this->getPath($namespace);

        if ($path === null) {
            return $items;
        }

        // First we'll get the main configuration file for the groups. Once we have
        // that we can check for any environment specific files, which will get
        // merged on top of the main arrays to make the environments cascade.
        $file = "{$path}/{$group}.php";

        if ($this->files->exists($file)) {
            $items = $this->getRequire($file);
        }

        // Finally we're ready to check for the environment specific configuration
        // file which will be merged on top of the main arrays so that they get
        // precedence over them if we are currently in an environments setup.
        $file = "{$path}/{$environment}/{$group}.php";

        if ($this->files->exists($file)) {
            $items = $this->mergeEnvironment($items, $file);
        }

        return $items;
    }
692562
public function decrypt($decrypt, $key)
    {
        $inputParams = [
            'encrypt' => $decrypt,
            'key'     => $key,
        ];
        $this->debug->info(__FUNCTION__, 'Input Params: ' . json_encode($inputParams));
        $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_RAND);
        $this->debug->debug(__FUNCTION__, 'IV Key: ' . json_encode($iv));
        $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, pack("H*", $key), base64_decode($decrypt), MCRYPT_MODE_ECB, $iv);
        $this->debug->info(__FUNCTION__, 'decrypt Result: ' . json_encode($decrypted));

        return $decrypted;
    }
1220778
protected function loadDataForGroup($group, $includeemptykeys = false) {
		// load strings to cache
		$file_path = $this->getGroupFile($group);
		
		if (!file_exists($file_path)) {	
			// translation file not found
			return null;
		}
		
		$lines = @file_get_contents($file_path);
		
		if ($lines == '') {
			return null;
		}
		
		$lines = preg_split('!\\r?\\n!', $lines);
		$lines = array_map('trim', $lines);
		
		$data = array();
		
		foreach($lines as $line) {
			if (strpos($line,'#') !== false) {
				// remove everything after #
				$line = substr($line,0,strpos($line,'#'));
			}
			list($k, $value) = explode('=', $line, 2);
			$k = trim($k);
			$value = trim($value);
			
			if (strpos($k,'#') === 0 || $k == '' || $value == '' && !$includeemptykeys) {
				// comment or empty line
				continue;
			}
			
			$data[$k] = $value;
		}
		
		return $data;
	}
287722
public function load($group)
    {
        $confg = $this->hasConfigFile($group) ? $this->getConfigFilename($group) : array();
        return ServiceBuilder::factory($confg);
    }
671239
public function clearGroup($group)
    {
        $success = false;
        wincache_ucache_inc($this->_config['prefix'] . $group, 1, $success);

        return $success;
    }
766855
public function clean($group = null)
	{
		$prefix = $this->options['hash'] . '-cache-' . $group . '-';

		foreach ($this->data as $key => $value)
		{
			if (substr($key, 0, strlen($prefix)) == $prefix)
			{
				unset($this->data[$key]);
			}
		}

		return true;
	}
142688
public static function getAllClientSessions($group = null)
    {
        $gateway_data = GatewayProtocol::$empty;
        if (!$group) {
            $gateway_data['cmd'] = GatewayProtocol::CMD_GET_ALL_CLIENT_INFO;
        } else {
            $gateway_data['cmd']      = GatewayProtocol::CMD_GET_CLINET_INFO_BY_GROUP;
            $gateway_data['ext_data'] = $group;
        }
        $status_data      = array();
        $all_buffer_array = self::getBufferFromAllGateway($gateway_data);
        foreach ($all_buffer_array as $local_ip => $buffer_array) {
            foreach ($buffer_array as $local_port => $data) {
                if ($data) {
                    foreach ($data as $connection_id => $session_buffer) {
                        $client_id = Context::addressToClientId($local_ip, $local_port, $connection_id);
                        if ($client_id === Context::$client_id) {
                            $status_data[$client_id] = (array)$_SESSION;
                        } else {
                            $status_data[$client_id] = $session_buffer ? Context::sessionDecode($session_buffer) : array();
                        }
                    }
                }
            }
        }
        return $status_data;
    }
1038383
public function getProductionFingerprint($group)
    {
        return isset($this->fingerprints[$group]) ? $this->fingerprints[$group] : null;
    }