<?php
/*
* Copyright (C) 2008 Patrik Fimml
* Copyright (c) 2023 Daniel Marschall
*
* This file is part of glip.
*
* glip is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
* glip is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with glip. If not, see <http://www.gnu.org/licenses/>.
*/
namespace ViaThinkSoft\Glip;
class GitCommitStamp
{
public $name;
public $email;
public $time;
public $offset;
$res = preg_match('/^(.+?)\s+<(.+?)>\s+(\d+)\s+([+-]\d{4})$/', $data, $m);
$this->name = $m[1];
$this->email = $m[2];
$this->offset = ($off / 100) * 3600 + ($off % 100) * 60;
}
if ($this->offset % 60)
throw new \Exception('cannot serialize sub-minute timezone offset');
return sprintf('%s <%s> %d %+05d', $this->name, $this->email, $this->time, ($this->offset / 3600) * 100 + ($this->offset / 60) % 60);
}
}