Generates an assoc-array version of this Score. (Identical in shape to the JSON format of the API)

@return array
511845
public function toArray()
    {
        $array = [
            'address' => $this->address,
            'score' => $this->score,
            'seen' => $this->seen
        ];

        $flags = [];

        if ($this->flags) {
            foreach ($this->flags as $flag) {
                $flags[$flag->slug] = 1;
            }
        }

        if (count($flags)) {
            $array['flags'] = array_keys($flags);
        } else {
            $array['flags'] = [];
        }

        return $array;
    }
136682
public function toArray()
    {
        $json            = [];
        $json['jsonrpc'] = $this->jsonrpc;

        if ($this->method) {
            $json['method'] = $this->method;
        }

        $json['method'] = $this->method;

        if ($this->params) {
            $json['params'] = $this->params;
        }

        if ($this->id) {
            $json['id'] = $this->id;
        }

        return $json;
    }
50109
public function toArray(): array
    {
        if (!empty($this->warnings)) {
            $this->status = 'warning';
        } elseif (!empty($this->errors)) {
            $this->status = 'error';
        }

        return [
            'status' => $this->status,
            'errors' => array_merge(array_map(function($x) {
                return ['severity' => 'error', 'message' => $x];
            }, $this->errors), array_map(function($x) {
                return ['severity' => 'warning', 'message' => $x];
            }, $this->warnings)),
            'info' => $this->info
        ];
    }
1056279
public function toArray()
    {

        $attributes = [];

        foreach ($this->attributes as $name => $value) {
            $attributes[$name] = $this->getOriginalAttribute($name);
        }

        foreach ($this->appends as $name) {
            $attributes[$name] = $this->getAppendsAttribute($name);
        }

        return $attributes;
    }
1192003
public function toArray()
    {
        return [
            'required'      => $this->isRequired(),
            'hidden'        => $this->isHidden(),
            'persistent'    => $this->isPersistent(),
            'whenReplicate' => $this->getWhenReplicate()->toArray(),
            'whenPatch'     => $this->getWhenPatch()->toArray(),
        ];
    }
441089
public function toArray(): array
    {
        $result = [
            'size' => $this->size,
            'from' => $this->from,
        ];

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

        if ($this->source) {
            $result['_source'] = $this->source;
        }

        return [
            'top_hits' => $result,
        ];
    }
925276
public function _asStdArray()
    {
        if (
            property_exists($this, 'hidden') &&
            is_array($this->hidden)
        ) {
            $results = [];

            foreach ($this->_args as $key => $value) {
                if (! in_array($key, $this->hidden)) {
                    $results[$key] = $value;
                }
            }

            return $results;
        } else {
            return $this->_args;
        }
    }
280118
public function toJSON(){
        $outcomeValue = null;
        if($this->defaultValue != ''){
            $outcomeValue = Array($this->defaultValue);
        }else if($this->getAttributeValue('baseType') == 'integer' || $this->getAttributeValue('baseType') == 'float'){
            $outcomeValue = Array(0);
        }else{
            $outcomeValue = null;
        }

        $returnValue = taoQTI_models_classes_Matching_VariableFactory::createJSONVariableFromQTIData(
                        $this->getIdentifier()
                        , $this->getAttributeValue('cardinality')
                        , $this->getAttributeValue('baseType')
                        , $outcomeValue
        );

        return $returnValue;
    }
1237449
public function toArray()
    {
        $result = [];

        if (!empty($this->value)) {
            if (!empty($this->details)) {
                $parts = explode('.', $this->value);
                $result['value'] = join('.', array_slice($parts, 0, $this->details));
            } else {
                $result['value'] = $this->value;
            }
        }

        if (!empty($this->alias)) {
            $result['alias'] = $this->alias;
        }

        if (!empty($this->nickname)) {
            $result['nickname'] = $this->nickname;
        }

        if (isset($result['value']) && !isset($result['alias']) && !isset($result['nickname'])) {
            return $result['value'];
        }

        return $result;
    }
