@param $params
@param $cache_dir

data for the client stats for a single campaign

@return array
970693
public function getCampaignClientTabData($params, $cache_dir = __DIR__)
    {
        $results = [];
        $query   = $this->getEntityManager()->getConnection()->createQueryBuilder()
            ->select(
                'ccs.contact_client_id as clientid,
                cc.name as clientname, 
                ccs.utm_source as utm_source,
                SUM(ccs.received) as received,
                SUM(ccs.declined) as declined,
                SUM(ccs.converted) as converted,
                SUM(ccs.revenue) as revenue,
                SUM(ccs.cost) as cost'
            )
            ->from(MAUTIC_TABLE_PREFIX.'contact_ledger_campaign_client_stats', 'ccs')
            ->leftJoin('ccs', MAUTIC_TABLE_PREFIX.'contactclient', 'cc', 'cc.id = ccs.contact_client_id')
            ->where('ccs.date_added BETWEEN :dateFrom AND :dateTo')
            ->andWhere('ccs.campaign_id =  :campaignId')
            ->groupBy('ccs.contact_client_id', 'ccs.utm_source')
            ->orderBy('cc.name', 'ASC');

        $query
            ->setParameter('dateFrom', $params['dateFrom'])
            ->setParameter('dateTo', $params['dateTo'])
            ->setParameter('campaignId', $params['campaignId']);

        $financials = $query->execute()->fetchAll();
        foreach ($financials as $financial) {
            $financial['gross_income'] = $financial['revenue'] - $financial['cost'];

            if ($financial['gross_income'] > 0) {
                $financial['gross_margin'] = 100 * $financial['gross_income'] / $financial['revenue'];
                $financial['ecpm']         = number_format($financial['gross_income'] / 1000, 4, '.', ',');
                $financial['rpu']          = number_format($financial['revenue'] / $financial['received'], 4, '.', ',');
            } else {
                $financial['gross_margin'] = 0;
                $financial['ecpm']         = 0;
                $financial['rpu']          = 0;
            }

            $result   = [$financial['clientid']];
            $result[] = empty($financial['clientname']) ? '-' : $financial['clientname'];
            $result[] = empty($financial['utm_source']) ? '-' : $financial['utm_source'];

            $result[] = $financial['received'];
            $result[] = $financial['declined'];
            $result[] = $financial['converted'];
            $result[] = number_format($financial['revenue'], 2, '.', ',');
            $result[] = $financial['ecpm'];
            $result[] = $financial['rpu'];

            $results['rows'][] = $result;
        }

        return $results;
    }
899900
public function getParams(): array
    {
        $params = [
            'callback_query_id' => $this->callbackQueryId,
        ];

        $params = array_merge($params, $this->buildJsonAttributes([
            'show_alert' => $this->showAlert,
            'cache_time' => $this->cacheTime
        ]));

        return $params;
    }
263299
protected function formatCache($cached)
    {
        $themes = is_array($cached) ? $cached : json_decode($cached, true);

        $results = [];

        foreach ($themes as $theme) {
            $results[] = new Theme($theme);
        }

        return $results;
    }
692913
def getparams(self, result):
        """"""

        for key in self._cache:
            if self._cache[key][2] == result:
                args, kwargs, _ = self._cache[key]
                return args, kwargs

        else:
            raise ValueError('Result is not cached')
580417
private function getCampaignClientStatsData($params)
    {
        /** @var LedgerEntryRepository $repo */
        $repo     = $this->em->getRepository(\MauticPlugin\MauticContactLedgerBundle\Entity\LedgerEntry::class);
        $statData = $repo->getCampaignClientStatsData($params, $params['cacheDir'], false);

        return $statData;
    }
387832
public function warmUp($cacheDir)
    {
        $cacheDir = $this->container->getParameter('orkestra.pdf.cache_dir');

        if (!is_dir($cacheDir)) {
            if (!mkdir($cacheDir, 0777, true)) {
                throw new \RuntimeException(sprintf(
                    'Could not create PDF cache directory "%s"',
                    $cacheDir
                ));
            }
        }
    }
569850
protected function _getClientParams( array $params, array $prefixes = array( 'f', 'l', 'd', 'a' ) )
	{
		$list = array();

		foreach( $params as $key => $value )
		{
			if( in_array( $key[0], $prefixes ) && $key[1] === '-' ) {
				$list[$key] = $value;
			}
		}

		return $list;
	}
1278944
public function touchParserCaches(array $file_names, $min_time)
    {
        $cache_directory = Config::getInstance()->getCacheDirectory();

        if (!$cache_directory) {
            return;
        }

        $cache_directory .= DIRECTORY_SEPARATOR . self::PARSER_CACHE_DIRECTORY;

        if (is_dir($cache_directory)) {
            foreach ($file_names as $file_name) {
                $hash_file_name = $cache_directory . DIRECTORY_SEPARATOR . $this->getParserCacheKey($file_name);

                if (file_exists($hash_file_name)) {
                    if (filemtime($hash_file_name) < $min_time) {
                        touch($hash_file_name, $min_time);
                    }
                }
            }
        }
    }
