public static function sub(DateTime $startDateTime, string $subTypeMethod, string $subType, int $subValue)
    {
        if (! is_callable([$startDateTime, $subTypeMethod])) {
            throw new Exception("Method `{$subTypeMethod}` is not callable on the given start date time instance.");
        }

        $startDateTime = $startDateTime->$subTypeMethod($subValue);

        $period = new static($startDateTime);

        return $period->setFixedDateTimes(false)
            ->setSubType($subType)
            ->setSubValue($subValue);
    }
public static function sub(DateTime $startDateTime, string $subTypeMethod, string $subType, int $subValue)
    {
        if (! is_callable([$startDateTime, $subTypeMethod])) {
            throw new Exception("Method `{$subTypeMethod}` is not callable on the given start date time instance.");
        }

        $startDateTime = $startDateTime->$subTypeMethod($subValue);

        $period = new static($startDateTime);

        return $period->setFixedDateTimes(false)
            ->setSubType($subType)
            ->setSubValue($subValue);
    }
public static function sub ( DateTime $ startDateTime , string $ subTypeMethod , string $ subType , int $ subValue ) { if ( ! is_callable ( [ $ startDateTime , $ subTypeMethod ] ) ) { throw new Exception ( "Method `{$subTypeMethod}` is not callable on the given start date time instance." ) ; } $ startDateTime = $ startDateTime -> $ subTypeMethod ( $ subValue ) ; $ period = new static ( $ startDateTime ) ; return $ period -> setFixedDateTimes ( false ) -> setSubType ( $ subType ) -> setSubValue ( $ subValue ) ; }
Create a new Period instance with a start date time of startDateTime minus the given subType.

Start Date Time: <startDateTime>->sub<subType>(<subValue>);

@param  \DateTime  $startDateTime
@param  string  $subTypeMethod
@param  string  $subType
@param  int  $subValue
@return \CyrildeWit\EloquentViewable\Support\Period|null
Create a new Period instance with a start date time of startDateTime minus the given subType .