zebba / utility
Zebba Utility Component
Installs: 1 714
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:component
Requires
- php: >=5.3.1
This package is auto-updated.
Last update: 2024-10-09 07:54:32 UTC
README
Installation
Modify your composer.json:
{ "require" : { "zebba/utility" : "1.*" } }
Usage
ClassUtility
<?php $method = ClassUtility::generateMethodName(ClassUtility::ACCESS_GET, 'foo'); // getFoo $method = ClassUtility::generateMethodName(ClassUtility::ACCESS_SET, 'foo'); // SetFoo $method = ClassUtility::generateMethodName(ClassUtility::ACCESS_GET, 'foo_bar'); // getFooBar $method = ClassUtility::generateMethodName(ClassUtility::ACCESS_GET, 'foo bar'); // getFooBar $method = ClassUtility::generateMethodName(ClassUtility::ACCESS_GET, 'fooBar'); // getFooBar
ParameterConverter
<?php $now = new \DateTime('now'); $period = new \DateInterval('P1D'); try { $datetimes = ParameterConverter::toArray($now, '\DateTime'); // array($now) #$datetimes = ParameterConverter::toArray(array($now, $now, $now), '\DateTime'); // array($now, $now, $now) #$datetimes = ParameterConverter::toArray(array($now, $interval), '\DateTime'); // \DomainException } catch (\DomainException $e) { throw $e; }