src/Everest/Http/Cookie.php
private static function validateExpires($expires) : int
  {
    if (is_numeric($expires)) {
      return (int)$expires;
    }

    // Add intervals to current type
    if ($expires instanceof \DateInterval) {
      $now = new \DateTime('now');
      return (int)$now->add($expires)->format('U');
    }

    if ($expires instanceof \DateTimeInterface) {
      return (int)$expires->format('U');
    } 

    $expires = strtotime($expires);

    if (false === $expires || -1 === $expires) {
       throw new \InvalidArgumentException('The expiration time is not valid.');
    }

    return $expires;
  }
private static function validateExpires($expires) : int
  {
    if (is_numeric($expires)) {
      return (int)$expires;
    }

    // Add intervals to current type
    if ($expires instanceof \DateInterval) {
      $now = new \DateTime('now');
      return (int)$now->add($expires)->format('U');
    }

    if ($expires instanceof \DateTimeInterface) {
      return (int)$expires->format('U');
    } 

    $expires = strtotime($expires);

    if (false === $expires || -1 === $expires) {
       throw new \InvalidArgumentException('The expiration time is not valid.');
    }

    return $expires;
  }
private static function validateExpires ( $ expires ) : int { if ( is_numeric ( $ expires ) ) { return ( int ) $ expires ; } // Add intervals to current type if ( $ expires instanceof \ DateInterval ) { $ now = new \ DateTime ( 'now' ) ; return ( int ) $ now -> add ( $ expires ) -> format ( 'U' ) ; } if ( $ expires instanceof \ DateTimeInterface ) { return ( int ) $ expires -> format ( 'U' ) ; } $ expires = strtotime ( $ expires ) ; if ( false === $ expires || - 1 === $ expires ) { throw new \ InvalidArgumentException ( 'The expiration time is not valid.' ) ; } return $ expires ; }
Convert expiration time to a Unix timestamp

@param  mixed $expire
@return int
Convert expiration time to a Unix timestamp