$propFuncCase
$propFuncCase : string
The property name in "FunctionCase" style.
For example AwesomeProperty
.
Automatically translates a property name into equivalent FunctionCase name.
The translation into a function name will differ based on the style of the property name that was sent in as a parameter. That's intentional.
NOTE
: We support snake_case
and camelCase
property styles. We do NOT
support any other styles or any badly_mixed_Styles
. If you cannot simply
rename your badly named properties to valid names, then you can still access
them via the internal LazyJsonMapper API instead of this magic translation!
WARNING:
We do NOT support property names in "HumpBack" notation, whose first word is
uppercased (even if it sits after leading underscores).
For example, __MessageList
or MessageList
as HumpBack input are invalid,
but __message_list
/message_list
(snake) or __messageList
/messageList
(camel) are valid property names.
We WILL however accept HumpBack input and will provide a translation for it,
but it will NOT be possible for FunctionTranslation
to translate HumpBack
style back to a property name. Just be aware of that! It's intentional, since
HumpBack style is extremely rare and we save processing by not supporting it.
Translation Examples (RESULT LISTED FIRST, then what input was used):
__Foo_Bar__XBaz__
=> __foo__bar___x_baz__
(snake)
__foo_Bar__XBaz__
(camel)0m__AnUn0x
=> 0m___an_un0x
(snake) & 0m__AnUn0x
(camel)Some0XThing
=> some0_x_thing
(snake) & some0XThing
(camel)Some0xThing
=> some0x_thing
(snake) & some0xThing
(camel)SomeThing
=> some_thing
(snake) & someThing
(camel)Something
=> something
(snake & camel identical; no ucwords)___
=> ___
(snake & camel identical; no ucwords)_0
=> _0
(snake & camel identical; no ucwords)_Messages
=> _messages
(snake & camel identical; no ucwords)__MessageList
=> __message_list
(snake) & __messageList
(camel)123
=> 123
(snake & camel identical; no ucwords)123prop
=> 123prop
(snake & camel identical; no ucwords)123Prop
=> 123_prop
(snake) & 123Prop
(camel)NOTE:
The class validates all parameters, but provides public properties to
avoid needless function calls. It's therefore your responsibility to never
assign any bad values to the public properties after this object's creation!
__construct(string $propertyName)
Constructor.
string | $propertyName | The name of the property to translate, in
either |
If the property name is unparseable.
_propToFunctionCase(string $propName) : string
Converts a property name to FunctionCase.
See input/output examples in class documentation above.
string | $propName | The property name, as either |