mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
code fixes
This commit is contained in:
parent
0d200da299
commit
6b74b8d968
|
|
@ -152,13 +152,15 @@ final class JWT
|
|||
}
|
||||
|
||||
try {
|
||||
$header = \json_decode(Base64Url::decode($explode[0]), true);
|
||||
$payload = \json_decode(Base64Url::decode($explode[1]), true);
|
||||
$header = \json_decode(Base64Url::decode($explode[0]), true);
|
||||
$payload = \json_decode(Base64Url::decode($explode[1]), true);
|
||||
|
||||
if (!\is_array($header) || !\is_array($payload)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var array{alg:string, typ:string} $header */
|
||||
/** @var array{sub:string, uid?:string, name?:string, iat:string} $payload */
|
||||
$signature = self::createSignature($secret, $header, $payload);
|
||||
|
||||
return \hash_equals($signature, $explode[2]);
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ class LanguageResult implements \ArrayAccess, \IteratorAggregate, \JsonSerializa
|
|||
if ($offset === null) {
|
||||
$this->result[] = $value;
|
||||
} else {
|
||||
/** @var int $offset */
|
||||
$this->result[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ abstract class NgramParser
|
|||
}
|
||||
}
|
||||
|
||||
/** @var array $tokens */
|
||||
/** @var array|non-empty-array $tokens */
|
||||
foreach ($tokens as $i => $token) {
|
||||
$sum = \array_sum($token);
|
||||
|
||||
|
|
|
|||
|
|
@ -697,11 +697,11 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @param self $B Matrix
|
||||
*
|
||||
* @return int|float|self
|
||||
* @return self
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function dot(self $B) : int|float|self
|
||||
public function dot(self $B) : self
|
||||
{
|
||||
$value1 = $this->matrix;
|
||||
$value2 = $B->getMatrix();
|
||||
|
|
@ -745,7 +745,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
$result += $value1[$i] * $value2[$i];
|
||||
}
|
||||
|
||||
return $result;
|
||||
return self::fromArray([[$result]]);
|
||||
} elseif ($isMatrix1 && !$isMatrix2) {
|
||||
$result = [];
|
||||
for ($i = 0; $i < $m1; ++$i) { // Row of 1
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ final class Vector extends Matrix
|
|||
{
|
||||
$dotProduct = 0.0;
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
$dotProduct += $this->matrix[$i][0] * $v[$i][0];
|
||||
$dotProduct += $this->matrix[$i][0] * $v->matrix[$i][0];
|
||||
}
|
||||
|
||||
$sumOfSquares = 0;
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ final class ArrayUtils
|
|||
* @param string $id Id to find
|
||||
* @param array<string|int, T> $args CLI command list
|
||||
*
|
||||
* @return null|T
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
6
tests/Business/Marketing/ArticleCorrelationAffinityTest.php → tests/Business/Recommendation/ArticleCorrelationAffinityTest.php
Executable file → Normal file
6
tests/Business/Marketing/ArticleCorrelationAffinityTest.php → tests/Business/Recommendation/ArticleCorrelationAffinityTest.php
Executable file → Normal file
|
|
@ -12,12 +12,12 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\tests\Business\Marketing;
|
||||
namespace phpOMS\tests\Business\Recommendation;
|
||||
|
||||
use phpOMS\Business\Marketing\ArticleCorrelationAffinity;
|
||||
use phpOMS\Business\Recommendation\ArticleCorrelationAffinity;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Business\Marketing\ArticleCorrelationAffinityTest: Article affinity/correlation
|
||||
* @testdox phpOMS\tests\Business\Recommendation\ArticleCorrelationAffinityTest: Article affinity/correlation
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
Loading…
Reference in New Issue
Block a user