options(); $b_options = $b->options(); $a_position = $a_options['position'] ?? 9999999999; $b_position = $b_options['position'] ?? 9999999999; if ($a_position == $b_position) return 0; return ($a_position < $b_position) ? -1 : 1; }); // Return Gateways return $gateways; } /** * @return Gateway[] */ public static function enabled(): array { $all = self::all(); $enabled = []; foreach ($all as $key => $gateway) { if (!$gateway->enabled()) continue; $enabled[$key] = $gateway; } return $enabled; } /** * @return Gateway[] */ public static function paid(): array { $all = self::all(); $paid = []; foreach ($all as $key => $gateway) { if (!$gateway->enabled() || $gateway->key() === 'free') continue; $paid[$key] = $gateway; } return $paid; } }