| Total Complexity | 7 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class IndexingHelper |
||
| 8 | { |
||
| 9 | use Configurable; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @var int Length of each to-index batches |
||
| 13 | */ |
||
| 14 | protected static $batch_length; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var int amount of CPU cores |
||
| 18 | */ |
||
| 19 | protected static $cores; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Check the amount of groups and the total against the isGroup check. |
||
| 23 | * |
||
| 24 | * @param bool $isGroup Is it a specific group |
||
| 25 | * @param string $class Class to check |
||
| 26 | * @param int $group Current group to index |
||
| 27 | * @return array |
||
| 28 | */ |
||
| 29 | public static function getGroupSettings(bool $isGroup, string $class, int $group): array |
||
| 35 | } |
||
| 36 | |||
| 37 | public static function getBatchLength(): int |
||
| 38 | { |
||
| 39 | if (!self::$batch_length) { |
||
| 40 | self::$batch_length = self::config()->get('batchLength') ?? 10; |
||
| 41 | } |
||
| 42 | |||
| 43 | return self::$batch_length; |
||
| 44 | } |
||
| 45 | |||
| 46 | public static function setBatchLength(int $batch_length): void |
||
| 47 | { |
||
| 48 | self::$batch_length = $batch_length; |
||
| 49 | } |
||
| 50 | |||
| 51 | public static function getCores(): int |
||
| 52 | { |
||
| 53 | // Always be on the safe side, use only 1 core |
||
| 54 | return self::$cores ?? 1; |
||
| 55 | } |
||
| 56 | |||
| 57 | public static function setCores(int $cores): void |
||
| 60 | } |
||
| 61 | } |
||
| 62 |