View on GitHub

RefactoringPHP

A PHP version of the refactors from Refactoring: Improving the Design of Existing Code (Second Edition) by Martin Fowler

Slide Statements (223)

Old Code

<?php
$pricingPlan = retrievePricingPlan();
$order = retrieveOrder();
$charge = null;
$chargePerUnit = $pricingPlan->unit;

New Code

<?php
$pricingPlan = retrievePricingPlan();
$chargePerUnit = $pricingPlan->unit;
$order = retrieveOrder();
$charge = null;