Created
March 17, 2011 19:01
-
-
Save josegonzalez/874914 to your computer and use it in GitHub Desktop.
PHP Variables, method names, and class names are ridiculous
This file contains hidden or 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 | |
$classMap = array( | |
'AggregateRecordSales' => 'band_id', | |
'BandInfoDaily' => 'team_id', | |
'DivisionStandings' => 'team_id', | |
'TeambandPriceCache' => 'teamband_id', | |
); | |
$baseClassVar = 'baseClass'; | |
$inflection = 'inflect'; | |
foreach ($classMap as $baseClass => $fieldName) { | |
${Inflector::pluralize(Inflector::underscore($baseClass))} = ${$$baseClassVar . 'Peer'}::${'retrieveBy' . Inflector::camelize($fieldName)}(${'some' . Inflector::camelize(substr($fieldName, -2))}); | |
} |
did you forget '$' in $Inflector::camelize(fieldName)
no thats a static class
wait
hahaha, cool
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No lol, I was screwing around with php and variable variables. Would be AWESOME though, no?
For the record, that Inflector class is ported from CakePHP to be framework agnostic and fully static.