format_calculations

@return \stdClass[]
767237
private function format_calculations() {

        $calculations = json_decode($this->prediction->calculations, true);

        foreach ($calculations as $featurename => $value) {

            list($indicatorclass, $subtype) = $this->parse_feature_name($featurename);

            if ($indicatorclass === 'range') {
                // Time range indicators don't belong to any indicator class, we don't store them.
                continue;
            } else if (!\core_analytics\manager::is_valid($indicatorclass, '\core_analytics\local\indicator\base')) {
                throw new \moodle_exception('errorpredictionformat', 'analytics');
            }

            $this->calculations[$featurename] = new \stdClass();
            $this->calculations[$featurename]->subtype = $subtype;
            $this->calculations[$featurename]->indicator = \core_analytics\manager::get_indicator($indicatorclass);
            $this->calculations[$featurename]->value = $value;
        }
    }
815975
protected function getFormatter()
    {
        $formatter = new \NumberFormatter($this->locale, \NumberFormatter::DECIMAL);
        $precision = $this->field->getOption('precision', 0);

        if ($precision) {
            $formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $precision);
        }

        return $formatter;
    }
215914
public function totals()
    {
        setlocale(LC_MONETARY, config('cart_manager.LC_MONETARY'));

        $totals = ['Subtotal' => money_format('%n', $this->subtotal)];

        if ($this->discount > 0) {
            $totals['Discount'] = money_format('%n', $this->discount);
        }

        if ($this->shippingCharges > 0) {
            $totals['Shipping charges'] = money_format('%n', $this->shippingCharges);
        }

        if ($this->subtotal != $this->netTotal) {
            $totals['Net total'] = money_format('%n', $this->netTotal);
        }

        $totals['Tax'] = money_format('%n', $this->tax);

        if ($this->roundOff != 0) {
            $totals['Total'] = money_format('%n', $this->total);
            $totals['Round off'] = money_format('%n', $this->roundOff);
        }

        $totals['Payable'] = money_format('%n', $this->payable);

        return $totals;
    }
862697
public function total() : array
    {
        $stats = $this->generate();

        return [
            'Total',
            $stats->sum('number_of_classes'),
            $stats->sum('methods'),
            round($stats->avg('methods_per_class'), 2),
            $stats->sum('lines'),
            $stats->sum('loc'),
            round($stats->avg('loc_per_method'), 2),
        ];
    }
1167545
protected function prepareOrderComponentsCheckout($calculated)
    {
        $component_types = $this->order->getComponentTypes();

        $components = array();
        foreach ($calculated['components'] as $type => $component) {

            $components[$type] = array(
                'price' => $component['price'],
                'price_decimal' => $this->price->decimal($component['price'], $calculated['currency']),
                'price_formatted' => $this->price->format($component['price'], $calculated['currency'])
            );

            if (empty($component['rule'])) {
                $components[$type]['name'] = $component_types[$type];
                continue;
            }

            $components[$type]['rule'] = $component['rule'];
            $components[$type]['name'] = $component['rule']['name'];
        }

        return $components;
    }
736721
protected static function convert_fields(stdClass $data) {
        $class = static::$persistentclass;
        $properties = $class::get_formatted_properties();

        foreach ($data as $field => $value) {
            // Replace formatted properties.
            if (isset($properties[$field])) {
                $formatfield = $properties[$field];
                $data->$formatfield = $data->{$field}['format'];
                $data->$field = $data->{$field}['text'];
            }
        }

        return $data;
    }
327885
public function getCompositionRules()
    {
        $subExpressions = array();
        foreach ($this->components as $irp) {
        	$subExpressions[] = new CommonExpression('variable', array('identifier' => $irp->getOutcome()->getIdentifier()));
        }
        $sum = new CommonExpression('sum', array());
        $sum->setSubExpressions($subExpressions);
        $summationRule = new SetOutcomeVariable($this->outcomeIdentifier, $sum);
        
        $returnValue = array($summationRule);

        return (array) $returnValue;
    }
