mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-18 12:48:41 +00:00
Implement NullCommit
This commit is contained in:
parent
905dbe3b48
commit
a4b6411fcd
27
Utils/Git/NullCommit.php
Normal file
27
Utils/Git/NullCommit.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.2
|
||||
*
|
||||
* @package phpOMS\Utils\Git
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://website.orange-management.de
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\Utils\Git;
|
||||
|
||||
/**
|
||||
* Gray encoding class
|
||||
*
|
||||
* @package phpOMS\Utils\Git
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class NullCommit extends Commit
|
||||
{
|
||||
}
|
||||
|
|
@ -864,8 +864,7 @@ class Repository
|
|||
$count = count($lines);
|
||||
|
||||
if (empty($lines)) {
|
||||
// todo: return null commit
|
||||
return new Commit();
|
||||
return new NullCommit();
|
||||
}
|
||||
|
||||
\preg_match('/[0-9ABCDEFabcdef]{40}/', $lines[0], $matches);
|
||||
|
|
@ -878,10 +877,9 @@ class Repository
|
|||
return new Commit();
|
||||
}
|
||||
|
||||
// todo: validate if array values are all initialized
|
||||
$author = \explode(':', $lines[1]);
|
||||
$author = \explode('<', trim($author[1]));
|
||||
$date = substr($lines[2], 6);
|
||||
$author = \explode(':', $lines[1] ?? '');
|
||||
$author = \explode('<', trim($author[1] ?? ''));
|
||||
$date = substr($lines[2] ?? '', 6);
|
||||
|
||||
$commit = new Commit($matches[0]);
|
||||
$commit->setAuthor(new Author(trim($author[0] ?? ''), rtrim($author[1] ?? '', '>')));
|
||||
|
|
@ -914,8 +912,7 @@ class Repository
|
|||
$lines = $this->run('log -n ' . $limit);
|
||||
|
||||
if (empty($lines)) {
|
||||
// todo: return nullcommit
|
||||
return new Commit();
|
||||
return new NullCommit();
|
||||
}
|
||||
|
||||
\preg_match('/[0-9ABCDEFabcdef]{40}/', $lines[0], $matches);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user