```php
$data = [
'Eggs' => '$1.99',
'Oatmeal' => '$4.99',
'Bacon' => '$2.99',
];
```

@param array  $data
@param string $title
@param array  $opts
769240
public static function show(array $data, string $title = '', array $opts = []): void
    {
        if (!$data) {
            return;
        }

        $string = $title ? ColorTag::wrap(\ucfirst($title), 'comment') . ":\n" : '';
        $opts   = \array_merge([
            'char'       => '.',
            'indent'     => '  ',
            'padding'    => 10,
            'valueStyle' => 'info',
        ], $opts);

        $keyMaxLen  = Helper::getKeyMaxWidth($data);
        $paddingLen = $keyMaxLen > $opts['padding'] ? $keyMaxLen : $opts['padding'];

        foreach ($data as $label => $value) {
            $value  = ColorTag::wrap((string)$value, $opts['valueStyle']);
            $string .= $opts['indent'] . \str_pad($label, $paddingLen, $opts['char']) . " $value\n";
        }

        Console::write(\trim($string));
    }
1344279
public function addOne($title, $url, array $data = [])
    {
        return $this->addBreadcrumb(
            BreadcrumbItem::make($title, $url, $data)
        );
    }
970118
private function parseCliOptions(array $opts = [])
    {
        $cliOpts = getopt('chvrs:', [
            'help',
            'version',
            'random',
            'suite:',
            'coverage',
        ]);

        if (isset($cliOpts['help']) || isset($cliOpts['h'])) {
            $this->runner->output->help();
            exit;
        }

        if (isset($cliOpts['version']) || isset($cliOpts['v'])) {
            $this->runner->output->version();
            exit;
        }

        if (isset($cliOpts['random']) || isset($cliOpts['r'])) {
            $opts['random'] = true;
        }

        if (isset($cliOpts['suite']) || isset($cliOpts['s'])) {
            $opts['suite'] = $cliOpts['suite'] ?: $cliOpts['s'];
        }

        if (isset($cliOpts['coverage']) || isset($cliOpts['c'])) {
            $opts['coverage']['enable'] = true;
        }

        return $opts;
    }
1374939
public function select_option($values, $selected_value) {
		$content = '';

		foreach ($values as $value => $title) {
			if (is_array($title)) {
				$label		= $this->_escape($value);
				$content	.= "<optgroup label=\"{$label}\">";
				$content	.= $this->select_option($title, $selected_value);
				$content	.= "</optgroup>";
			} else {
				$value		= $this->_escape($value);
				$title		= $this->_escape($title);

				$selected = '';
				if (is_scalar($selected_value) && $value == $selected_value) {
					$selected = ' selected="selected"';
				} elseif (is_array($selected_value) && in_array($value, $selected_value)) {
					$selected = ' selected="selected"';
				}

				$content	.= "<option value=\"{$value}\"{$selected}>{$title}</option>";
			}
		}

		return $content;
	}
1128835
public static function panel($data, string $title = 'Information Panel', array $opts = []): int
    {
        return Panel::show($data, $title, $opts);
    }
138994
protected function setOpt(array &$opts, $mapperString, $val)
    {
        $args = explode( '.', $mapperString );
        array_push( $args, $val );
        $this->setNestedOptVal( $opts, $args ); 
    }
351508
protected function _setTitleAttr($title, array $options = [])
    {
        if (!Arr::key('title', $options)) {
            $options['title'] = strip_tags($title);
        }

        return $options;
    }
928646
public function populate($data = array())
    {
        if (isset($data['title']) && $data['title'] !== null) {
            $this->title = $data['title'];
        }
        if (isset($data['description']) && $data['description'] !== null) {
            $this->description = $data['description'];
        }
        if (isset($data['formjsonified']) && $data['formjsonified'] !== null) {
            $this->formjsonified = $data['formjsonified'];
        }
        if (isset($data['formtemplate']) && $data['formtemplate'] !== null) {
            $this->formtemplate = $data['formtemplate'];
        }
        if (isset($data['active']) && $data['active'] !== null) {
            $this->active = $data['active'];
        }
    }
