Skip to content

zebba/Utility

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Utility

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;
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages