Method to return model values in array format

@param  boolean $verbose Include prefixed "__" vars in output
@return array            Array of model values.
974329
public function toArray($verbose = false)
	{
		$output = $this->_tbl->getProperties();

		if ($verbose)
		{
			foreach ($this->_tbl as $key => $value)
			{
				if (substr($key, 0, 2) == '__')
				{
					$output[substr($key, 2)] = $value;
				}
			}
		}

		return $output;
	}
1059528
public function go($verbose = false)
    {
        $this->builder->setLinks($this->configuration["links"]);
        $this->builder->setMatchers($this->configuration["matchers"]);

        if ( ! $this->builder->validate()) {
            // @codeCoverageIgnoreStart
            if ($verbose) {
                $this->dumpValueAndArguments($this->builder->getLastMatcher());
            }

            $this->throwOnFailure($this->builder->getMessage());
        }
        // @codeCoverageIgnoreEnd

        return true;
    }
455798
public function verbose($verbose = null)
    {
        if ($verbose !== null) {
            $this->details = (bool) $verbose;
        }

        return $this->details;
    }
447241
protected function mapArray(array $arrayValues = null)
    {
        if ($arrayValues === null) {
            return [];
        }

        $array = [];
        foreach ($arrayValues as $arrayValue) {
            if ($arrayValue['value'] === null) {
                $array[$arrayValue['index']] = null;
            } else {
                switch ($arrayValue['type']) {
                    case 'integer':
                        $array[$arrayValue['index']] = (int) $arrayValue['value'];
                    break;
                    case 'float':
                        $array[$arrayValue['index']] = (float) $arrayValue['value'];
                    break;
                    case 'boolean':
                        $array[$arrayValue['index']] = (boolean) $arrayValue['value'];
                    break;
                    case 'string':
                        $array[$arrayValue['index']] = (string) $arrayValue['value'];
                    break;
                    case 'DateTime':
                        $array[$arrayValue['index']] = $this->mapDateTime($arrayValue['value']);
                    break;
                    case 'array':
                        $array[$arrayValue['index']] = $this->mapArray($arrayValue['value']);
                    break;
                    case 'SplObjectStorage':
                        $array[$arrayValue['index']] = $this->mapSplObjectStorage($arrayValue['value']);
                    break;
                    default:
                        $array[$arrayValue['index']] = $this->mapToObject($arrayValue['value']);
                    break;
                }
            }
        }

        return $array;
    }
114545
public static function getPrimaryModel($models)
    {
        if (empty($models)) {
            return false;
        }
        \d($models);
        exit;
        foreach ($models as $tabKey => $model) {
            if ($tabKey === static::getPrimaryTabularId(static::baseClassName())) {
                return $model;
            }
        }

        return false;
    }
1083653
public function getData($search = false) {
        if ($this->option && method_exists($this->form, $this->option)) {
            return $this->form->{$this->option}(...[$search]);
        }

        return [];
    }
936138
public function getModelsFromResult($modelResult)
    {
        $modelsArray = [];

        if (isset($modelResult['models'])) {
            foreach ($modelResult['models'] as $model) {
                $model = new Model($model);
                $modelsArray[] = $model;
            }
        } else {
            throw new \Exception('Models Not Found');
        }

        return $modelsArray;
    }
588070
protected function from_db_records(array $results) : array {
        $entityfactory = $this->get_entity_factory();

        return array_map(function(array $result) use ($entityfactory) {
            [
                'forum' => $forumrecord,
                'course_module' => $coursemodule,
                'course' => $course,
                'context' => $context,
            ] = $result;
            return $entityfactory->get_forum_from_stdclass($forumrecord, $context, $coursemodule, $course);
        }, $results);
    }
11489
public function export(bool $verbose = false): string {
        openssl_csr_export($this->getHandle(), $output, !$verbose);
        return $output;
    }
273258
private function getRecordsByHandle(array $records): array
    {
        $recordsByHandle = [];
        foreach ($records as $record) {
            $modelClass = get_class($record);
            $converter = Craft::$app->controller->module->getConverter($modelClass);
            $index = $converter->getRecordIndex($record);
            $recordsByHandle[$index] = $record;
        }

        return $recordsByHandle;
    }