1153724
public static function read($message = null, bool $nl = false, array $opts = []): string
    {
        if ($message) {
            self::write($message, $nl);
        }

        $opts = \array_merge([
            'length' => 1024,
            'stream' => \STDIN,
        ], $opts);

        return \file_get_contents($opts['stream'], $opts['length']);
    }
1228182
public static function json($data = array(), $status = 200, array $headers = array(), $options = 0)
  {
    $etagMatch     = false;
    $headersToExpose = array();

    if (array_key_exists('ETag', $headers)) {
      $headersToExpose[] = 'ETag';

      // Empty the data if If-None-Match header match with ETag value
      $requestEtags = IlluminateRequest::getETags();

      if ( ! empty($requestEtags)) {
        foreach ($requestEtags as $etag) {
          if ($headers['ETag'] == $etag) {
            $etagMatch = true;
            $data    = array();

            break;
          }
        }
      }

      unset($requestEtags);
    }

    if (array_key_exists('Link', $headers)) {
      $headersToExpose[] = 'Link';
    }

    if (array_key_exists('X-Rate-Limit-Limit', $headers)) {
      $headersToExpose[] = 'X-Rate-Limit-Limit';
    }

    if (array_key_exists('X-Rate-Limit-Remaining', $headers)) {
      $headersToExpose[] = 'X-Rate-Limit-Remaining';
    }

    if (array_key_exists('X-Rate-Limit-Reset', $headers)) {
      $headersToExpose[] = 'X-Rate-Limit-Reset';
    }

    $headers['Access-Control-Expose-Headers'] = implode(', ', $headersToExpose);

    if ($etagMatch) {
      $response = parent::make('', 304, $headers);
    } else {
      $response = parent::json($data, $status, $headers);
    }

    $response->setCharset('utf-8');

    if (array_key_exists('ETag', $headers)) {
      $response->setCache(array(
        'etag' => $headers['ETag']
      ));
    }

    return $response;
  }
99622
public function read(array $opts) {
        return array_merge_recursive(parent::read($opts), [
            'verb' => $this->readScormVerb($opts),
            'result' => [
                'score' => [
                    'raw' => $opts['scorm_score_raw'],
                    'min' => $opts['scorm_score_min'],
                    'max' => $opts['scorm_score_max'],
                    'scaled' => $opts['scorm_score_scaled']
                ],
            ],
        ]);
    }
951818
public function read(array $opts) {
        $instructor = parent::read($opts)['actor'];
        $statement =  array_merge_recursive(parent::read($opts), [
            'verb' => [
                'id' => 'http://adlnet.gov/expapi/verbs/scored',
                'display' => $this->readVerbDisplay($opts),
            ],
            'result' => [
                'score' => [
                    'raw' => $opts['grade_score_raw'],
                    'min' => $opts['grade_score_min'],
                    'max' => $opts['grade_score_max'],
                    'scaled' => $opts['grade_score_scaled']
                ],
                'completion' => $opts['grade_completed'],
                'response' => $opts['grade_comment']
            ],
            'object' => $this->readModule($opts),
            'context' => [
                'contextActivities' => [
                    'parent' => [
                        $this->readCourse($opts),
                    ],
                ],
                'instructor' => $instructor
            ],
        ]);

        //Excluded from array merge to make sure that the actor is overwritten e.g. if a different IFI is used. 
        $statement['actor'] = [
            'objectType' => 'Agent',
            'name' => $opts['graded_user_name'],
            'account' => [
                'homePage' => $opts['graded_user_url'],
                'name' => $opts['graded_user_id'],
            ],
        ];

        if (!is_null($opts['grade_success'])) {
            $statement['result']['success'] = $opts['grade_success'];
        }

        return $statement;
    }
1045775
public static function create($params, $opts = null)
    {
        $type = Util\Util::classType($params['type']);
        $url = self::classUrl() . "/$type";
        list($resp, $usedOpts) = self::request(self::METHOD_POST, $url, $params, $opts);
        return Util\Util::arrayToObject($resp, $usedOpts);
    }
