src/LdapTools/Utilities/ADTimeSpan.php
public static function getInstance($value, $unit)
    {
        if (!array_key_exists($unit, self::UNIT)) {
            throw new InvalidArgumentException('Time unit "%s" is not recognized.', $unit);
        }
        $setter = 'set'.ucfirst($unit);

        return (new self)->$setter($value);
    }
public static function getInstance($value, $unit)
    {
        if (!array_key_exists($unit, self::UNIT)) {
            throw new InvalidArgumentException('Time unit "%s" is not recognized.', $unit);
        }
        $setter = 'set'.ucfirst($unit);

        return (new self)->$setter($value);
    }
public static function getInstance ( $ value , $ unit ) { if ( ! array_key_exists ( $ unit , self :: UNIT ) ) { throw new InvalidArgumentException ( 'Time unit "%s" is not recognized.' , $ unit ) ; } $ setter = 'set' . ucfirst ( $ unit ) ; return ( new self ) -> $ setter ( $ value ) ; }
Get an instance of the class based on a specific time unit as the second parameter.

@param int $value The time value.
@param string $unit The time unit. One of the constants of this class: DAYS, HOURS, MINUTES, SECONDS.
@return $this
Get an instance of the class based on a specific time unit as the second parameter .