Skip to content

Commit

Permalink
Merge pull request #39 from nguyenanhung/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
nguyenanhung authored Sep 19, 2021
2 parents 73041ab + 48506ed commit 6bf0eaf
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 16 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# GitHub Action for HungNG My Debug
name: Testing HungNG My Debug
on: [ push, pull_request ]
jobs:
build:
strategy:
matrix:
operating-system: [ ubuntu-latest, windows-latest, macos-latest ]
php-versions: [ '7.1', '7.4', '8.0' ]
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 # From https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, curl, dom, pdo, json, session, sockets, openssl
coverage: xdebug #optional
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Test class Logger
run: php ./test/test_logger.php
- name: Test class Utils
run: php ./test/test_utils.php
- name: Test class Benchmark
run: php ./test/test_benchmark.php
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ $mathFunctions = ["abs", "acos", "asin", "atan", "bindec", "floor", "exp", "sin"
$count = 9999;
for ($i = 0; $i < $count; $i++) {
foreach ($mathFunctions as $key => $function) {
call_user_func_array($function, [$i]);
$function($i);
echo ($key + 1) . " -> " . $function . "\n";
}
}
}q
$benchmark->mark('code_end');

dump($benchmark->getVersion());
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
}
],
"require": {
"php": "^7.0||^8.0",
"php": "^7.1 || ^8.0",
"ext-json": "*",
"ext-mbstring": "*",
"monolog/monolog": "^2.3",
"monolog/monolog": "^1.26 || ^2.0",
"cocur/slugify": "^4.0",
"theseer/directoryscanner": "^1.3",
"symfony/filesystem": "^5.3 || ^4.4"
Expand Down
2 changes: 1 addition & 1 deletion src/Manager/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
class File extends Filesystem
{
const VERSION = '3.0.1';
const VERSION = '3.0.2';

/** @var null|array Mảng dữ liệu chứa các thuộc tính cần quét */
private $scanInclude = ['*.log', '*.txt'];
Expand Down
2 changes: 1 addition & 1 deletion src/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
interface Project
{
const VERSION = '3.0.1';
const VERSION = '3.0.2';

/**
* Hàm lấy thông tin phiên bản Packages
Expand Down
4 changes: 2 additions & 2 deletions test/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* Function dump
*
* @param string $str
* @param mixed $str
*
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
Expand All @@ -32,7 +32,7 @@ function dump($str = '')
* @copyright: 713uk13m <[email protected]>
* @time : 08/17/2021 54:17
*/
function testLogPath()
function testLogPath(): string
{
return __DIR__ . '/../storage/logs/';
}
Expand Down
7 changes: 3 additions & 4 deletions test/test_benchmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
$benchmark = new Benchmark();
/***************************** SIMPLE BENCHMARKING BY CI *****************************/
$benchmark->mark('code_start');
$mathFunctions = ["abs", "acos", "asin", "atan", "bindec", "floor", "exp", "sin", "tan", "pi", "is_finite", "is_nan",
"sqrt"];
$count = 9999;
$mathFunctions = ["abs", "acos", "asin", "atan", "floor"];
$count = 10;
for ($i = 0; $i < $count; $i++) {
foreach ($mathFunctions as $key => $function) {
call_user_func_array($function, [$i]);
$function($i);
echo ($key + 1) . " -> " . $function . "\n";
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/test_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

$path = testLogPath();

dump($file->scanAndZip($path, 3));

7 changes: 4 additions & 3 deletions test/test_logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
$name = 'Test';
$msg = 'Test Log lan 2';
$context = [
'name' => 'Nguyen An Hung',
'email' => '[email protected]'
'name' => 'Nguyen An Hung',
'email' => '[email protected]',
'website' => 'https://nguyenanhung.com',
];
// Call
$logger = new Logger();
$logger->setDebugStatus(true);
$logger->setGlobalLoggerLevel(null);
$logger->setGlobalLoggerLevel();
$logger->setLoggerPath($logPath);
$logger->setLoggerSubPath($logSubPath);
$logger->setLoggerFilename($logFilename);
Expand Down

0 comments on commit 6bf0eaf

Please sign in to comment.