1216044
private static function set_header_into_opt($header, $value, &$opt) {
		if (isset ( $opt [self::HEADERS] )) {
			if (! is_array ( $opt [self::HEADERS] )) {
				trigger_error ( 'Invalid $opt[\'headers\'], please check.' );
				throw new BCS_Exception ( 'Invalid $opt[\'headers\'], please check.', - 1 );
			}
		} else {
			$opt [self::HEADERS] = array ();
		}
		$opt [self::HEADERS] [$header] = $value;
	}
195696
public function read(array $opts) {
        if(isset($opts['attempt']->timefinish)){
            $seconds = $opts['attempt']->timefinish - $opts['attempt']->timestart;
            $duration = "PT".(string) $seconds."S";
        }
        else{
            $duration = "PT0S";
        }

        $scoreRaw = isset($opts['attempt']->sumgrades) ? $opts['attempt']->sumgrades : 0;
        $scoreMin = (float) ($opts['grade_items']->grademin ?: 0);
        $scoreMax = (float) ($opts['grade_items']->grademax ?: 0);
        $scorePass = (float) ($opts['grade_items']->gradepass ?: null);
        $success = false;
        // If there is no passing score then success is unknown.
        if ($scorePass == null) {
            $success = null;
        }
        elseif ($scoreRaw >= $scorePass) {
            $success = true;
        }

        // It's possible to configure Moodle quizzes such that you can score higher than the maximum grade. 
        // This is not allowed by xAPI, so cap the raw at the min/max. 
        if ($scoreRaw > $scoreMax) {
            $scoreRaw = $scoreMax;
        }
        if ($scoreRaw < $scoreMin) {
            $scoreRaw = $scoreMin;
        }

        // Calculate scaled score as the distance from zero towards the max (or min for negative scores).
        if ($scoreRaw >= 0) {
            $scoreScaled = $scoreRaw / $scoreMax;
        }
        else {
            $scoreScaled = $scoreRaw / $scoreMin;
        }

        //Determine if the attempt was marked finished
        if(isset($opts['attempt']->state)){
            $completedState = $opts['attempt']->state === 'finished';
        }
        else{
            $completedState = false;
        }

        return [array_merge(parent::read($opts)[0], [
            'recipe' => 'attempt_completed',
            'attempt_score_raw' => $scoreRaw,
            'attempt_score_min' => $scoreMin,
            'attempt_score_max' => $scoreMax,
            'attempt_score_scaled' => $scoreScaled,
            'attempt_success' => $success,
            'attempt_completed' => $completedState,
            'attempt_duration' => $duration,
        ])];
    }
675347
private function getFillOpts($opts)
	{
		$this->debug->group(__CLASS__.'->'.__FUNCTION__);
		$arrayUtil = new ArrayUtil();
		$opts = $arrayUtil->mergeDeep(array(
			'output_file'	=> 'temporary',	// if null is passed, raw pdf will be returned
			'fillcolor'		=> null,		// font-color
			'checkbox_opts'	=> array(
				'fontname'		=> 'ZapfDingbats',
				'textformat'	=> 'utf16be',
				'encoding'		=> 'unicode',
				'position'		=> 'center',
				'bordercolor'	=> '#C0C0C0',	// or null
				// 'fontsize'	=> 12,
			),
			'checkbox_value'	=> "\x27\x18",
			'radio_opts'	=> array(
				'fontname'		=> 'ZapfDingbats',
				'textformat'	=> 'utf16be',
				'encoding'		=> 'unicode',
				'position'		=> 'center',
				'bordercolor'	=> '#C0C0C0',	// or null
				// 'fontsize'	=> 12,
			),
			'radio_value'	=> "\x25\xCF",
			'text_opts'		=> array(
				'bordercolor'	=> 'none',
			),
			'name_trans_func'	=> array(),			// function and parameters to transform block name
			'info' => array(),
		), $opts);
		if ($opts['output_file'] == 'temporary') {
			$temp_dir = sys_get_temp_dir();
			$opts['output_file'] = tempnam($temp_dir, 'pdf');
		}
		$this->debug->groupEnd();
		return $opts;
	}
727852
function _Options($opts)
	{
		if (!is_array($opts)) return array();
		$newopts = array();
		foreach($opts as $k => $v) {
			if (is_numeric($k)) $newopts[strtoupper($v)] = $v;
			else $newopts[strtoupper($k)] = $v;
		}
		return $newopts;
	}