374984
public function determine_format() {
        $decimals = $this->item->get_decimals();

        $min = format_float($this->item->grademin, $decimals);
        $max = format_float($this->item->grademax, $decimals);

        return new empty_element("$min - $max");
    }
33078
public function getFormatter()
    {
        if ($this->formatterInstance === null) {
            $this->formatterInstance = Yii::createObject(
                [
                    'class' => '\yii\i18n\Formatter',
                    'decimalSeparator' => $this->decimal_separator,
                    'thousandSeparator' => $this->thousand_separator,
                    'numberFormatterOptions' => [
                        \NumberFormatter::MIN_FRACTION_DIGITS => $this->min_fraction_digits,
                        \NumberFormatter::MAX_FRACTION_DIGITS => $this->max_fraction_digits,
                    ]
                ]
            );
        }
        return $this->formatterInstance;
    }
407000
public function getArray()
    {
        return [$this->r, $this->g, $this->b, round(1 - $this->a / 127, 2)];
    }
588486
public static function STDEVP()
    {
        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());

        $returnValue = null;

        $aMean = self::AVERAGE($aArgs);
        if (!is_null($aMean)) {
            $aCount = 0;
            foreach ($aArgs as $k => $arg) {
                if ((is_bool($arg)) &&
                    ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
                    $arg = (integer) $arg;
                }
                // Is it a numeric value?
                if ((is_numeric($arg)) && (!is_string($arg))) {
                    if (is_null($returnValue)) {
                        $returnValue = pow(($arg - $aMean), 2);
                    } else {
                        $returnValue += pow(($arg - $aMean), 2);
                    }
                    ++$aCount;
                }
            }

            if (($aCount > 0) && ($returnValue >= 0)) {
                return sqrt($returnValue / $aCount);
            }
        }
        return PHPExcel_Calculation_Functions::DIV0();
    }
406219
public static function getAllParametersObj(): stdClass
    {
        $values = new stdClass();

        foreach (static::getAllParameters() as $name => $value) {
            $values->$name = $value;
        }

        return $values;
    }
875011
public function getFormatters(): ArrayObject
    {
        $arr = new ArrayObject();
        foreach ($this->columns as $key => $column) {
            if (($formatter = $column->getFormatter()) !== null) {
                $arr->offsetSet($key, $formatter);
            }
        }

        return $arr;
    }
1113000
private static function constants(): array
    {
        $class = get_called_class();

        if (isset(self::$constants[$class])) {
            return self::$constants[$class];
        }

        $reflection = new \ReflectionClass($class);

        return self::$constants[$class] = $reflection->getConstants();
    }
912998
public function listFunctions() {
		// Return value
		$returnValue = array();
		// Loop functions
		foreach(self::$_PHPExcelFunctions as $functionName => $function) {
			if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
				$returnValue[$functionName] = new PHPExcel_Calculation_Function($function['category'],
																				$functionName,
																				$function['functionCall']
																			   );
			}
		}

		// Return
		return $returnValue;
	}
76439
public function format()
    {
        if ($this->groupEvent) {
            // ugly fix for misunderstanding of this...
            $this->version = 2;
        }

        $result = [
            'Url' => $this->url,
            'EventType' => $this->eventType,
            'IsBackup'  => $this->isBackup,
            'Status'    => $this->status,
            'Version'   => $this->version
        ];

        if($this->apikeyId){
            $result['APIKeyID'] = $this->apikeyId;
        }

        return $result;
    }
78271
public function toArray()
    {
        return [$this->currency => [
            'name'                => $this->name,
            'code'                => $this->code,
            'precision'           => $this->precision,
            'subunit'             => $this->subunit,
            'symbol'              => $this->symbol,
            'symbol_first'        => $this->symbolFirst,
            'decimal_mark'        => $this->decimalMark,
            'thousands_separator' => $this->thousandsSeparator,
            'prefix'              => $this->getPrefix(),
            'suffix'              => $this->getSuffix(),
        ]];
    }