Jyxo\Time\Time::now PHP Method

now() public static method

Returns an instance with the current date/time.
public static now ( ) : self
return self
    public static function now() : self
    {
        return new self(time());
    }

Usage Example

Example #1
0
File: Sender.php Project: jyxo/php
 /**
  * Creates an email.
  */
 private function create()
 {
     $uniqueId = md5(uniqid((string) time()));
     $hostname = $this->clearHeaderValue($this->getHostname());
     // Unique email Id
     $this->result->messageId = $uniqueId . '@' . $hostname;
     // Sending time
     $this->result->datetime = \Jyxo\Time\Time::now();
     // Parts boundaries
     $this->boundary = [1 => '====b1' . $uniqueId . '====' . $hostname . '====', 2 => '====b2' . $uniqueId . '====' . $hostname . '===='];
     // Determine the message type
     if (!empty($this->email->attachments)) {
         // Are there any attachments?
         if (!empty($this->email->body->alternative)) {
             // There is an alternative content
             $this->type = self::TYPE_ALTERNATIVE_ATTACHMENTS;
         } else {
             // No alternative content
             $this->type = self::TYPE_ATTACHMENTS;
         }
     } else {
         // No attachments
         if (!empty($this->email->body->alternative)) {
             // There is an alternative content
             $this->type = self::TYPE_ALTERNATIVE;
         } else {
             // No alternative content
             $this->type = self::TYPE_SIMPLE;
         }
     }
     // Creates header and body
     $this->createHeader();
     $this->createBody();
 }