Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
| RecordStatus | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
5 | |
100.00% |
1 / 1 |
| isValid | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getLabel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getIcon | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getBadgeColor | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| all | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Core\Engine\Domain\Model; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | /** |
| 12 | * Record Special Access Status Specification. |
| 13 | * |
| 14 | * Defines the standard special access levels for records across all CRUD modules: |
| 15 | * - 0: None (Standard ownership/role security rules apply, default for user records). |
| 16 | * - 1: All Read (Public read access for all authenticated users; only owner can edit/delete). |
| 17 | * - 2: All Write (Public read and write access for all authenticated users; only owner can delete). |
| 18 | * - 3: All Delete (Full public read, write, and delete access for all authenticated users). |
| 19 | * - 4: Hidden (Private to owner, co-owners, and superusers only; hidden even if module is public). |
| 20 | * |
| 21 | * @package App\Core\Engine\Domain\Model |
| 22 | */ |
| 23 | final class RecordStatus |
| 24 | { |
| 25 | /** @var int Standard ownership rules apply (None / Brak - default). */ |
| 26 | public const int NONE = SpecialAccess::NONE; |
| 27 | |
| 28 | /** @var int Public read access for all authenticated users (Wszyscy odczyt). */ |
| 29 | public const int ALL_READ = SpecialAccess::AVAILABLE; |
| 30 | |
| 31 | /** @var int Public read and write access for all authenticated users (Wszyscy zapis). */ |
| 32 | public const int ALL_WRITE = SpecialAccess::ARCHIVED; |
| 33 | |
| 34 | /** @var int Public read, write, and delete access for all authenticated users (Wszyscy usuwanie). */ |
| 35 | public const int ALL_DELETE = SpecialAccess::DELETED; |
| 36 | |
| 37 | /** @var int Hidden / Private to owner and co-owners only (Ukryty). */ |
| 38 | public const int HIDDEN = SpecialAccess::HIDDEN; |
| 39 | |
| 40 | /** Legacy compatibility alias for NONE. */ |
| 41 | public const int SYSTEM = SpecialAccess::NONE; |
| 42 | |
| 43 | /** Legacy compatibility alias for ALL_READ. */ |
| 44 | public const int AVAILABLE = SpecialAccess::AVAILABLE; |
| 45 | |
| 46 | /** Legacy compatibility alias for ALL_WRITE. */ |
| 47 | public const int ARCHIVED = SpecialAccess::ARCHIVED; |
| 48 | |
| 49 | /** Legacy compatibility alias for ALL_DELETE. */ |
| 50 | public const int DELETED = SpecialAccess::DELETED; |
| 51 | |
| 52 | /** Legacy compatibility alias for HIDDEN. */ |
| 53 | public const int DEMO = SpecialAccess::HIDDEN; |
| 54 | |
| 55 | /** |
| 56 | * Checks if the given status code is a valid special access status. |
| 57 | * |
| 58 | * @param int $status Status code to validate. |
| 59 | * @return bool True if valid status. |
| 60 | */ |
| 61 | public static function isValid(int $status): bool |
| 62 | { |
| 63 | return SpecialAccess::isValid($status); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Returns the human-readable English label for the special access status. |
| 68 | * |
| 69 | * @param int $status Status integer code. |
| 70 | * @return string Label descriptor. |
| 71 | */ |
| 72 | public static function getLabel(int $status): string |
| 73 | { |
| 74 | return SpecialAccess::getLabel($status); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Returns the Bootstrap icon class representing the special access status. |
| 79 | * |
| 80 | * @param int $status Status integer code. |
| 81 | * @return string Bootstrap icon CSS class. |
| 82 | */ |
| 83 | public static function getIcon(int $status): string |
| 84 | { |
| 85 | return SpecialAccess::getIcon($status); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Returns the Bootstrap badge theme color name. |
| 90 | * |
| 91 | * @param int $status Status integer code. |
| 92 | * @return string Bootstrap color class prefix. |
| 93 | */ |
| 94 | public static function getBadgeColor(int $status): string |
| 95 | { |
| 96 | return SpecialAccess::getBadgeColor($status); |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Returns the complete list of valid special access status codes. |
| 101 | * |
| 102 | * @return list<int> List of status codes. |
| 103 | */ |
| 104 | public static function all(): array |
| 105 | { |
| 106 | return SpecialAccess::all(); |
| 107 | } |
| 108 | } |