forked from aces/Loris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trying to fix lint after adjustements
- Loading branch information
Showing
13 changed files
with
25,041 additions
and
52,555 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Binary file not shown.
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
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 LORIS\biobank; | ||
|
||
/** | ||
* Condition Class | ||
* | ||
* Defines a Condition object for modifying resource access. | ||
* A Condition represents a filter or restriction applied to resource access | ||
* in a query. It specifies the field to filter, the value to match, the | ||
* comparison operator, and the logical operator for combining multiple conditions. | ||
* | ||
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License | ||
*/ | ||
class Condition | ||
{ | ||
/** | ||
* Constructs a Condition instance. | ||
* | ||
* @param string $field The field to filter by | ||
* @param ?string $value The value to compare against | ||
* @param ?Operator $operator The comparison operator | ||
* @param ?LogicalOperator $logicalOperator The logical operator for combining | ||
* with other conditions | ||
*/ | ||
public function __construct( | ||
public string $field, | ||
public ?string $value, | ||
public ?Operator $operator = Operator::EQUALS, | ||
public ?LogicalOperator $logicalOperator = LogicalOperator::AND, | ||
) { | ||
} | ||
} |
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
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,16 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace LORIS\biobank; | ||
|
||
/** | ||
* Enum LogicalOperator | ||
* | ||
* Defines the allowed LogicalOperators for chaining query conditions. | ||
* | ||
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License | ||
*/ | ||
enum LogicalOperator: string | ||
{ | ||
case AND = 'AND'; | ||
case OR = 'OR'; | ||
} |
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,42 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace LORIS\biobank; | ||
|
||
/** | ||
* Enum Operator | ||
* | ||
* Defines the allowed Operators for accessing resources. | ||
* | ||
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License | ||
*/ | ||
enum Operator: string | ||
{ | ||
case EQUALS = 'eq'; // Equals | ||
case NOT_EQUALS = 'neq'; // Not equals | ||
case GREATER_THAN = 'gt'; // Greater than | ||
case LESS_THAN = 'lt'; // Less than | ||
case GREATER_THAN_OR_EQUALS = 'gte'; // Greater than or equals | ||
case LESS_THAN_OR_EQUALS = 'lte'; // Less than or equals | ||
case LIKE = 'like'; // Like (pattern match) | ||
case IN = 'in'; // In (value in set) | ||
|
||
|
||
/** | ||
* Converts the Operator enum value to its corresponding SQL representation. | ||
* | ||
* @return string The SQL operator corresponding to the enum value. | ||
*/ | ||
public function toSql(): string | ||
{ | ||
return match ($this) { | ||
self::EQUALS => '=', | ||
self::NOT_EQUALS => '!=', | ||
self::GREATER_THAN => '>', | ||
self::LESS_THAN => '<', | ||
self::GREATER_THAN_OR_EQUALS => '>=', | ||
self::LESS_THAN_OR_EQUALS => '<=', | ||
self::LIKE => 'LIKE', | ||
self::IN => 'IN', | ||
}; | ||
} | ||
} |
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
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
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