تماشای این درس نیاز به اشتراک حرفه‌ای دارد.

In this Larabit, I'll show you how to refactor a series of confusing PHP conditionals into a simple lookup table. To accomplish this, we'll leverage PHP 8's match expression and its ability to handle non identity checks.

As we work on this refactor, we'll also talk briefly about the strategy pattern, and how to extract a factory method to build up the appropriate object. I think you'll enjoy it!

Refactor ConditionalsPHP 8's Match ExpressionStrategies

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