Skip to content

Commit 3d2c6b5

Browse files
committed
upsome
1 parent 68d99d8 commit 3d2c6b5

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: shivammathur/setup-php@v2
2424
with:
2525
php-version: ${{ matrix.php}}
26-
tools: pecl, php-cs-fixer, phpunit
26+
tools: pecl, php-cs-fixer, phpunit-7.5
2727
extensions: mbstring, dom, fileinfo, openssl, igbinary # , swoole-4.4.19 #optional, setup extensions
2828
ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration
2929
coverage: none #optional, setup coverage driver: xdebug, none

src/Math.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Toolkit\Stdlib;
4+
5+
use function abs;
6+
use function ceil;
7+
use function floor;
8+
9+
/**
10+
* Class Math
11+
*
12+
* @package Toolkit\Stdlib
13+
*/
14+
class Math
15+
{
16+
/**
17+
* @param int|float $value
18+
*
19+
* @return int
20+
*/
21+
public static function floor($value): int
22+
{
23+
return (int)floor((float)$value);
24+
}
25+
26+
/**
27+
* @param int|float $value
28+
*
29+
* @return int
30+
*/
31+
public static function ceil($value): int
32+
{
33+
return (int)ceil((float)$value);
34+
}
35+
36+
/**
37+
* @param int|float $value
38+
*
39+
* @return int
40+
*/
41+
public static function abs($value): int
42+
{
43+
return (int)abs($value);
44+
}
45+
}

0 commit comments

Comments
 (0)