-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move the federation objects to their own file
- Loading branch information
Showing
3 changed files
with
57 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters