<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Fri, 24 May 2013 17:52:30 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Sameer Borate's Blog: Refactoring 1: Consolidating Conditional Expressions]]></title>
      <guid>http://www.phpdeveloper.org/news/11669</guid>
      <link>http://www.phpdeveloper.org/news/11669</link>
      <description><![CDATA[<p>
<i>Sameer</i> has posted the <a href="http://www.codediesel.com/php/refactoring-1-consolidate-conditional-expression/">first article</a> in his "Refactoring" series today - a look at boiling down conditional expressions to only the logic that are really needed (and maybe replacing it all together).
</p>
<blockquote>
Many times you see a group of conditionals where the returned values are the same. To make the code cleaner you can group the conditionals together using the '&&' or the '||' operators and then extract the code into a separate function. This also has the added benefit that you can reuse the extracted method in other places where the required conditional goes.
</blockquote>
<p>
He shows how abstracting out a file upload permissions check to another function makes it easier to reuse and simpler to understand (an "if" versus multiple "return" statements).
</p>]]></description>
      <pubDate>Mon, 05 Jan 2009 09:31:08 -0600</pubDate>
    </item>
  </channel>
</rss>
