Skip to content

Commit

Permalink
move the federation objects to their own file
Browse files Browse the repository at this point in the history
  • Loading branch information
irevoire committed Aug 1, 2024
1 parent fe7d6a2 commit 8fe179c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 47 deletions.
24 changes: 24 additions & 0 deletions src/Contracts/FederationOptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Meilisearch\Contracts;

class FederationOptions
{
private ?float $weight = null;

public function setWeight(float $weight): FederationOptions
{
$this->weight = $weight;

return $this;
}

public function toArray(): array
{
return array_filter([
'weight' => $this->weight,
], static function ($item) { return null !== $item; });
}
}
33 changes: 33 additions & 0 deletions src/Contracts/MultiSearchFederation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Meilisearch\Contracts;

class MultiSearchFederation
{
private ?int $limit = null;
private ?int $offset = null;

public function setLimit(int $limit): MultiSearchFederation
{
$this->limit = $limit;

return $this;
}

public function setOffset(int $offset): MultiSearchFederation
{
$this->offset = $offset;

return $this;
}

public function toArray(): array
{
return array_filter([
'limit' => $this->limit,
'offset' => $this->offset,
], static function ($item) { return null !== $item; });
}
}
47 changes: 0 additions & 47 deletions src/Contracts/SearchQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,6 @@

namespace Meilisearch\Contracts;

class MultiSearchFederation
{
private ?int $limit = null;
private ?int $offset = null;

public function setLimit(int $limit): MultiSearchFederation
{
$this->limit = $limit;

return $this;
}

public function setOffset(int $offset): MultiSearchFederation
{
$this->offset = $offset;

return $this;
}

public function toArray(): array
{
return array_filter([
'limit' => $this->limit,
'offset' => $this->offset,
], static function ($item) { return null !== $item; });
}
}

class FederationOptions
{
private ?float $weight = null;

public function setWeight(float $weight): FederationOptions
{
$this->weight = $weight;

return $this;
}

public function toArray(): array
{
return array_filter([
'weight' => $this->weight,
], static function ($item) { return null !== $item; });
}
}

class SearchQuery
{
private string $indexUid;
Expand Down

0 comments on commit 8fe179c

Please sign in to comment.