935342
protected function combine($file, $verbose = false)
    {

        $file = $this->getRealCommandName($file);
        $config = $this->getConfig();
        $file = $config['paths']['configs'] . 'commands/' . $file . '.yml';
        $data = Yaml::parse($file);

        if ($data === $file) {
            return false;
        }



        $docs = $data['docs'];
        $command = $data['command'];

        $out = '';
        $out .= sprintf("%s: %s\n", $docs['name'], $docs['summary']);
        $out .= 'usage: ' . trim($docs['usage']) . "\n";
        $out .= "\n  " . $this->pre($docs['description']) . "\n";

        $hasOptions = false;
        if (isset($command['options']) && count($command['options'])) {
            $out .= "Available options:\n";
            foreach ($command['options'] as $opt) {
                $spaces = str_repeat(' ', 30 - strlen($opt['doc_name']));
                $out .= "  {$opt['doc_name']} {$spaces} : {$opt['description']}\n";
            }
            $hasOptions = true;
        }
        if (isset($command['arguments']) && count($command['arguments'])) {
            $out .= $hasOptions ? "\n": "";
            $out .= "Valid arguments:\n";
            foreach ($command['arguments'] as $arg) {
                $spaces = str_repeat(' ', 30 - strlen($arg['help_name']));
                $out .= "  {$arg['help_name']} {$spaces} : {$arg['description']}\n";
            }
        }
        if (isset($command['commands']) && count($command['commands'])) {
            $out .= "Valid commands:\n";
            foreach ($command['commands'] as $subcommand) {
                $spaces = str_repeat(' ', 30 - strlen($subcommand['name']));
                $out .= "  {$subcommand['name']} {$spaces} : {$subcommand['description']}\n";
            }
        }

        if ($verbose) {
            if (isset($docs['extradesc'])) {
                $out .= "\nExtended Documentation:";
                $out .= "\n  " . $this->pre(trim($docs['extradesc'])) . "\n";
            }
            if (isset($docs['examples'])) {
                $out .= "\nExamples:";
                $out .= "\n  " . $this->pre(trim($docs['examples'])) . "\n";
            }
        } else {
            $out .= "\nUse help with -v or --verbose option to get more information.\n";
        }

        return $out;
    }
1342727
public function values(array $values)
    {
        $this->fieldValues = array();

        $this->fieldsSql   = '?i';
        $this->fieldValues[] = array_keys($values);

        $this->valuesSql   = array();

        foreach ($values as $v) {
            if (is_object($v) and $v instanceof SqlValueInterface) {
                $this->valuesSql[] = $v->getSql();
                $this->fieldValues = array_merge($this->fieldValues, $v->getValues());
            } else {
                $this->valuesSql[]   = '?q';
                $this->fieldValues[] = $v;
            }
        }

        $this->valuesSql = implode(', ', $this->valuesSql);

        return $this;
    }
758445
public function toArray($returnFields = array())
    {
        if (!$this->isColl) {
            $data = array_fill_keys($returnFields ?: $this->getFields(), null);
            if (!$returnFields) {
                return $this->data + $data;
            } else {
                $data = array_fill_keys($returnFields, null);
                return array_intersect_key($this->data, $data) + $data;
            }
        } else {
            $data = array();
            /** @var $record Record */
            foreach ($this->data as $key => $record) {
                $data[$key] = $record->toArray($returnFields);
            }
            return $data;
        }
    }
783261
public function toArray($asAlias = false, $returnHidden = true) {

        $method = $asAlias ? "getAlias" : "getProperty";

        $dados = [];

        foreach (self::$schema->getProperties() as $item) {

            if (!$returnHidden && $item->getBehavior()->isHidden()) {
                continue;
            }

            if (method_exists($this, "get" . $item->getProperty())) {
                $value = $this->{"get" . $item->getProperty()}();
            } else {
                $value = $this->{$item->getProperty()};
            }

            if (is_null($value)) {
                continue;
            }

            if(is_array($value)){
                $dados[$item->{$method}()] = [];

                foreach ($value as $valueItem) {
                    $valueItem = is_object($valueItem) ? $valueItem->toArray($asAlias, $returnHidden) : $valueItem;

                    $dados[$item->{$method}()][] = $valueItem;
                }

                continue;
            }

            switch ($item->getType()) {
                case 'json':
                    $decoded = json_decode($value, true);

                    $dados[$item->{$method}()] = !empty($decoded) ? $decoded : $value;
                    break;
                default:
                    $value = is_object($value) ? $value->toArray($asAlias, $returnHidden) : $value;

                    $dados[$item->{$method}()] = $value;
                    break;
            }
        }

        return $dados;
    }
495470
public function toArray($withNull = false)
    {
        $result = [];
        foreach (get_object_vars($this) as $property => $value) {
            $getter = 'get' . str_replace('_', '', $property);
            if (method_exists($this, $getter)) {
                $result[$property] = $this->{$getter}();
            } else {
                $result[$property] = $this->{$property};
            }
        }
        if ($withNull) {
            return $result;
        }

        return array_filter(
            $result, function ($value) {
            return isset($value);
        }
        );
    }
1279299
public function exportToFile(string $fileName, bool $verbose = FALSE): bool {
        return openssl_x509_export_to_file(
            $this->getHandle(),
            $fileName,
            !$verbose
        );
    }
1169740
public function export(bool $verbose = FALSE): string {
        openssl_x509_export($this->getHandle(), $output, !$verbose);
        return $output;
    }