diff --git a/.editorconfig b/.editorconfig index a7c44dd..dd9a2b5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,9 +2,9 @@ root = true [*] charset = utf-8 +end_of_line = lf indent_size = 4 indent_style = space -end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true diff --git a/.gitattributes b/.gitattributes index 9e9519b..c09f81e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,6 +9,7 @@ /art export-ignore /docs export-ignore /tests export-ignore +/workbench export-ignore /.editorconfig export-ignore /.php_cs.dist.php export-ignore /psalm.xml export-ignore diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index b4ae1c4..0000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,55 +0,0 @@ -# Contributing - -Contributions are **welcome** and will be fully **credited**. - -Please read and understand the contribution guide before creating an issue or pull request. - -## Etiquette - -This project is open source, and as such, the maintainers give their free time to build and maintain the source code -held within. They make the code freely available in the hope that it will be of use to other developers. It would be -extremely unfair for them to suffer abuse or anger for their hard work. - -Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the -world that developers are civilized and selfless people. - -It's the duty of the maintainer to ensure that all submissions to the project are of sufficient -quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. - -## Viability - -When requesting or submitting new features, first consider whether it might be useful to others. Open -source projects are used by many developers, who may have entirely different needs to your own. Think about -whether or not your feature is likely to be used by other users of the project. - -## Procedure - -Before filing an issue: - -- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. -- Check to make sure your feature suggestion isn't already present within the project. -- Check the pull requests tab to ensure that the bug doesn't have a fix in progress. -- Check the pull requests tab to ensure that the feature isn't already in progress. - -Before submitting a pull request: - -- Check the codebase to ensure that your feature doesn't already exist. -- Check the pull requests to ensure that another person hasn't already submitted the feature or fix. - -## Requirements - -If the project maintainer has any additional requirements, you will find them listed here. - -- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer). - -- **Add tests!** - Your patch won't be accepted if it doesn't have tests. - -- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. - -- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option. - -- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. - -- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. - -**Happy coding**! diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index feca7f5..47e8a1e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,2 @@ github: mohamedsabil83 -custom: ["https://paypal.me/technolizer"] +custom: [ "https://paypal.me/technolizer" ] diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..fe4cfe6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,66 @@ +name: Bug Report +description: Report an Issue or Bug with the Package +title: "[Bug]: " +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + We're sorry to hear you have a problem. Can you help us solve it by providing the following details. + - type: textarea + id: what-happened + attributes: + label: What happened? + description: What did you expect to happen? + placeholder: I cannot currently do X thing because when I do, it breaks X thing. + validations: + required: true + - type: textarea + id: how-to-reproduce + attributes: + label: How to reproduce the bug + description: How did this occur, please add any config values used and provide a set of reliable steps if possible. + placeholder: When I do X I see Y. + validations: + required: true + - type: input + id: package-version + attributes: + label: Package Version + description: What version of our Package are you running? Please be as specific as possible + placeholder: 2.0.0 + validations: + required: true + - type: input + id: php-version + attributes: + label: PHP Version + description: What version of PHP are you running? Please be as specific as possible + placeholder: 8.2.0 + validations: + required: true + - type: input + id: laravel-version + attributes: + label: Laravel Version + description: What version of Laravel are you running? Please be as specific as possible + placeholder: 9.0.0 + validations: + required: true + - type: dropdown + id: operating-systems + attributes: + label: Which operating systems does with happen with? + description: You may select more than one. + multiple: true + options: + - macOS + - Windows + - Linux + - type: textarea + id: notes + attributes: + label: Notes + description: Use this field to provide any other notes that you feel might be relevant to the issue. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 37adb54..667c429 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -9,6 +9,3 @@ contact_links: - name: Report a security issue url: https://github.com/mohamedsabil83/laravel-hijrian/security/policy about: Learn how to notify us for sensitive bugs - - name: Report a bug - url: https://github.com/mohamedsabil83/laravel-hijrian/issues/new - about: Report a reproducable bug diff --git a/.github/SECURITY.md b/.github/SECURITY.md deleted file mode 100644 index 23dd1c3..0000000 --- a/.github/SECURITY.md +++ /dev/null @@ -1,3 +0,0 @@ -# Security Policy - -If you discover any security related issues, please email me@mohamedsabil83.com instead of using the issue tracker. diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 30c8a49..39b1580 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,4 +9,11 @@ updates: schedule: interval: "weekly" labels: - - "dependencies" \ No newline at end of file + - "dependencies" + + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "weekly" + labels: + - "dependencies" diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index ca2197d..70d8e7b 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -8,22 +8,23 @@ permissions: jobs: dependabot: runs-on: ubuntu-latest + timeout-minutes: 5 if: ${{ github.actor == 'dependabot[bot]' }} steps: - + - name: Dependabot metadata id: metadata uses: dependabot/fetch-metadata@v1.6.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - + - name: Auto-merge Dependabot PRs for semver-minor updates if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}} run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - + - name: Auto-merge Dependabot PRs for semver-patch updates if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} run: gh pr merge --auto --merge "$PR_URL" diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/fix-php-code-style-issues.yml similarity index 55% rename from .github/workflows/php-cs-fixer.yml rename to .github/workflows/fix-php-code-style-issues.yml index fbec801..cd4239c 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -1,10 +1,17 @@ -name: Check & fix styling +name: Fix PHP code style issues -on: [push] +on: + push: + paths: + - '**.php' + +permissions: + contents: write jobs: - php-cs-fixer: + php-code-styling: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - name: Checkout code @@ -12,10 +19,8 @@ jobs: with: ref: ${{ github.head_ref }} - - name: Run PHP CS Fixer - uses: docker://oskarstark/php-cs-fixer-ga - with: - args: --config=.php_cs.dist.php --allow-risky=yes + - name: Fix PHP code style issues + uses: aglipanci/laravel-pint-action@2.3.1 - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v5 diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 4f3f936..f495e76 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -5,18 +5,20 @@ on: paths: - '**.php' - 'phpstan.neon.dist' + - '.github/workflows/phpstan.yml' jobs: phpstan: name: phpstan runs-on: ubuntu-latest + timeout-minutes: 5 steps: - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.1' coverage: none - name: Install composer dependencies diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index ac091fc..2ab64ea 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -2,25 +2,25 @@ name: run-tests on: push: - branches: [main] + branches: [ main ] pull_request: - branches: [main] + branches: [ main ] jobs: test: runs-on: ${{ matrix.os }} + timeout-minutes: 5 strategy: fail-fast: true matrix: - os: [ubuntu-latest] - php: [8.1, 8.0] - laravel: [9.*, 8.*] - stability: [prefer-stable] + os: [ ubuntu-latest, windows-latest ] + php: [ 8.3, 8.2, 8.1 ] + laravel: [ 10.* ] + stability: [ prefer-lowest, prefer-stable ] include: - - laravel: 9.* - testbench: 7.* - - laravel: 8.* - testbench: 6.* + - laravel: 10.* + testbench: 8.* + carbon: ^2.63 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -42,8 +42,11 @@ jobs: - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update composer update --${{ matrix.stability }} --prefer-dist --no-interaction + - name: List Installed Dependencies + run: composer show -D + - name: Execute tests - run: vendor/bin/pest + run: vendor/bin/pest --ci diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index 0cdea23..39de30d 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -4,9 +4,13 @@ on: release: types: [released] +permissions: + contents: write + jobs: update: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - name: Checkout code diff --git a/.gitignore b/.gitignore index 9a43686..a7f372d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ .idea -.php_cs -.php_cs.cache -.phpunit.result.cache +.phpunit.cache build composer.lock coverage @@ -11,4 +9,3 @@ phpstan.neon testbench.yaml vendor node_modules -.php-cs-fixer.cache diff --git a/.php_cs.dist.php b/.php_cs.dist.php deleted file mode 100644 index 8d8a790..0000000 --- a/.php_cs.dist.php +++ /dev/null @@ -1,40 +0,0 @@ -in([ - __DIR__ . '/src', - __DIR__ . '/tests', - ]) - ->name('*.php') - ->notName('*.blade.php') - ->ignoreDotFiles(true) - ->ignoreVCS(true); - -return (new PhpCsFixer\Config()) - ->setRules([ - '@PSR12' => true, - 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => ['sort_algorithm' => 'alpha'], - 'no_unused_imports' => true, - 'not_operator_with_successor_space' => true, - 'trailing_comma_in_multiline' => true, - 'phpdoc_scalar' => true, - 'unary_operator_spaces' => true, - 'binary_operator_spaces' => true, - 'blank_line_before_statement' => [ - 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], - ], - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_var_without_name' => true, - 'class_attributes_separation' => [ - 'elements' => [ - 'method' => 'one', - ], - ], - 'method_argument_space' => [ - 'on_multiline' => 'ensure_fully_multiline', - 'keep_multiple_spaces_after_comma' => true, - ], - 'single_trait_insert_per_statement' => true, - ]) - ->setFinder($finder); diff --git a/LICENSE.md b/LICENSE.md index a72ac7e..122f72b 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) mohamedsabil83 +Copyright (c) MohamedSabil83 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 341d97b..cb15029 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ MohamedSabil83 [![Latest Version on Packagist](https://img.shields.io/packagist/v/mohamedsabil83/laravel-hijrian.svg?style=flat-square)](https://packagist.org/packages/mohamedsabil83/laravel-hijrian) -[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/mohamedsabil83/laravel-hijrian/run-tests?label=tests)](https://github.com/mohamedsabil83/laravel-hijrian/actions?query=workflow%3Arun-tests+branch%3Amain) -[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/mohamedsabil83/laravel-hijrian/Check%20&%20fix%20styling?label=code%20style)](https://github.com/mohamedsabil83/laravel-hijrian/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain) +[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/mohamedsabil83/laravel-hijrian/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/mohamedsabil83/laravel-hijrian/actions?query=workflow%3Arun-tests+branch%3Amain) +[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/mohamedsabil83/laravel-hijrian/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/mohamedsabil83/laravel-hijrian/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/mohamedsabil83/laravel-hijrian.svg?style=flat-square)](https://packagist.org/packages/mohamedsabil83/laravel-hijrian) This is a Hijri-Gregory date converter for Laravel 5.8+. It's return a date instance of **carbon**, so, you can make any process related to it. @@ -57,7 +57,7 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re ## Contributing -Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details. +Please see [CONTRIBUTING](CONTRIBUTING.md) for details. ## Security Vulnerabilities diff --git a/composer.json b/composer.json index fcf40ba..b47b0d8 100644 --- a/composer.json +++ b/composer.json @@ -20,20 +20,21 @@ } ], "require": { - "php": "^7.4|^8.0", - "spatie/laravel-package-tools": "^1.9.2", - "illuminate/contracts": "^5.8|^6.0|^7.0|^8.0|^9.0" + "php": "^8.1", + "spatie/laravel-package-tools": "^1.14.0", + "illuminate/contracts": "^10.0" }, "require-dev": { - "nunomaduro/collision": "^5.10|^6.1", - "nunomaduro/larastan": "^1.0|^2.0", - "orchestra/testbench": "^6.23|^7.0", - "pestphp/pest": "^1.21", - "pestphp/pest-plugin-laravel": "^1.1", + "laravel/pint": "^1.0", + "nunomaduro/collision": "^7.8", + "larastan/larastan": "^2.0.1", + "orchestra/testbench": "^8.8", + "pestphp/pest": "^2.20", + "pestphp/pest-plugin-arch": "^2.5", + "pestphp/pest-plugin-laravel": "^2.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5", "spatie/laravel-ray": "^1.26" }, "autoload": { @@ -47,25 +48,35 @@ } }, "scripts": { + "post-autoload-dump": "@composer run prepare", + "clear": "@php vendor/bin/testbench package:purge-laravel-hijrian --ansi", + "prepare": "@php vendor/bin/testbench package:discover --ansi", + "build": [ + "@composer run prepare", + "@php vendor/bin/testbench workbench:build --ansi" + ], + "start": [ + "Composer\\Config::disableProcessTimeout", + "@composer run build", + "@php vendor/bin/testbench serve" + ], "analyse": "vendor/bin/phpstan analyse", "test": "vendor/bin/pest", - "test-coverage": "vendor/bin/pest coverage" + "test-coverage": "vendor/bin/pest --coverage", + "format": "vendor/bin/pint" }, "config": { "sort-packages": true, "allow-plugins": { - "phpstan/extension-installer": true, - "pestphp/pest-plugin": true + "pestphp/pest-plugin": true, + "phpstan/extension-installer": true } }, "extra": { "laravel": { "providers": [ "Mohamedsabil83\\LaravelHijrian\\LaravelHijrianServiceProvider" - ], - "aliases": { - "Hijrian": "Mohamedsabil83\\LaravelHijrian\\Facades\\LaravelHijrian" - } + ] } }, "minimum-stability": "dev", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 19a28c4..9914a5e 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -9,3 +9,4 @@ parameters: checkOctaneCompatibility: true checkModelProperties: true checkMissingIterableValueType: false + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2aa9b91..870a791 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,14 +1,10 @@ - + tests - - ./src - @@ -36,4 +30,9 @@ + + + ./src + + diff --git a/src/Concerns/InteractsWithDates.php b/src/Concerns/InteractsWithDates.php index 12e7989..1b34e6d 100644 --- a/src/Concerns/InteractsWithDates.php +++ b/src/Concerns/InteractsWithDates.php @@ -98,10 +98,9 @@ trait InteractsWithDates /** * Convert Gregorian to Hijri. * - * @param int $year - * @param int $month - * @param int $day - * + * @param int $year + * @param int $month + * @param int $day * @return \Carbon\Carbon */ private static function gth($year, $month, $day) @@ -142,7 +141,7 @@ private static function gth($year, $month, $day) // the MCJDN's of the start of the lunations in the Umm al-Qura calendar are stored in 'islamcalendar_dat.js' $count = count(self::$UQD); - for ($i = 0; $i < $count; ++$i) { + for ($i = 0; $i < $count; $i++) { if (self::$UQD[$i] > $mcjdn) { break; } @@ -197,7 +196,7 @@ private static function gth2($year, $month, $day, $hours, $minutes, $seconds) // the MCJDN's of the start of the lunations in the Umm al-Qura calendar are stored in 'islamcalendar_dat.js' $count = count(self::$UQD); - for ($i = 0; $i < $count; ++$i) { + for ($i = 0; $i < $count; $i++) { if (self::$UQD[$i] > $mcjdn) { break; } @@ -217,10 +216,9 @@ private static function gth2($year, $month, $day, $hours, $minutes, $seconds) /** * Convert Hijri to Gregorian. * - * @param int $year - * @param int $month - * @param int $day - * + * @param int $year + * @param int $month + * @param int $day * @return \Carbon\Carbon */ private static function htg($year, $month, $day) @@ -247,7 +245,6 @@ private static function htg2($year, $month, $day, $hours, $minutes, $seconds) $minutes = (int) $minutes; $seconds = (int) $seconds; - $ii = $year - 1; $iln = ($ii * 12) + 1 + ($month - 1); $i = $iln - 16260; @@ -260,9 +257,9 @@ private static function htg2($year, $month, $day, $hours, $minutes, $seconds) /** * Convert Julian to Gregorian. * - * @param int $date - * + * @param int $date * @return \Carbon\Carbon + * * @source http://keith-wood.name/calendars.html */ private static function jtg($date) diff --git a/src/Facades/LaravelHijrian.php b/src/Facades/Hijrian.php similarity index 65% rename from src/Facades/LaravelHijrian.php rename to src/Facades/Hijrian.php index 61edc17..6ad9464 100644 --- a/src/Facades/LaravelHijrian.php +++ b/src/Facades/Hijrian.php @@ -3,15 +3,15 @@ namespace Mohamedsabil83\LaravelHijrian\Facades; use Illuminate\Support\Facades\Facade; -use Mohamedsabil83\LaravelHijrian\LaravelHijrian as LH; +use Mohamedsabil83\LaravelHijrian\LaravelHijrian; /** * @see \Mohamedsabil83\LaravelHijrian\LaravelHijrian */ -class LaravelHijrian extends Facade +class Hijrian extends Facade { protected static function getFacadeAccessor() { - return LH::class; + return LaravelHijrian::class; } } diff --git a/src/LaravelHijrian.php b/src/LaravelHijrian.php old mode 100644 new mode 100755 index 237e3a5..1f75166 --- a/src/LaravelHijrian.php +++ b/src/LaravelHijrian.php @@ -19,8 +19,7 @@ public function __construct() /** * Return Hijri date. * - * @param string|null $date - * + * @param string|null $date * @return \Carbon\Carbon */ public static function hijri($date = null) @@ -38,8 +37,7 @@ public static function hijriDateTime($date = null) // $time = str_replace('AM','ص',$time); $date = date('Y-m-d', strtotime($date)); - - [$hours, $minutes ,$seconds ] = explode(':', $time); + [$hours, $minutes, $seconds] = explode(':', $time); [$year, $month, $day] = explode('-', self::$date->parse($date)->format('Y-m-d')); return self::gth2((int) $year, (int) $month, (int) $day, (int) $hours, (int) $minutes, (int) $seconds); @@ -48,8 +46,7 @@ public static function hijriDateTime($date = null) /** * Return Gregorian date. * - * @param string|null $date - * + * @param string|null $date * @return \Carbon\Carbon */ public static function gregory($date = null) @@ -65,6 +62,9 @@ public static function gregory($date = null) public static function gregoryDateTime($date = null) { + if (empty($date)) { + return self::$date->now(); + } // check Arabic Date And Replace AM & PM $date = str_replace('م', 'PM', $date); @@ -73,11 +73,7 @@ public static function gregoryDateTime($date = null) $time = date('G:i:s', strtotime($date)); $date = date('Y-m-d', strtotime($date)); - if (empty($date)) { - return self::$date->now(); - } - - [$hours, $minutes ,$seconds ] = explode(':', $time); + [$hours, $minutes, $seconds] = explode(':', $time); [$year, $month, $day] = explode('-', self::$date->parse($date)->format('Y-m-d')); return self::htg2((int) $year, (int) $month, (int) $day, (int) $hours, (int) $minutes, (int) $seconds); diff --git a/src/LaravelHijrianServiceProvider.php b/src/LaravelHijrianServiceProvider.php index ced836a..18eda27 100644 --- a/src/LaravelHijrianServiceProvider.php +++ b/src/LaravelHijrianServiceProvider.php @@ -10,7 +10,6 @@ class LaravelHijrianServiceProvider extends PackageServiceProvider public function configurePackage(Package $package): void { $package - ->name('laravel-hijrian') - ; + ->name('laravel-hijrian'); } } diff --git a/tests/DateTest.php b/tests/DateTest.php index 4685416..17e7ac5 100644 --- a/tests/DateTest.php +++ b/tests/DateTest.php @@ -1,7 +1,7 @@ gregory = '2019-08-09'; @@ -9,17 +9,17 @@ }); it('Convert Gregory To Hijri', function () { - expect(LaravelHijrian::hijri($this->gregory)->format('Y-m-d'))->toEqual($this->hijri); + expect(Hijrian::hijri($this->gregory)->format('Y-m-d'))->toEqual($this->hijri); }); it('Convert Hijri To Gregory', function () { - expect(LaravelHijrian::gregory($this->hijri)->format('Y-m-d'))->toEqual($this->gregory); + expect(Hijrian::gregory($this->hijri)->format('Y-m-d'))->toEqual($this->gregory); }); it('Return A Grogory Date', function () { - expect(LaravelHijrian::gregory())->toBeInstanceOf(Carbon::class); + expect(Hijrian::gregory())->toBeInstanceOf(Carbon::class); }); it('Return A Hijri Date', function () { - expect(LaravelHijrian::hijri())->toBeInstanceOf(Carbon::class); + expect(Hijrian::hijri())->toBeInstanceOf(Carbon::class); });