| 1 | <?php |
||
| 10 | class Inflector extends BaseInflector |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Format member names according to recommendations for JSON API implementations. |
||
| 14 | * For example, both 'firstName' and 'first_name' will be converted to 'first-name'. |
||
| 15 | * @link http://jsonapi.org/format/#document-member-names |
||
| 16 | * @param $var string |
||
| 17 | * @return string |
||
| 18 | */ |
||
| 19 | public static function var2member($var) |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Converts member names to variable names |
||
| 26 | * All special characters will be replaced by underscore |
||
| 27 | * For example, 'first-name' will be converted to 'first_name' |
||
| 28 | * @param $member string |
||
| 29 | * @return mixed |
||
| 30 | */ |
||
| 31 | public static function member2var($member) |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Converts 'type' member to form name |
||
| 38 | * Will be converted to singular form. |
||
| 39 | * For example, 'articles' will be converted to 'Article' |
||
| 40 | * @param $type string 'type' member of the document |
||
| 41 | * @return string |
||
| 42 | */ |
||
| 43 | public static function type2form($type) |
||
| 47 | } |