Pretty print profile data

@param array $data

@return string
348932
private static function pretty(array $data) {

        $color = new Color();
        $output = $color->getColoredString(self::VERBOSE_TITLE, 'blue', 'light-gray').PHP_EOL;

        foreach($data as $key => $value) {
            if(is_array($value) === false) {
                $output .= $color->getColoredString(sprintf(self::VERBOSE_ROW, $key, $value), 'dark_gray').PHP_EOL;
            }
            else {
                $output .= $color->getColoredString(sprintf(self::VERBOSE_ROW, $key, ''), 'dark_gray').PHP_EOL;
                foreach($value as $line => $string) {
                    $output .= $color->getColoredString(sprintf("\t".self::VERBOSE_ROW, '', $string), 'dark_gray').PHP_EOL;
                }
            }
        }
        $output .= $color->getColoredString('-----------------', 'blue', 'light-gray').PHP_EOL;

        return $output;
    }
566533
protected function _serialize($data)
	{
		if (is_array($data))
		{
			foreach ($data as $key => $val)
			{
				if (is_string($val))
				{
					$data[$key] = str_replace('\\', '{{slash}}', $val);
				}
			}
		}
		else
		{
			if (is_string($data))
			{
				$data = str_replace('\\', '{{slash}}', $data);
			}
		}

		return serialize($data);
	}
415370
public function table(array $data)
    {
        $columns = array();

        foreach ($data as $rkey => $row) {
            foreach ($row as $ckey => $cell) {
                $length = strlen($cell);
                if (empty($columns[$ckey]) || $columns[$ckey] < $length) {
                    $columns[$ckey] = $length;
                }
            }
        }

        $table = '';

        foreach ($data as $rkey => $row) {
            foreach ($row as $ckey => $cell) {
                $table .= str_pad($cell, $columns[$ckey]) . '   ';
            }
            $table .= PHP_EOL;
        }

        $this->line($table);
    }
855328
private function filterData(array $data)
    {
        $pattern = '/^' . str_replace('%', '.*', trim($this->likeExpr, "'")) . '$/';
        $newData = [];

        foreach ($data as $row) {
            if (preg_match($pattern, $row['Name'])) {
                $newData[] = $row;
            }
        }

        return $newData;
    }
122483
public static function xss_clean(array $data)
    {
        foreach ($data as $k => $v) {
            $data[$k] = filter_var($v, FILTER_SANITIZE_STRING);
        }

        return $data;
    }
690168
protected function outputOne($data)
    {
        if (is_object($data)) {
            $data = $data->get();
        }
        if ($data['_id']) {
            $data = array('id' => (string) $data['_id']) + $data;
        }
        unset($data['_id']);

        foreach ($data as $key => $val) {
            if ($val instanceof MongoID) {
                $data[$key] = (string) $val;
            }
        }

        return $data;
    }
1343623
public function generate(array $data): string
    {
        /** @var RecordFinder $recordFinder */
        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);
        $beGroupUids = $recordFinder->findUidsOfDemoBeGroups();
        $beUserUids = $recordFinder->findUidsOfDemoBeUsers();
        $result = [];
        foreach ($beGroupUids as $uid) {
            $result[] = 'be_groups_' . $uid;
        }
        foreach ($beUserUids as $uid) {
            $result[] = 'be_users_' . $uid;
        }
        return implode(',', $result);
    }
950957
public function write_setting($data) {
        if(!is_array($data)) {
            return ''; // ignore it
        }

        $result = '';
        foreach ($data as $roleid => $data) {
            if (!$this->config_write('contexts_role'.$roleid, trim($data['contexts']))) {
                $return = get_string('errorsetting', 'admin');
            }
            if (!$this->config_write('memberattribute_role'.$roleid, core_text::strtolower(trim($data['memberattribute'])))) {
                $return = get_string('errorsetting', 'admin');
            }
        }
        return $result;
    }
1008340
public function output_payload($data)
    {
        $payload = array(
            'status' => 'success',
            'version' => $this->version,
            'data' => $data,
            'runtime' => round(microtime(true) - $this->runtime, 3)
        );

        // Output the data in the desired format.
        switch ($this->format) {
            case 'xml':
                return output_pretty_xml($payload);
            case 'json':
                return output_pretty_json($payload);
            case 'jsonp':
                return output_pretty_jsonp($payload, $this->callback);
            case 'php':
                return output_pretty_php($payload);
        }

        return false;
    }
1280463
public function mapUser(array $data)
    {
        $user = new User();
        $user->id = $data['contentobject_id'];
        $user->login = $data['login'];
        $user->email = $data['email'];
        $user->passwordHash = $data['password_hash'];
        $user->hashAlgorithm = (int)$data['password_hash_type'];
        $user->isEnabled = (bool)$data['is_enabled'];
        $user->maxLogin = $data['max_login'];

        return $user;
    }
1320070
public static function toString($data)
    {
        if (is_array($data)) {
            $newData = [];
            foreach ($data as $key => $val) {
                $key = (string)$key;
                $newData[$key] = static::toString($val);
            }
        } else {
            $newData = (string)$data;
        }

        return $newData;
    }
317438
private function getHeaderPrefix(array $data)
    {
        if ($this->first && $this->csvFormat->hasHeaderRow()) {
            $this->first = false;
            $postHeaderPad = $this->csvFormat->getDataStart() - $this->csvFormat->getHeaderRow();
            return $this->format(array_keys($data)) . str_repeat($this->getRowSeparator(), $postHeaderPad);
        }
        return '';
    }
238174
protected function _cleanupData(array $data = array())
    {
        $clean = array();

        foreach ($data as $key => $value)
        {
            if (!empty($value)) {
                $clean[$key] = $value;
            }
        }

        return $clean;
    }
445798
static public function addslashes($data)
	{
	    if(!is_array($data)) return addslashes($data);
	    
	    foreach($data as $key => $val) {
	        $data[$key] = static::addslashes($val);
	    }
	    
	    return $data;
	}
1117827
public function renderRawData($data = '')
    {
        $layoutPath = null;
        if ($this->layout && (!$layoutPath = $this->getLayoutFile((new KernelInjector)->build()->getAppDir(),
                $this->module))
        ) {
            (new LoggerInjector)->build()->send('error', 'Layout `'.$this->layout.'` not found');
        }

        if ($layoutPath) {
            $data = $this->insertStyleScripts($this->renderFile($layoutPath, ['content' => $data]));
        }

        return $data;
    }
999218
function(data) {
    data = data.replace(/{% highlight ([^ ]*) %}/g, '<pre class="prettyprint lang-$1">');
    data = data.replace(/{% endhighlight %}/g, '</pre>');
    return data;
  }
166208
public function normalizeFormData(array $data)
    {
        if (empty($data)) {
            return $data;
        }

        $renameMap = array_flip($this->renamemap);

        foreach ($renameMap as $customName => $defaultName) {
            if (array_key_exists($customName, $data)) {
                $value = $data[$customName];
                unset($data[$customName]);
                $data[$defaultName] = $value;
            }
        }

        return $data;
    }