Get data for widget

@return array
339053
public function getCounts()
    {
        $log = AccessLog::all()->groupBy('user_id');

        $counts = [];
        $all = 0;
        foreach ($log as $l) {
            $first = $l[0];
            $user = $first->user ? $first->user : $this->getDeletedFakeUser();
            $size = sizeof($l);
            $counts[] = [
                'size' => $size,
                'id' => $first->user_id,
                'name' => $user->username
            ];
            $all += $size;
        }

        return [
            'all' => $all,
            'counts' => $counts
        ];
    }
189086
public function getData()
    {
        if (null === $this->data) {
            $this->data = $this->loadData();
        }

        return $this->data;
    }
132357
public function getAsArray(): array
	{
		$data = [];

		foreach ($this->getBindings() as $bind) {
			$data[$bind->getParameter()] = $bind->getValue();
		}

		return $data;
	}
943478
public function getData()
    {
        $this->validate('merId', 'password', 'merUrlIdx');
        $data = array(
            'mer_id'            => $this->getMerId(),
            'password'          => $this->getPassword(),
            'mer_url_idx'       => $this->getMerUrlIdx(),
            'client_ip'         => $this->getClientIp(),
        );
        return $data;
    }
507800
public function getData()
    {
        if ($this->data === null) {
            $searchRequest  = $this->searchRequestBuilder->getRequest();
            $searchResponse = $this->searchEngine->search($searchRequest);

            $this->data = $this->processResponse($searchResponse);
        }

        return $this->data;
    }
278555
public function getData()
    {
        if (!$this->enabled()) {
            return null;
        }

        $this->addDeprecations();
        $this->timers = [];

        return $this->debugbar->getData();
    }
1179354
protected function getData() {
        if ($this->data === null) {
            $stmt = $this->db->get(
                $this->table,
                $this->where,
                $this->options + [Db::OPTION_FETCH_MODE => $this->getFetchArgs()]
            );

            $data = $stmt->fetchAll(...(array)$this->getFetchArgs());

            if (is_callable($this->rowCallback)) {
                array_walk($data, function (&$row) {
                    $row = call_user_func($this->rowCallback, $row);
                });
            }

            $this->data = $data;
        }

        return $this->data;
    }
983923
public function getData($options)
    {
        if (!empty($options) &&
            array_key_exists('status', $options) &&
            !empty($options['status'])
        ) {
            $data = [];
            $data['status'] = $options['status'];

            if(array_key_exists('date', $options) &&
                !empty($options['date'])){
                $data['date'] = $options['date'];
            }

            return $data;
        } else {
            throw new WidgetParameterException(
                'Required parameter status not found or empty!',
                $this->widgetName,
                'status'
            );
        }
    }
315755
public function get_qt_data() {
        $result = array();
        foreach ($this->data as $name => $value) {
            if ($name[0] != '-' && $name[0] != ':') {
                $result[$name] = $value;
            }
        }
        return $result;
    }
460245
function getWidgets()
    {
        $return = [];
        foreach (array_keys($this->__widgets) as $region)
            $return[$region] = $this->getRegionWidgets($region);

        return $return;
    }
