implement int shift

This commit is contained in:
Dennis Eichhorn 2019-08-25 21:44:42 +02:00
parent 1b2705291d
commit 0acef08f09
7 changed files with 71 additions and 23 deletions

View File

@ -39,7 +39,7 @@ final class Huffman
*
* @since 1.0.0
*/
public function getDictionary() /* : ?Dictionary */
public function getDictionary() : ?Dictionary
{
return $this->dictionary;
}
@ -111,7 +111,7 @@ final class Huffman
*/
public function decode(string $raw) : string
{
if (empty($raw)) {
if (empty($raw) || $this->dictionary === null) {
return '';
}

View File

@ -35,26 +35,26 @@ class Commit
/**
* Author.
*
* @var null|Author
* @var Author
* @since 1.0.0
*/
private ?Author $author = null;
private Author $author;
/**
* Branch.
*
* @var null|Branch
* @var Branch
* @since 1.0.0
*/
private ?Branch $branch = null;
private Branch $branch;
/**
* Tag.
*
* @var null|Tag
* @var Tag
* @since 1.0.0
*/
private ?Tag $tag = null;
private Tag $tag;
/**
* Commit date.
@ -67,10 +67,10 @@ class Commit
/**
* Repository.
*
* @var null|Repository
* @var Repository
* @since 1.0.0
*/
private ?Repository $repository = null;
private Repository $repository;
/**
* Commit message.

View File

@ -55,10 +55,10 @@ class Repository
/**
* Current branch.
*
* @var null|Branch
* @var Branch
* @since 1.0.0
*/
private ?Branch $branch = null;
private Branch $branch;
/**
* Constructor
@ -72,6 +72,8 @@ class Repository
if (\is_dir($path)) {
$this->setPath($path);
}
$this->branch = new Branch();
}
/**

46
Utils/NumericUtils.php Normal file
View 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));
}
}

View File

@ -174,8 +174,8 @@ final class StringCompare
*/
public static function fuzzyMatch(
string $s1, string $s2,
float $phraseWeight = 0.5, float $wordWeight = 1,
float $minWeight = 10, float $maxWeight = 1,
float $phraseWeight = 0.5, float $wordWeight = 1.0,
float $minWeight = 10.0, float $maxWeight = 1.0,
float $lengthWeight = -0.3
) : float
{

View File

@ -28,10 +28,10 @@ class Interval implements \Serializable
/**
* Start.
*
* @var null|\DateTime
* @var \DateTime
* @since 1.0.0
*/
private $start = null;
private $start;
/**
* End.
@ -243,7 +243,7 @@ class Interval implements \Serializable
*
* @since 1.0.0
*/
public function getEnd()
public function getEnd() : ?\DateTime
{
return $this->end;
}

View File

@ -59,18 +59,18 @@ abstract class TaskAbstract
/**
* Next runtime
*
* @var null|\DateTime
* @var \DateTime
* @since 1.0.0
*/
protected ?\DateTime $nextRunTime = null;
protected \DateTime $nextRunTime;
/**
* Last runtime
*
* @var null|\DateTime
* @var \DateTime
* @since 1.0.0
*/
protected ?\DateTime $lastRunTime = null;
protected \DateTime $lastRunTime;
/**
* Comment
@ -203,7 +203,7 @@ abstract class TaskAbstract
*
* @since 1.0.0
*/
public function getNextRunTime()
public function getNextRunTime() : \DateTime
{
return $this->nextRunTime;
}
@ -229,7 +229,7 @@ abstract class TaskAbstract
*
* @since 1.0.0
*/
public function getLastRuntime()
public function getLastRuntime() : \DateTime
{
return $this->lastRunTime;
}