mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-12 06:48:41 +00:00
implement int shift
This commit is contained in:
parent
1b2705291d
commit
0acef08f09
|
|
@ -39,7 +39,7 @@ final class Huffman
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getDictionary() /* : ?Dictionary */
|
public function getDictionary() : ?Dictionary
|
||||||
{
|
{
|
||||||
return $this->dictionary;
|
return $this->dictionary;
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +111,7 @@ final class Huffman
|
||||||
*/
|
*/
|
||||||
public function decode(string $raw) : string
|
public function decode(string $raw) : string
|
||||||
{
|
{
|
||||||
if (empty($raw)) {
|
if (empty($raw) || $this->dictionary === null) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,26 +35,26 @@ class Commit
|
||||||
/**
|
/**
|
||||||
* Author.
|
* Author.
|
||||||
*
|
*
|
||||||
* @var null|Author
|
* @var Author
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private ?Author $author = null;
|
private Author $author;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Branch.
|
* Branch.
|
||||||
*
|
*
|
||||||
* @var null|Branch
|
* @var Branch
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private ?Branch $branch = null;
|
private Branch $branch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tag.
|
* Tag.
|
||||||
*
|
*
|
||||||
* @var null|Tag
|
* @var Tag
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private ?Tag $tag = null;
|
private Tag $tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Commit date.
|
* Commit date.
|
||||||
|
|
@ -67,10 +67,10 @@ class Commit
|
||||||
/**
|
/**
|
||||||
* Repository.
|
* Repository.
|
||||||
*
|
*
|
||||||
* @var null|Repository
|
* @var Repository
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private ?Repository $repository = null;
|
private Repository $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Commit message.
|
* Commit message.
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,10 @@ class Repository
|
||||||
/**
|
/**
|
||||||
* Current branch.
|
* Current branch.
|
||||||
*
|
*
|
||||||
* @var null|Branch
|
* @var Branch
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private ?Branch $branch = null;
|
private Branch $branch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|
@ -72,6 +72,8 @@ class Repository
|
||||||
if (\is_dir($path)) {
|
if (\is_dir($path)) {
|
||||||
$this->setPath($path);
|
$this->setPath($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->branch = new Branch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
46
Utils/NumericUtils.php
Normal file
46
Utils/NumericUtils.php
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.4
|
||||||
|
*
|
||||||
|
* @package phpOMS\Utils
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://orange-management.org
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace phpOMS\Utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array utils.
|
||||||
|
*
|
||||||
|
* @package phpOMS\Utils
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link https://orange-management.org
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
final class NumericUtils
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*/
|
||||||
|
private function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function uRightShift(int $a, int $b) : int
|
||||||
|
{
|
||||||
|
if ($b === 0) {
|
||||||
|
return $a;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($a >> $b) & ~(1 << (8 * \PHP_INT_SIZE - 1)>>($b - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -174,8 +174,8 @@ final class StringCompare
|
||||||
*/
|
*/
|
||||||
public static function fuzzyMatch(
|
public static function fuzzyMatch(
|
||||||
string $s1, string $s2,
|
string $s1, string $s2,
|
||||||
float $phraseWeight = 0.5, float $wordWeight = 1,
|
float $phraseWeight = 0.5, float $wordWeight = 1.0,
|
||||||
float $minWeight = 10, float $maxWeight = 1,
|
float $minWeight = 10.0, float $maxWeight = 1.0,
|
||||||
float $lengthWeight = -0.3
|
float $lengthWeight = -0.3
|
||||||
) : float
|
) : float
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@ class Interval implements \Serializable
|
||||||
/**
|
/**
|
||||||
* Start.
|
* Start.
|
||||||
*
|
*
|
||||||
* @var null|\DateTime
|
* @var \DateTime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private $start = null;
|
private $start;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End.
|
* End.
|
||||||
|
|
@ -243,7 +243,7 @@ class Interval implements \Serializable
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getEnd()
|
public function getEnd() : ?\DateTime
|
||||||
{
|
{
|
||||||
return $this->end;
|
return $this->end;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,18 +59,18 @@ abstract class TaskAbstract
|
||||||
/**
|
/**
|
||||||
* Next runtime
|
* Next runtime
|
||||||
*
|
*
|
||||||
* @var null|\DateTime
|
* @var \DateTime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected ?\DateTime $nextRunTime = null;
|
protected \DateTime $nextRunTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last runtime
|
* Last runtime
|
||||||
*
|
*
|
||||||
* @var null|\DateTime
|
* @var \DateTime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected ?\DateTime $lastRunTime = null;
|
protected \DateTime $lastRunTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comment
|
* Comment
|
||||||
|
|
@ -203,7 +203,7 @@ abstract class TaskAbstract
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getNextRunTime()
|
public function getNextRunTime() : \DateTime
|
||||||
{
|
{
|
||||||
return $this->nextRunTime;
|
return $this->nextRunTime;
|
||||||
}
|
}
|
||||||
|
|
@ -229,7 +229,7 @@ abstract class TaskAbstract
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getLastRuntime()
|
public function getLastRuntime() : \DateTime
|
||||||
{
|
{
|
||||||
return $this->lastRunTime;
|
return $this->lastRunTime;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user