Export index.

@param Repository $repository
@param string     $format

@return string
330965
public function exportIndex(
        Repository $repository,
        string $format
    ): string {
        $allItems = [];
        $iteration = 0;
        while (true) {
            $items = $repository
                ->query(Query::create('', $iteration, 10000))
                ->getItems();

            if (empty($items)) {
                break;
            }

            $allItems = array_merge(
                $allItems,
                $items
            );

            ++$iteration;
        }

        return $this
            ->exporterCollection
            ->getExporterByName($format)
            ->itemsToFormat($allItems);
    }
1329463
private function createIndexRepositories(
        ContainerBuilder $container,
        string $name,
        array $repositoryConfiguration,
        $indexId,
        $indexName
    ) {
        $this->createRepositoryReferenceServiceReference(
            $container,
            $name,
            $repositoryConfiguration,
            $indexId,
            $indexName
        );

        $this->createSearchRepository(
            $container,
            $name,
            $repositoryConfiguration,
            $indexName
        );
    }
1155232
public function update(Repository $repository = null)
    {
        if (!$repository) {
            $repository = $this->getRepository();
        }

        $repository = $repository->aliased('write');

        $update = $this->getQuery()->transformToUpdate();

        $update->setSet($this->setData);

        $prepare = $repository->prepareQuery($update);

        return $repository->executePrepared($prepare);
    }
1162609
public function publish($format = 'php', $consolidated = false)
    {
        $format = $this->sanitizeFormat($format);
        $destination = $this->paths->getConfigurationPath();

        // Create directory
        if (!$this->files->isDirectory($destination) && !$consolidated) {
            $this->files->createDir($destination);
        }

        // Consolidate or not configuration
        if ($consolidated) {
            $destination = $this->paths->getRocketeerPath().'/rocketeer.'.$format;
        }

        // Unzip configuration files
        $this->publishNode($destination, $format);

        return $destination;
    }
953167
public function export(Builder $query, $format)
    {
        $method = 'to'.strtoupper($format);

        if (method_exists($this, $method)) {
            return call_user_func_array([$this, $method], [$query]);
        }

        if (method_exists($this->module, $method)) {
            return call_user_func_array([$this->module, $method], [$query]);
        }

        throw new Exception(sprintf('Don\'t know how to export to %s format.', $format));
    }
623018
public function getByFormat($format)
    {
        foreach ($this->getExporters() as $exporter) {
            if ($exporter->support($format)) {
                return $exporter;
            }
        }

        throw new \RuntimeException(sprintf('No exporter found for "%s" format.', $format));
    }
165465
public function index(JsonApiRepository $repository, Parameters $parameters)
    {
        $this->applyFilters($this->filters, $this->filterFactory, $repository);

        return $repository->get();
    }
476885
public static function createFromOutputLine(Repository $repository, string $outputLine)
    {
        $slices = static::getLineSlices($outputLine);
        $fullPath = $slices['fullPath'];
        if (false === $pos = mb_strrpos($fullPath, '/')) {
            // repository root
            $path = '';
            $name = $fullPath;
        } else {
            $path = substr($fullPath, 0, $pos);
            $name = substr($fullPath, $pos + 1);
        }

        return new static(
            $repository,
            $slices['permissions'],
            $slices['type'],
            $slices['sha'],
            $slices['size'],
            $name,
            $path
        );
    }
1137709
public function views($owner, $repository, $per = 'day')
    {
        return $this->get('/repos/'.rawurlencode($owner).'/'.rawurlencode($repository).'/traffic/views?per='.rawurlencode($per));
    }
1218528
public static function createFromOutputLines(Repository $repository, array $outputLines)
    {
        $log = new self($repository);
        $log->parseOutputLines($outputLines);

        return $log;
    }
381661
protected function doFilterWithRepository(
        Collection $collection,
        Repository $repository,
        WhereExpressionCollector $whereExpressionCollector,
        &$params
    ) {
        $columnName = self::getRealColumnName($this, $collection);

        $placeHolder = $this->detectPlaceHolder($this->equalTo);
        // The placeholder will contain an _ to denote the alias given to it in ColumnIntersectsCollection. We
        // need to do a normal where clause on it here, rather than a having clause so we need to explode this
        // and create a direct reference to the column.
        $parts = explode("_",$placeHolder);
        $target = "`".$collection->getUniqueReference()."`.`".$parts[1]."`";
        $toAlias = $parts[0];
        $columnName = "`".$toAlias."`.`".$columnName."`";

        $whereExpressionCollector->addWhereExpression(
            new LiteralWhereExpression(
                $columnName." IS NOT NULL AND ".$columnName." = ".$target, false, $toAlias));

        return true;
    }
116895
public function index(IndexRequest $request)
    {
        $data = $this->repository->datatables(null, $request->getWith())
            ->search($request->getColumns(), null)
            ->result($request->getExportFileName());

        return $data;
    }
311915
protected function doFilterWithRepository(
        Collection $collection,
        Repository $repository,
        WhereExpressionCollector $whereExpressionCollector,
        &$params
    ) {
        $filtered = true;

        foreach ($this->contains as $contain) {
            $currentFiltered = $this->createColumnWhereClauseExpression(
                "LIKE",
                [$contain],
                $collection,
                $repository,
                $whereExpressionCollector,
                $params);

            $keys = array_keys($params);

            $end = end($keys);

            $params[$end] = "%{$params[$end]}%";

            if ($filtered && !$currentFiltered) {
                $filtered = false;
            }
        }


        return $filtered;
    }
393023
public function fetchRepository(Repository $repository)
    {
        $response = $this->getResponse(
            sprintf('%s/%s/metrics',
                $repository->getType(),
                $repository->getSlug()
            )
        );

        if (!$response || isset($repositoryArray['error'])) {
            throw new \UnexpectedValueException(sprintf('Response is empty for url %s', $response));
        }

        $repository = $this->hydrate($repository, $response['values']);
        $repository->setBranch($response['branch']);


        return $repository;
    }
1108953
protected function doFilterWithRepository(
        Collection $collection,
        Repository $repository,
        WhereExpressionCollector $whereExpressionCollector,
        &$params
    ) {
        return $this->createColumnWhereClauseExpression(
            "LIKE",
            $this->startsWith."%",
            $collection,
            $repository,
            $whereExpressionCollector,
            $params);
    }
869246
protected function getSlugsToReset(Repository $repository)
    {
        if ($this->validSlugProvided($repository)) {
            return collect([$this->argument('slug')]);
        }

        if ($this->option('force')) {
            return $repository->all()->pluck('slug');
        }

        return $repository->enabled()->pluck('slug');
    }
606773
public function apply($model, Repository $repository)
    {
        $model = $model->where('pid', 0)
            ->orderBy('sort', 'desc')
            ->orderBy('id', 'desc');

        return $model;
    }