1110096
public function getData()
    {

        $result = [
            'attachment' => [
                'type' => 'template',
                'payload' => [
                    'template_type' => $this->type
                ]
            ]
        ];

        if (is_array($this->quick_replies)) {
            foreach ($this->quick_replies as $qr) {
                if ($qr instanceof QuickReplyButton) {
                    $result['quick_replies'][] = $qr->getData();
                }
            }
        }

        switch ($this->type)
        {
            case self::TYPE_BUTTON:
                $result['attachment']['payload']['text'] = $this->title;
                $result['attachment']['payload']['buttons'] = [];

                foreach ($this->buttons as $btn) {
                    $result['attachment']['payload']['buttons'][] = $btn->getData();
                }

            break;

            case self::TYPE_GENERIC:
                $result['attachment']['payload']['elements'] = [];
                $result['attachment']['payload']['image_aspect_ratio'] = $this->image_aspect_ratio;

                foreach ($this->elements as $btn) {
                    $result['attachment']['payload']['elements'][] = $btn->getData();
                }
            break;

            case self::TYPE_LIST:
                $result['attachment']['payload']['elements'] = [];
                $result['attachment']['payload']['top_element_style'] = $this->top_element_style;
                //list items button
                foreach ($this->elements as $btn) {
                    $result['attachment']['payload']['elements'][] = $btn->getData();
                }
                //the whole list button
                foreach ($this->buttons as $btn) {
                    $result['attachment']['payload']['buttons'][] = $btn->getData();
                }
            break;

            case self::TYPE_RECEIPT:
                $result['attachment']['payload']['recipient_name'] = $this->recipient_name;
                $result['attachment']['payload']['order_number'] = $this->order_number;
                $result['attachment']['payload']['currency'] = $this->currency;
                $result['attachment']['payload']['payment_method'] = $this->payment_method;
                $result['attachment']['payload']['order_url'] = $this->order_url;
                $result['attachment']['payload']['timestamp'] = $this->timestamp;
                $result['attachment']['payload']['elements'] = [];

                foreach ($this->elements as $btn) {
                    $result['attachment']['payload']['elements'][] = $btn->getData();
                }

                $result['attachment']['payload']['address'] = $this->address->getData();
                $result['attachment']['payload']['summary'] = $this->summary->getData();
                $result['attachment']['payload']['adjustments'] = [];

                foreach ($this->adjustments as $btn) {
                    $result['attachment']['payload']['adjustments'][] = $btn->getData();
                }
            break;
        }


        if ($this->recipient) {
            return [
                'recipient' =>  [
                    'id' => $this->recipient
                ],
                'message' => $result,
                'tag' => $this->tag,
                'notification_type'=> $this->notification_type,
                'messaging_type' => $this->messaging_type
            ];
        } else {
            //share_contents only
            return [
                'attachment' => $result['attachment']
            ];
        }
    }
679405
public function getData() {
        if ($this->toSort && !empty($this->getOrder())) {
            $this->sortData();
        }

        if ($this->getLimit()) {
            return array_slice($this->data, $this->getOffset(), $this->getLimit());
        } else {
            return $this->data;
        }
    }
809006
public function widgetDataForJs()
    {
        return [
            'colors'  => $this->colors(),
            'options' => [
                'xAxis' => empty($this->categories()) ? null : [
                    [
                        'type' => 'category',
                        'data' => $this->categories()
                    ]
                ],
                'yAxis' => empty($this->categories()) ? null : [
                    [
                        'type'      => 'value',
                        'splitArea' => ['show' => true]
                    ]
                ],
                'series' => $this->series()
            ]
        ];
    }
898299
protected function getElementData()
    {
        $arResult = [
            'nest_depth' => $this->obElement->getDepth(),
        ];

        $arResult['children_id_list'] = $this->obElement->children()
            ->active()
            ->orderBy('nest_left', 'asc')
            ->lists('id');

        return $arResult;
    }
1104235
public function data()
    {
        return [
            'class' => static::class,
            'params' => [
                'logicalOperator' => $this->logicalOperator,
                'constraints' => $this->constraints->map(function ($constraint) {
                    return $constraint->data();
                })->all(),
            ],
        ];
    }
164162
protected function _getAppWidgets(): array
    {
        $result = [];

        $paths = App::path('Template');
        $tree = ['Plugin', 'Search', 'Widgets'];
        foreach ($paths as $path) {
            $path .= 'Element' . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $tree) . DIRECTORY_SEPARATOR;

            $dir = new Folder($path);
            $files = $dir->find('.*\.ctp');
            if (empty($files)) {
                continue;
            }

            foreach ($files as $file) {
                $element = implode('/', $tree) . '/' . str_replace('.ctp', '', $file);

                $name = str_replace('.ctp', '', $file);
                $name = Inflector::humanize($name);
                $result[] = [
                    'name' => $name,
                    'type' => static::WIDGET_TYPE,
                    'content' => [
                        'model' => $this->getAlias(),
                        'path' => $path . $file,
                        'element' => $element
                    ]
                ];
            }
        }

        return $result;
    }
1371653
public static function get()
    {
        $widgets = [];
        foreach (Packages::all() as $package) {
            $dir = __DIR__.'/../../'.$package.'/src';
            $files = is_dir($dir) ? scandir($dir) : [];

            foreach ($files as $file) {
                if ($file == 'Widgets.json') {
                    $file_r = file_get_contents($dir.'/'.$file);
                    foreach (json_decode($file_r, true) as $w) {
                        $w['package'] = $package;
                        array_push($widgets, $w);
                    }
                    break;
                }
            }
        }

        $widgets = static::orderByPreference($widgets);

        return $widgets;
    }