555587
public function getCachedMethodParamUses()
    {
        $cache_directory = $this->config->getCacheDirectory();

        if (!$cache_directory) {
            return null;
        }

        $cache_location = $cache_directory . DIRECTORY_SEPARATOR . self::METHOD_PARAM_USE_CACHE_NAME;

        if (!is_readable($cache_location)) {
            return null;
        }

        $cache = unserialize((string) file_get_contents($cache_location));

        if (!is_array($cache)) {
            throw new \UnexpectedValueException('The method param use cache must be an array');
        }

        return $cache;
    }
657379
protected function parseUrlParams($url_params)
    {
        if ($url_params != '#' && (is_array($url_params) || (strpos($url_params, 'http') !== 0 && strpos($url_params, '/') !== 0))) {
            if (!is_array($url_params))
                $url_params = array($url_params);
            $url_to = Rails::application()->router()->urlFor($url_params, true);
        } else {
            $url_to = $url_params;
        }
        return $url_to;
    }
1130228
public function render($caching = false, $params = array())
	{
		$this->_caching = $caching;

		if (!empty($this->_template))
		{
			$data = $this->_renderTemplate();
		}
		else
		{
			$this->parse($params);
			$data = $this->_renderTemplate();
		}

		parent::render();
		return $data;
	}
790959
protected static function getParams(array $arg_params)
    {
        $return = array();
        //validate params
        $data = array(
            'amount',
            'transaction_id',
            'customer_id',
            'security_token',
            'customer_ip'
        );
        foreach ($data as $key) {
            if(!empty($arg_params[$key])){
                $return[$key] = $arg_params[$key];
            }
        }

        return $return;
    }
157377
protected static function getHttpClient($cacheDir)
	{
		if (!isset(self::$client) || self::$clientCacheDir !== $cacheDir)
		{
			self::$client = (isset($cacheDir)) ? Http::getCachingClient($cacheDir) : Http::getClient();
			self::$clientCacheDir = $cacheDir;
		}

		return self::$client;
	}
762891
public function list_commands($param = []){
    //Prepping, processing and validating the create user parameters
    $param = $this->process_parameters($param);
    //Setting the last action performed
    $this->last_action = "list-commands";

    //Defining  the $url_part and the command to be executed
    $url_part = "list-commands";
    if (isset($param['short'])){//short parameter is set
      $url_part .= "&short";
    }

    if (isset($param['nameonly'])){//nameonly parameter is set
      $url_part .= "&nameonly";
    }
    //Concatenating the closing single quote
    $url_part .="'";
    //Concatenating the header url and $url_part to create the full url to be executed
    $url_part = $this->get_header_url() . $url_part;

    //test
    $uid = $this->hostname;
    if ( !empty($param) ){
      $uid .= md5(json_encode($param));
    }

    if ( $this->cache_has($uid, 'list_commands') ){
      $result_call = $this->cache_get($uid, 'list_commands');
    }
    else {
      $result_call = $this->call_shell_exec($url_part);
      $this->cache_set($uid, 'list_commands', $result_call);
    }
    return $result_call;
  }
600204
private function getParameterValues(array $param, FedoraResource $res): array {
        $this->getParameters();

        $values = [];
        foreach ($param as $i) {
            $ii   = explode('|', substr($i, 1, -1));
            $name = array_shift($ii);

            if ($name === 'RES_URI') {
                $value = Parameter::value($res, '', $res->getUri(true), $ii);
            } else if ($name === 'RES_ID') {
                $value = Parameter::value($res, '', $res->getId(), $ii);
            } else if (isset($this->param[$name])) {
                $value = $this->param[$name]->getValue($res, $ii);
            } else {
                throw new RuntimeException('unknown parameter ' . $name);
            }
            $values[$i] = $value;
        }

        return $values;
    }
564591
@Override
    public String[] getCacheStatistics(String[] names) throws javax.management.AttributeNotFoundException {

        if (names == null)
            return null;

        DCache cache = null;
        if (ServerCache.servletCacheEnabled) {
            cache = ServerCache.cache;
        }
        String stats[] = null;
        if (cache != null) {
            Map statistics = getCacheStatisticsMap(cache.getCacheStatistics());
            stats = new String[names.length];
            for (int i = 0; i < names.length; i++) {

                if (!statistics.containsKey(names[i])) {
                    Tr.error(tc, "DYNA1052E", new Object[] { names[i] });
                    throw new AttributeNotFoundException(names[i] + " is not a valid cache statistic name");
                }

                stats[i] = names[i] + "=" + statistics.get(names[i]);
            }
        } else {
            stats = new String[0];
        }

        return stats;
    }
690212
public function getNoCache($sFilterValue, $sAdditionalParam = null) : array
    {
        if (empty($sFilterValue)) {
            return [];
        }

        $this->sValue = $sFilterValue;
        $this->sAdditionParam = $sAdditionalParam;

        $arElementIDList = $this->getIDListFromDB();

        return $arElementIDList;
    }