public function loadData()
    {
        if (!is_callable($this->options['data_loader']) && !is_array($this->options['data_loader'])) {
            throw new DataLoaderNotAvailableException();
        }

        if ($this->loaded) {
            return;
        }

        $currentPage = 1;
        $limit = -1;
        if ($this->hasExtension(PaginationExtension::class)) {
            /** @var PaginationExtension $paginationExtension */
            $paginationExtension = $this->getExtension(PaginationExtension::class);
            $paginationExtension->setLimit($this->options['default_limit']);
            $currentPage = $paginationExtension->getCurrentPage();
            $limit = $paginationExtension->getLimit();
        }

        $this->eventDispatcher->dispatch(DataLoadEvent::PRE_LOAD, new DataLoadEvent($this));

        // loads the data from the data loader callable
        $tableData = null;

        if (is_callable($this->options['data_loader'])) {
            $tableData = ($this->options['data_loader'])($currentPage, $limit);
        }
        if (is_array($this->options['data_loader'])) {
            $tableData = call_user_func($this->options['data_loader'], $currentPage, $limit);
        }

        if (!$tableData instanceof TableDataInterface) {
            throw new \UnexpectedValueException('Table::dataLoader must return a TableDataInterface');
        }

        $this->results = $tableData->getResults();

        if ($this->hasExtension(PaginationExtension::class)) {
            /** @var PaginationExtension $paginationExtension */
            $paginationExtension->setTotalResults($tableData->getTotalResults());
        }

        $this->loaded = true;

        $this->eventDispatcher->dispatch(DataLoadEvent::POST_LOAD, new DataLoadEvent($this));
    }