Prepare table footer.

@param  array  $data

@return array
199779
protected function prepareFooter(array $data)
    {
        $footer = [];

        foreach ($data as $date => $levels) {
            foreach ($levels as $level => $count) {
                if ( ! isset($footer[$level])) {
                    $footer[$level] = 0;
                }

                $footer[$level] += $count;
            }
        }

        return $footer;
    }
1149858
private function prepareUsers(array $data)
    {
        $users = [];
        $now   = Carbon::now();

        foreach ($data as $user) {
            $users[] = [
                'username'     => $user['username'],
                'first_name'   => Arr::get($user, 'first_name', null),
                'last_name'    => Arr::get($user, 'last_name', null),
                'email'        => $user['email'],
                'password'     => bcrypt($user['password']),
                'is_admin'     => true,
                'created_at'   => $now,
                'updated_at'   => $now,
                'activated_at' => $user['activated_at'] ?? $now,
            ];
        }

        return $users;
    }
591796
protected function prepareDataForNewRecord(array &$data)
    {
        if ($this->testingFramework === null) {
            return;
        }

        $tableName = $this->getTableName();
        $this->testingFramework->markTableAsDirty($tableName);
        $data[$this->testingFramework->getDummyColumnName($tableName)] = 1;
    }
751232
protected function getHtmlTitleFormatForPage(array $data)
    {
        if (empty($data['page']['title'])) {
            return $data['site']['name'];
        }

        return Str::replace($this->formats['page'], $data);
    }
