/CarInformation.php Secret
Last active
December 3, 2017 23:48
Factory Pattern - Before apply pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CarInformation | |
{ | |
public function getTitle($code) | |
{ | |
switch ($code) { | |
case 'HC': | |
$vendor = 'Honda'; | |
$model = 'Civic'; | |
$engine = '1.5 VTEC Turbo'; | |
$cv = 182; | |
break; | |
case 'FF': | |
$vendor = 'Ford'; | |
$model = 'Focus'; | |
$engine = '1.0 Ecoboost'; | |
$cv = 125; | |
break; | |
case 'TA': | |
$vendor = 'Toyota'; | |
$model = 'Auris'; | |
$engine = 'Auris 120 T'; | |
$cv = 116; | |
break; | |
} | |
return sprintf( | |
'<b>Model: <\b>\t %s %s\n<b>Engine: <\b>\t %s %sCV', | |
$vendor, $model, $engine, $cv | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment