-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reintegration of settings into flexform
- Loading branch information
Showing
2 changed files
with
359 additions
and
0 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,54 @@ | ||
<?php | ||
|
||
|
||
namespace Fab\NaturalGallery\Persistence; | ||
|
||
|
||
|
||
/** | ||
* Order class for order that will apply to a query | ||
*/ | ||
class Order | ||
{ | ||
/** | ||
* The orderings | ||
* | ||
* @var array | ||
*/ | ||
protected array $orderings = []; | ||
|
||
/** | ||
* Constructs a new Order | ||
* | ||
* @para array $orders | ||
* @param array $orders | ||
*/ | ||
public function __construct(array $orders = array()) | ||
{ | ||
foreach ($orders as $order => $direction) { | ||
$this->addOrdering($order, $direction); | ||
} | ||
} | ||
|
||
/** | ||
* Add ordering | ||
* | ||
* @param string $order The order | ||
* @param string $direction ASC / DESC | ||
* @return void | ||
*/ | ||
public function addOrdering(string $order, string $direction): void | ||
{ | ||
$this->orderings[$order] = $direction; | ||
} | ||
|
||
/** | ||
* Returns the order | ||
* | ||
* @return array The order | ||
*/ | ||
public function getOrderings(): array | ||
{ | ||
return $this->orderings; | ||
} | ||
} |
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