164994
public function Footer()
    {
        if (is_array($this->footer) and (!empty($this->footer['left']) or !empty($this->footer['right']))) {
            $style = ['width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => [50, 50, 50]];
            $this->Line(0, $this->getY()-1, 290, $this->getY()-2, $style);
            $this->SetFont('', 'B', 6);
            if (empty($this->papelContinuo)) {
                if (!empty($this->footer['left']))
                    $this->Texto($this->footer['left']);
                if (!empty($this->footer['right']))
                    $this->Texto($this->footer['right'], null, null, 'R');
            } else {
                if (!empty($this->footer['left']))
                    $this->Texto($this->footer['left'], null, null, 'C');
                if (!empty($this->footer['right'])) {
                    $this->Ln();
                    $this->Texto($this->footer['right'], null, null, 'C');
                }
            }
        }
    }
1202281
private function formatCapabilities(array $data): array
    {
        $result = [];
        foreach ($data as $controller => $list) {
            $newList = [];
            foreach ($list as $type => $caps) {
                foreach ($caps as $cap) {
                    $field = $cap->getField();
                    $key = !empty($field) ? "${type}_(_${field}_)" : $type;
                    $newList[$key][] = $cap;
                }
            }
            $result[$controller] = $newList;
        }

        return $result;
    }
921957
protected function unformatPayloadData(array $data)
    {
        $unformattedData = array();

        foreach ($data as $key => $value) {
            $newKey = $this->deserializeColumnName($key);

            if (is_array($value)) {
                $newValue = $this->unformatPayloadData($value);
            } else {
                $newValue = $value;
            }

            $unformattedData[$newKey] = $newValue;
        }

        return $unformattedData;
    }
351595
protected function compileTableFooter()
    {
        $footer = [];
        foreach ($this->collection->all() as $row) {
            if (is_array($row->footer)) {
                $footerAttr = $this->html->attributes(array_only($row->footer,
                    ['class', 'id', 'title', 'width', 'style', 'data-class', 'data-hide']));
                $title = isset($row->footer['title']) ? $row->footer['title'] : '';
                $footer[] = '<th ' . $footerAttr . '>' . $title . '</th>';
            } else {
                $footer[] = '<th>' . $row->footer . '</th>';
            }
        }

        return $footer;
    }
1257027
protected function prepareHeader(array $data)
    {
        return array_merge_recursive(
            [
                'date' => $this->translate('general.date'),
                'all'  => $this->translate('general.all'),
            ],
            $this->levels->names($this->locale)
        );
    }
1122581
public static function table ($data)
	{
		$in = new self ();
		$in->setData ($data);
		$in->setOutput (new Table ());
		return $in;
	}
701376
protected function table(array $headers, array $data)
    {
        $dataset = [];

        foreach (array_values($data) as $value) {
            $dataset[] = array_combine($headers, $value);
        }

        return Utils\format_items('table', $dataset, $headers);
    }
849374
public function mapBlocks(array $data): array
    {
        $blocks = [];

        foreach ($data as $dataItem) {
            $blockId = (int) $dataItem['id'];
            $locale = $dataItem['locale'];

            if (!isset($blocks[$blockId])) {
                $blocks[$blockId] = [
                    'id' => $blockId,
                    'layoutId' => (int) $dataItem['layout_id'],
                    'depth' => (int) $dataItem['depth'],
                    'path' => $dataItem['path'],
                    'parentId' => $dataItem['parent_id'] > 0 ? (int) $dataItem['parent_id'] : null,
                    'placeholder' => $dataItem['placeholder'],
                    'position' => $dataItem['parent_id'] > 0 ? (int) $dataItem['position'] : null,
                    'definitionIdentifier' => $dataItem['definition_identifier'],
                    'viewType' => $dataItem['view_type'],
                    'itemViewType' => $dataItem['item_view_type'],
                    'name' => $dataItem['name'],
                    'isTranslatable' => (bool) $dataItem['translatable'],
                    'mainLocale' => $dataItem['main_locale'],
                    'alwaysAvailable' => (bool) $dataItem['always_available'],
                    'status' => (int) $dataItem['status'],
                    'config' => $this->buildParameters((string) $dataItem['config']),
                ];
            }

            $blocks[$blockId]['parameters'][$locale] = $this->buildParameters((string) $dataItem['parameters']);
            $blocks[$blockId]['availableLocales'][] = $locale;
        }

        return array_values(
            array_map(
                static function (array $blockData): Block {
                    ksort($blockData['parameters']);
                    sort($blockData['availableLocales']);

                    return Block::fromArray($blockData);
                },
                $blocks
            )
        );
    }
716270
protected function prepareQueueableEntities( $data )
	{
		if ( $data instanceof QueueableEntity )
		{
			return $this->prepareQueueableEntity( $data );
		}

		if ( is_array( $data ) )
		{
			$data = array_map( function ( $d )
			{
				if ( is_array( $d ) )
				{
					return $this->prepareQueueableEntities( $d );
				}

				return $this->prepareQueueableEntity( $d );
			}, $data );
		}

		return $data;
	}
1361683
public function prepareInsert($table, array $data)
    {
        $data += $this->getDefaultValues($table);
        return $this->filterValues($table, $data);
    }
676180
protected function prepareData($data)
    {
        $data->collector = $data->item['collector'];

        $customData = [];

        foreach ((array) $data->collector['custom.data'] as $key => $item) {
            if (is_array($item)) {
                $item = (string) h('pre', [], print_r($item, 1));
            }

            $customData[$key] = $item;
        }

        $data->collector['custom.data'] = $customData;
    }
1316315
public function compile(array $data = []): string {
		
		// this is our most basic version of a compilation.  it
		// simply assumes that whatever information we have in our
		// data (either the argument or the combination of it and
		// the data property) should just get crammed into our
		// content.  we expect that more complicated views will
		// require more work and so they can overwrite this method.
		
		if ($this->compiled) {
			throw new ViewException("Attempt to recompile view.", ViewException::RECOMPILATION);
		}
		
		// for the convenience of our programmers, we'll let more
		// data be added here -- or maybe it'll be the only way
		// someone adds data.
		
		$this->setData($data);
		
		// now, we'll want to merge our header and footer and put
		// content in the middle.  if we've not received specific
		// content, we just assume it'll be found in our data.
		// then, we can apply our template compiler
		
		if (empty($this->content)) {
			$this->setContent('$content');
		}
		
		$this->compilation = View::compileTemplate(
			($this->header . $this->content . $this->footer),
			$this->data);
		
		// so that we lock our view after compilation, we'll set the
		// compiled flag and then return the content to the calling
		// scope.
		
		$this->compiled = true;
		return $this->compilation;
	}
1334734
public function render($data = [])
    {
        $this->registerPaths();

        $data = new Data($data);

        $this->prepareData($data);

        $this->prepareGlobals($data);

        if ($this->isDebug()) {
            $data->paths = iterator_to_array(clone $this->getPaths());
        }

        return $this->renderer->render($this->layout, $data);
    }