383169
public static function asArray()
    {
        return array(
            'DEF' => self::DEF,
            'RECT' => self::RECT,
            'CIRCLE' => self::CIRCLE,
            'POLY' => self::POLY,
            'ELLIPSE' => self::ELLIPSE
        );
    }
594770
public function get_assoc()
    {
        $out     = array('name' => $this->displayname);
        $typemap = $this->typemap;

        // copy name fields to output array
        foreach (array('firstname','surname','middlename','nickname','organization') as $col) {
            if (strlen($this->$col)) {
                $out[$col] = $this->$col;
            }
        }

        if ($this->raw['N'][0][3])
            $out['prefix'] = $this->raw['N'][0][3];
        if ($this->raw['N'][0][4])
            $out['suffix'] = $this->raw['N'][0][4];

        // convert from raw vcard data into associative data for Roundcube
        foreach (array_flip(self::$fieldmap) as $tag => $col) {
            foreach ((array)$this->raw[$tag] as $i => $raw) {
                if (is_array($raw)) {
                    $k       = -1;
                    $key     = $col;
                    $subtype = '';

                    if (!empty($raw['type'])) {
                        $combined = join(',', self::array_filter((array)$raw['type'], 'internet,pref', true));
                        $combined = strtoupper($combined);

                        if ($typemap[$combined]) {
                            $subtype = $typemap[$combined];
                        }
                        else if ($typemap[$raw['type'][++$k]]) {
                            $subtype = $typemap[$raw['type'][$k]];
                        }
                        else {
                            $subtype = strtolower($raw['type'][$k]);
                        }

                        while ($k < count($raw['type']) && ($subtype == 'internet' || $subtype == 'pref')) {
                            $subtype = $typemap[$raw['type'][++$k]] ?: strtolower($raw['type'][$k]);
                        }
                    }

                    // read vcard 2.1 subtype
                    if (!$subtype) {
                        foreach ($raw as $k => $v) {
                            if (!is_numeric($k) && $v === true && ($k = strtolower($k))
                                && !in_array($k, array('pref','internet','voice','base64'))
                            ) {
                                $k_uc    = strtoupper($k);
                                $subtype = $typemap[$k_uc] ?: $k;
                                break;
                            }
                        }
                    }

                    // force subtype if none set
                    if (!$subtype && preg_match('/^(email|phone|address|website)/', $key)) {
                        $subtype = 'other';
                    }

                    if ($subtype) {
                        $key .= ':' . $subtype;
                    }

                    // split ADR values into assoc array
                    if ($tag == 'ADR') {
                        list(,, $value['street'], $value['locality'], $value['region'], $value['zipcode'], $value['country']) = $raw;
                        $out[$key][] = $value;
                    }
                    else {
                        $out[$key][] = $raw[0];
                    }
                }
                else {
                    $out[$col][] = $raw;
                }
            }
        }

        // handle special IM fields as used by Apple
        foreach ($this->immap as $tag => $type) {
            foreach ((array)$this->raw[$tag] as $i => $raw) {
                $out['im:'.$type][] = $raw[0];
            }
        }

        // copy photo data
        if ($this->raw['PHOTO']) {
            $out['photo'] = $this->raw['PHOTO'][0][0];
        }

        return $out;
    }
376010
public function toArray()
    {
        $result     = parent::toArray();

        $result['locationX']    = $this->locationX;
        $result['locationY']    = $this->locationY;
        $result['scale']        = $this->scale;
        $result['label']        = $this->label;

        return $result;
    }
313843
public function toArray(): array
    {
        return [
            'name' => $this->name,
            'text' => $this->text,
            'type' => $this->type,
            'value' => $this->value,
            'style' => $this->style,
            'confirm' => $this->confirmation,
        ];
    }
1209882
public function toArray()
	{
		$result = parent::toArray();

		if (isset($result['activated']))
		{
			$result['activated'] = $this->getActivatedAttribute($result['activated']);
		}
		if (isset($result['permissions']))
		{
			$result['permissions'] = $this->getPermissionsAttribute($result['permissions']);
		}
		if (isset($result['suspended_at']))
		{
			$result['suspended_at'] = $result['suspended_at']->format('Y-m-d H:i:s');
		}

		return $result;
	}
402265
public function toArray()
    {
        $keys = $this->redis->hKeys($this->key);
        $result = array();
        foreach ($keys as $key) {
            $result[$key] = $this->offsetGet($key);
        }
        return $result;
    }
1013719
public function asArray()
    {
        $array = [];

        foreach ($this as $key => $val) {
            if ($val instanceof self) {
                $val = $val->asArray();
            }
            $array[$key] = $val;
        }

        return $array;
    }
761319
public function apiResult() : array {
		$result = [
			'success' => false,
			'error' => [],
			'pk' => $this->pk,
			'values' => $this->values,
			'values_loaded' => $this->values_loaded,
			'new_serials' => $this->new_serials
		];
		if ($this->hasErrors()) {
			$message = [];
			// details
			$details = [];
			if (!empty($this->collection['details'])) {
				$this->disassembleCollectionObject($this->collection['details'], $details);
			}
			$ignore_fields = [];
			if ($this->collection_object->primary_model->tenant ?? false) {
				$ignore_fields[$this->collection_object->primary_model->tenant_column] = $this->collection_object->primary_model->tenant_column;
			}
			if ($this->collection_object->primary_model->module ?? false) {
				$ignore_fields[$this->collection_object->primary_model->tenant_column] = $this->collection_object->primary_model->tenant_column;
			}
			foreach ($details as $k3 => $v3) {
				foreach ($ignore_fields as $k4 => $v4) {
					if (isset($v3['map'][$k4])) {
						$ignore_fields[$v3['map'][$k4]] = $v3['map'][$k4];
					}
				}
			}
			$message[] = i18n(null, 'Record') . ':';
			$temp = [];
			foreach ($this->pk as $k => $v) {
				if (!empty($ignore_fields[$k])) continue;
				$temp[] = $k . ' = ' . $v;
			}
			$message[] = "\t" . i18n(null, 'Primary Key') . ': ' . implode(', ', $temp);
			// general errors
			if (!empty($this->errors['general']['danger'])) {
				$message[] = "\t" . i18n(null, 'General Errors') . ':';
				foreach ($this->errors['general']['danger'] as $v) {
					$message[] = "\t\t" . $v;
				}
			}
			// fields
			if (!empty($this->errors['flag_error_in_fields'])) {
				$message[] = "\t" . i18n(null, 'Field Errors') . ':';
				foreach ($this->errors['fields'] as $k => $v) {
					if (empty($v['danger'])) continue; // only errors
					// regular fields
					if (strpos($k, '[') === false) {
						$message[] = "\t\t" . $k . ': ';
						foreach ($v['danger'] as $v2) {
							$message[] = "\t\t\t" . $v2;
						}
					} else { // details
						$field = str_replace(']', '', $k);
						$parts = explode('[', $field);
						$message[] = "\t\t" . $details[$parts[0]]['name'] . ', ' . $parts[2] . ': ';
						// pk
						$pk_parts = explode('::', $parts[1]);
						$pk_details = [];
						foreach ($details[$parts[0]]['pk'] as $k2 => $v2) {
							$pk_details[$v2] = $pk_parts[$k2] ?? null;
						}
						$temp = [];
						foreach ($pk_details as $k2 => $v2) {
							if (!empty($ignore_fields[$k2])) continue;
							$temp[] = $k2 . ' = ' . $v2;
						}
						$message[] = "\t\t\t" . i18n(null, 'Primary Key') . ': ' . implode(', ', $temp);
						foreach ($v['danger'] as $v2) {
							$message[] = "\t\t\t" . $v2;
						}
						// todo handle subdetails
					}
				}
			}
			$result['error'][] = implode("\n", $message);
		} else {
			$result['success'] = true;
		}
		return $result;
	}