Code Review Part 1: Fixing Design Flaw with the “Return Early” Strategy

By Tonya Mork

While reading Josh Pollock’s first article in his Advanced OOP for WordPress series, I noticed opportunities to improve his code’s quality and performance. So I reached out to him. As a fellow educator, he suggested that I do a code review and then publish my insights in a series of articles here on Torque as a companion to his series.

In this Code Quality Review series, I will present one or more code quality opportunities and provide details and insights to help you improve your code.

Let’s start with the posts_pre_query method in his FilterWPQuery class:

<?php
class FilterWPQuery
{
public static function ...read more

Source:: Torque

No comments