| 1 | <?php |
||
| 15 | final class CollectionHelper |
||
| 16 | { |
||
| 17 | public const DEFAULT_STRATEGY = ClassMetadata::STORAGE_STRATEGY_PUSH_ALL; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Returns whether update query must be included in query updating owning document. |
||
| 21 | */ |
||
| 22 | 267 | public static function isAtomic(string $strategy) : bool |
|
| 23 | { |
||
| 24 | 267 | return $strategy === ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET || $strategy === ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET_ARRAY; |
|
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Returns whether Collection hold associative array. |
||
| 29 | */ |
||
| 30 | 203 | public static function isHash(string $strategy) : bool |
|
| 31 | { |
||
| 32 | 203 | return $strategy === ClassMetadata::STORAGE_STRATEGY_SET || $strategy === ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET; |
|
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Returns whether Collection hold array indexed by consecutive numbers. |
||
| 37 | */ |
||
| 38 | 395 | public static function isList(?string $strategy) : bool |
|
| 39 | { |
||
| 40 | 395 | return $strategy !== ClassMetadata::STORAGE_STRATEGY_SET && $strategy !== ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET; |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Returns whether strategy uses $set to update its data. |
||
| 45 | */ |
||
| 46 | 1065 | public static function usesSet(string $strategy) : bool |
|
| 58 | } |
||
| 59 |