Skip to content

Instantly share code, notes, and snippets.

@buiquangduc
Created October 7, 2017 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buiquangduc/a756074cc795d6d9def80352adb18662 to your computer and use it in GitHub Desktop.
Save buiquangduc/a756074cc795d6d9def80352adb18662 to your computer and use it in GitHub Desktop.
Routine introduce an intermediate, understandable abstraction
<?php
$person = new Person(1); // Get the person with ID = 1
// We will need to get the fullname of this person
// Replace these bunch of code
$firstName = $person->first_name;
$lastName = $person->last_name;
$fullName = $firstName.' '.$lastName;
// With
$fullName = getFullname($person);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment