View on GitHub

RefactoringPHP

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

Move Function (198)

Old Code

<?php
class Customer
{
    public function getPlan()
    {
        return $this->plan;
    }
    public function getDiscountRate()
    {
        return $this->discountRate;
    }
}

New Code

<?php
class Customer
{
    public function getPlan()
    {
        return $this->plan;
    }
    public function getDiscountRate()
    {
        return $this->plan->discountRate;
    }
}