diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..85ff30c
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,12 @@
+*.php text eol=lf
+*.phpt text eol=lf
+/composer.lock export-ignore
+/.github/ export-ignore
+/tests export-ignore
+/tools export-ignore
+/.gitattributes export-ignore
+/.gitignore export-ignore
+/.php-cs-fixer.php export-ignore
+/baseline.xml export-ignore
+/phpstan.neon export-ignore
+/phpunit.xml export-ignore
\ No newline at end of file
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..07c5e96
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,33 @@
+
+
Change Log
+
+
Added
+
+
+
+
Fixed
+
+
+
+
Changed
+
+
+
+
Removed
+
+
+
+
Deprecated
+
+
+
+
Security
+
+
+
+
+
+
+
Description
+
+
\ No newline at end of file
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..12f28b4
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,6 @@
+version: 2
+updates:
+ - package-ecosystem: "composer"
+ directory: "/"
+ schedule:
+ interval: "daily"
\ No newline at end of file
diff --git a/.github/workflows/changelog-release.yml b/.github/workflows/changelog-release.yml
new file mode 100644
index 0000000..bb9608a
--- /dev/null
+++ b/.github/workflows/changelog-release.yml
@@ -0,0 +1,31 @@
+name: "Changelog - Release Unreleased"
+
+###################################################################
+# WARNING - THIS ACTION WILL PUSH COMMIT DIRECTLY INTO REPOSITORY #
+###################################################################
+
+on:
+ push:
+ tags:
+ - '*'
+
+jobs:
+ changelog-release-unreleased:
+ name: "Update Changelog - Release Unreleased"
+
+ runs-on: "ubuntu-latest"
+
+ steps:
+ - name: "Get tag name"
+ id: "tag-name"
+ run: |
+ tag=$(echo ${{ github.event.ref }} | cut -c11-)
+ echo "::set-output name=tag::$tag"
+
+ - name: "Update CHANGELOG"
+ uses: "docker://aeonphp/automation:latest"
+ env:
+ AEON_AUTOMATION_GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
+ with:
+ entrypoint: "/composer/vendor/bin/automation"
+ args: "changelog:release:unreleased ${{ github.repository }} CHANGELOG.md ${{ steps.tag-name.outputs.tag }} --github-file-changelog-update"
diff --git a/.github/workflows/changelog-update.yml b/.github/workflows/changelog-update.yml
new file mode 100644
index 0000000..f00f848
--- /dev/null
+++ b/.github/workflows/changelog-update.yml
@@ -0,0 +1,38 @@
+name: "Changelog - Update Unreleased"
+
+###################################################################
+# WARNING - THIS ACTION WILL PUSH COMMIT DIRECTLY INTO REPOSITORY #
+###################################################################
+
+on:
+ push:
+ branches:
+ - 5.x
+
+jobs:
+ changelog-update-unreleased:
+ name: "Changelog - Update Unreleased"
+
+ runs-on: "ubuntu-latest"
+
+ steps:
+ - name: "Checkout"
+ uses: "actions/checkout@v2"
+
+ - name: "Restore Automation cache"
+ uses: "actions/cache@v4"
+ with:
+ path: |
+ cache
+ key: "${{ runner.os }}-automation-${{ hashFiles('**/CHANGELOG.md') }}"
+ restore-keys: |
+ ${{ runner.os }}-automation-
+
+ - name: "Update CHANGELOG"
+ uses: "docker://aeonphp/automation:latest"
+ env:
+ AEON_AUTOMATION_GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
+ EON_AUTOMATION_CACHE_DIR: "/github/workspace/cache"
+ with:
+ entrypoint: "/composer/vendor/bin/automation"
+ args: "changelog:generate ${{ github.repository }} --github-file-update-path=CHANGELOG.md --skip-from=\"dependabot[bot]\" --skip-from=\"aeon-automation\""
diff --git a/.github/workflows/pull-request-description-check.yml b/.github/workflows/pull-request-description-check.yml
new file mode 100644
index 0000000..f624146
--- /dev/null
+++ b/.github/workflows/pull-request-description-check.yml
@@ -0,0 +1,20 @@
+name: "Pull Request Description Check"
+
+on:
+ pull_request:
+ types: ["opened", "edited", "reopened", "ready_for_review"]
+
+jobs:
+ pull-request-description-check:
+ name: "Pull Request Description"
+
+ runs-on: "ubuntu-latest"
+
+ steps:
+ - name: "Pull Request Description - Check"
+ uses: "docker://aeonphp/automation:latest"
+ env:
+ AEON_AUTOMATION_GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
+ with:
+ entrypoint: "/composer/vendor/bin/automation"
+ args: "pull-request:description:check ${{ github.repository }} ${{ github.event.pull_request.number }} --skip-from=\"dependabot[bot]\""
\ No newline at end of file
diff --git a/.github/workflows/release-description-update.yml b/.github/workflows/release-description-update.yml
new file mode 100644
index 0000000..c2db558
--- /dev/null
+++ b/.github/workflows/release-description-update.yml
@@ -0,0 +1,25 @@
+name: "Release - Description Update"
+
+#########################################################
+# WARNING - THIS ACTION WILL UPDATE RELEASE DESCRIPTION #
+#########################################################
+
+on:
+ release:
+ types:
+ - created
+
+jobs:
+ release-description-update:
+ name: "Release - Description Update"
+
+ runs-on: "ubuntu-latest"
+
+ steps:
+ - name: "Update CHANGELOG"
+ uses: "docker://aeonphp/automation:latest"
+ env:
+ AEON_AUTOMATION_GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
+ with:
+ entrypoint: "/composer/vendor/bin/automation"
+ args: "changelog:generate ${{ github.repository }} --tag=${{ github.event.release.tag_name }} --github-release-update --skip-from=\"dependabot[bot]\" --skip-from=\"aeon-automation\""
diff --git a/.github/workflows/static-analyze.yml b/.github/workflows/static-analyze.yml
new file mode 100644
index 0000000..f637e81
--- /dev/null
+++ b/.github/workflows/static-analyze.yml
@@ -0,0 +1,65 @@
+name: "Static Analyze"
+
+on:
+ pull_request:
+ push:
+ branches:
+ - "5.x"
+ schedule:
+ - cron: '0 8 * * *'
+
+jobs:
+ compatibility:
+ name: "Static Analyze"
+
+ runs-on: ${{ matrix.operating-system }}
+
+ strategy:
+ matrix:
+ dependencies:
+ - "locked"
+ php-version:
+ - "8.3"
+ operating-system:
+ - "ubuntu-latest"
+
+ steps:
+ - name: "Checkout"
+ uses: "actions/checkout@v2"
+
+ - name: "Install PHP"
+ uses: "shivammathur/setup-php@v2"
+ with:
+ coverage: "pcov"
+ php-version: "${{ matrix.php-version }}"
+ ini-values: memory_limit=-1
+ tools: composer:v2
+
+ - name: "Get Composer Cache Directory"
+ id: composer-cache
+ run: |
+ echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: "Cache Composer dependencies"
+ uses: "actions/cache@v4"
+ with:
+ path: |
+ ${{ steps.composer-cache.outputs.dir }}
+ key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.lock') }}"
+ restore-keys: |
+ php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
+
+ - name: "Install lowest dependencies"
+ if: ${{ matrix.dependencies == 'lowest' }}
+ run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
+
+ - name: "Install highest dependencies"
+ if: ${{ matrix.dependencies == 'highest' }}
+ run: "composer update --no-interaction --no-progress --no-suggest"
+
+ - name: "Install locked dependencies"
+ if: ${{ matrix.dependencies == 'locked' }}
+ run: "composer install --no-interaction --no-progress --no-suggest"
+
+ - name: "Static Analyze"
+ run: "composer static:analyze"
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..9a8e097
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,69 @@
+name: "Tests"
+
+on:
+ pull_request:
+ push:
+ branches:
+ - "5.x"
+ schedule:
+ - cron: '0 8 * * *'
+
+jobs:
+ compatibility:
+ name: "Tests"
+
+ runs-on: ${{ matrix.operating-system }}
+
+ strategy:
+ matrix:
+ dependencies:
+ - "locked"
+ - "lowest"
+ - "highest"
+ php-version:
+ - "8.3"
+ - "8.4"
+ - "8.5"
+ operating-system:
+ - "ubuntu-latest"
+
+ steps:
+ - name: "Checkout"
+ uses: "actions/checkout@v2"
+
+ - name: "Install PHP"
+ uses: "shivammathur/setup-php@v2"
+ with:
+ coverage: "pcov"
+ php-version: "${{ matrix.php-version }}"
+ ini-values: memory_limit=-1
+ tools: composer:v2
+
+ - name: "Get Composer Cache Directory"
+ id: composer-cache
+ run: |
+ echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: "Cache Composer dependencies"
+ uses: "actions/cache@v4"
+ with:
+ path: |
+ ${{ steps.composer-cache.outputs.dir }}
+ key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.lock') }}"
+ restore-keys: |
+ php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
+
+ - name: "Install lowest dependencies"
+ if: ${{ matrix.dependencies == 'lowest' }}
+ run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
+
+ - name: "Install highest dependencies"
+ if: ${{ matrix.dependencies == 'highest' }}
+ run: "composer update --no-interaction --no-progress --no-suggest"
+
+ - name: "Install locked dependencies"
+ if: ${{ matrix.dependencies == 'locked' }}
+ run: "composer install --no-interaction --no-progress --no-suggest"
+
+ - name: "Tests"
+ run: "composer test"
diff --git a/.gitignore b/.gitignore
index 4cda1c1..c2ab8cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
vendor/
bin/
-composer.lock
\ No newline at end of file
+var/
+composer.lock
diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
new file mode 100644
index 0000000..66ddb29
--- /dev/null
+++ b/.php-cs-fixer.php
@@ -0,0 +1,224 @@
+files()
+ ->in([
+ __DIR__ . '/src',
+ __DIR__ . '/tests',
+ ]);
+
+if (!\file_exists(__DIR__ . '/var')) {
+ \mkdir(__DIR__ . '/var');
+}
+
+/**
+ * This configuration was taken from https://github.com/sebastianbergmann/phpunit/blob/master/.php_cs.dist
+ * and slightly adjusted.
+ */
+$config = new PhpCsFixer\Config();
+
+return $config
+ ->setRiskyAllowed(true)
+ ->setCacheFile(__DIR__.'/var/.php_cs.cache')
+ ->setRules([
+ 'align_multiline_comment' => true,
+ 'array_indentation' => true,
+ 'array_syntax' => ['syntax' => 'short'],
+ 'blank_line_after_namespace' => true,
+ 'blank_line_before_statement' => [
+ 'statements' => [
+ 'break',
+ 'continue',
+ 'declare',
+ 'default',
+ 'do',
+ 'exit',
+ 'for',
+ 'foreach',
+ 'goto',
+ 'if',
+ 'include',
+ 'include_once',
+ 'require',
+ 'require_once',
+ 'return',
+ 'switch',
+ 'throw',
+ 'try',
+ 'while',
+ ],
+ ],
+ 'braces' => true,
+ 'cast_spaces' => true,
+ 'class_attributes_separation' => ['elements' => ['const'=>'one', 'method'=>'one', 'property'=>'one']],
+ 'combine_consecutive_issets' => true,
+ 'combine_consecutive_unsets' => true,
+ 'compact_nullable_typehint' => true,
+ 'concat_space' => ['spacing' => 'one'],
+ 'constant_case' => true,
+ 'declare_equal_normalize' => ['space' => 'none'],
+ 'declare_strict_types' => true,
+ 'dir_constant' => true,
+ 'elseif' => true,
+ 'encoding' => true,
+ 'echo_tag_syntax' => true,
+ 'explicit_indirect_variable' => true,
+ 'explicit_string_variable' => true,
+ 'full_opening_tag' => true,
+ 'fully_qualified_strict_types' => true,
+ 'function_typehint_space' => true,
+ 'function_declaration' => true,
+ 'global_namespace_import' => [
+ 'import_classes' => false,
+ 'import_constants' => false,
+ 'import_functions' => false,
+ ],
+ 'heredoc_to_nowdoc' => true,
+ 'increment_style' => [
+ 'style' => PhpCsFixer\Fixer\Operator\IncrementStyleFixer::STYLE_POST,
+ ],
+ 'indentation_type' => true,
+ 'is_null' => true,
+ 'line_ending' => true,
+ 'list_syntax' => ['syntax' => 'short'],
+ 'logical_operators' => true,
+ 'lowercase_keywords' => true,
+ 'lowercase_static_reference' => true,
+ 'magic_constant_casing' => true,
+ 'magic_method_casing' => true,
+ 'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
+ 'modernize_types_casting' => false,
+ 'multiline_comment_opening_closing' => true,
+ 'multiline_whitespace_before_semicolons' => true,
+ 'native_constant_invocation' => false,
+ 'native_function_casing' => false,
+ 'native_function_invocation' => ['include'=>['@all']],
+ 'native_function_type_declaration_casing' => true,
+ 'new_with_braces' => false,
+ 'no_alias_functions' => true,
+ 'no_alternative_syntax' => true,
+ 'no_blank_lines_after_class_opening' => true,
+ 'no_blank_lines_after_phpdoc' => true,
+ 'no_blank_lines_before_namespace' => false,
+ 'no_closing_tag' => true,
+ 'no_empty_comment' => true,
+ 'no_empty_phpdoc' => true,
+ 'no_empty_statement' => true,
+ 'no_extra_blank_lines' => true,
+ 'no_homoglyph_names' => true,
+ 'no_leading_import_slash' => true,
+ 'no_leading_namespace_whitespace' => true,
+ 'no_mixed_echo_print' => ['use' => 'print'],
+ 'no_multiline_whitespace_around_double_arrow' => true,
+ 'no_null_property_initialization' => true,
+ 'no_php4_constructor' => true,
+ 'no_short_bool_cast' => true,
+ 'no_singleline_whitespace_before_semicolons' => true,
+ 'no_spaces_after_function_name' => true,
+ 'no_spaces_around_offset' => true,
+ 'no_spaces_inside_parenthesis' => true,
+ 'no_superfluous_elseif' => true,
+ 'no_superfluous_phpdoc_tags' => false,
+ 'no_trailing_comma_in_list_call' => true,
+ 'no_trailing_comma_in_singleline_array' => true,
+ 'no_trailing_whitespace' => true,
+ 'no_trailing_whitespace_in_comment' => true,
+ 'no_unneeded_control_parentheses' => true,
+ 'no_unneeded_curly_braces' => true,
+ 'no_unneeded_final_method' => true,
+ 'no_unreachable_default_argument_value' => true,
+ 'no_unset_on_property' => true,
+ 'no_unused_imports' => true,
+ 'no_useless_else' => true,
+ 'no_useless_return' => true,
+ 'no_whitespace_before_comma_in_array' => true,
+ 'no_whitespace_in_blank_line' => true,
+ 'non_printable_character' => true,
+ 'normalize_index_brace' => true,
+ 'object_operator_without_whitespace' => true,
+ 'ordered_class_elements' => [
+ 'order' => [
+ 'use_trait',
+ 'constant_public',
+ 'constant_protected',
+ 'constant_private',
+ 'property_public_static',
+ 'property_protected_static',
+ 'property_private_static',
+ 'property_public',
+ 'property_protected',
+ 'property_private',
+ 'construct',
+ 'method_public_static',
+ 'destruct',
+ 'magic',
+ 'phpunit',
+ 'method_public',
+ 'method_protected',
+ 'method_private',
+ 'method_protected_static',
+ 'method_private_static',
+ ],
+ ],
+ 'ordered_imports' => [
+ 'imports_order' => [
+ PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CONST,
+ PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_FUNCTION,
+ PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CLASS,
+ ]
+ ],
+ 'ordered_interfaces' => [
+ 'direction' => 'ascend',
+ 'order' => 'alpha',
+ ],
+ 'phpdoc_add_missing_param_annotation' => false,
+ 'phpdoc_align' => ['align' => 'left'],
+ 'phpdoc_annotation_without_dot' => true,
+ 'phpdoc_indent' => true,
+ 'phpdoc_no_access' => true,
+ 'phpdoc_no_empty_return' => true,
+ 'phpdoc_no_package' => true,
+ 'phpdoc_order' => true,
+ 'phpdoc_return_self_reference' => true,
+ 'phpdoc_scalar' => true,
+ 'phpdoc_separation' => true,
+ 'phpdoc_single_line_var_spacing' => true,
+ 'phpdoc_summary' => true,
+ 'phpdoc_to_comment' => false,
+ 'phpdoc_trim' => true,
+ 'phpdoc_trim_consecutive_blank_line_separation' => true,
+ 'phpdoc_types' => ['groups' => ['simple', 'meta']],
+ 'phpdoc_types_order' => true,
+ 'phpdoc_var_without_name' => true,
+ 'pow_to_exponentiation' => true,
+ 'protected_to_private' => true,
+ 'return_assignment' => true,
+ 'return_type_declaration' => ['space_before' => 'one'],
+ 'self_accessor' => true,
+ 'self_static_accessor' => true,
+ 'semicolon_after_instruction' => true,
+ 'set_type_to_cast' => true,
+ 'short_scalar_cast' => true,
+ 'simple_to_complex_string_variable' => true,
+ 'simplified_null_return' => false,
+ 'single_blank_line_at_eof' => true,
+ 'single_import_per_statement' => true,
+ 'single_line_after_imports' => true,
+ 'single_quote' => true,
+ 'standardize_not_equals' => true,
+ 'strict_param' => true,
+ 'ternary_to_null_coalescing' => true,
+ 'trailing_comma_in_multiline' => true,
+ 'trim_array_spaces' => true,
+ 'unary_operator_spaces' => true,
+ 'visibility_required' => [
+ 'elements' => [
+ 'const',
+ 'method',
+ 'property',
+ ],
+ ],
+ 'void_return' => true,
+ 'whitespace_after_comma_in_array' => true,
+ ])
+ ->setFinder($finder);
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 27cece7..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-language: php
-
-matrix:
- include:
- - php: 5.3
- env: DEPENDENCIES='low'
- - php: 5.3
- - php: 5.4
- - php: 5.5
- - php: 5.6
- - php: hhvm
- allow_failures:
- - env: DEPENDENCIES='low'
-
-before_install:
- - composer self-update
-
-install:
- - export COMPOSER_ROOT_VERSION=dev-master
- - if [ "$DEPENDENCIES" != "low" ]; then composer update; fi;
- - if [ "$DEPENDENCIES" == "low" ]; then composer update --prefer-lowest; fi;
-
-script:
- - ./bin/phpspec run --format=pretty
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..7f89e8d
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,414 @@
+## [5.0.3] - 2025-12-11
+
+### Added
+- [#149](https://github.com/coduo/php-humanizer/pull/149) - **Symfony 8+ support** - [@bpolaszek](https://github.com/bpolaszek)
+- [#149](https://github.com/coduo/php-humanizer/pull/149) - **PHP 8.5 support** - [@bpolaszek](https://github.com/bpolaszek)
+
+### Changed
+- [#141](https://github.com/coduo/php-humanizer/pull/141) - **Update action cache from @v2 to @v4 in Github Action workflows** - [@norberttech](https://github.com/norberttech)
+
+### Fixed
+- [#149](https://github.com/coduo/php-humanizer/pull/149) - **Incorrect nullable types as of PHP 8.4** - [@bpolaszek](https://github.com/bpolaszek)
+- [#139](https://github.com/coduo/php-humanizer/pull/139) - **Readme typo** - [@WatheqAlshowaiter](https://github.com/WatheqAlshowaiter)
+
+### Removed
+- [#149](https://github.com/coduo/php-humanizer/pull/149) - **Removed `composer.lock` from git and added it to `.gitignore` (lock file not required in packages, helps CI to pass)** - [@bpolaszek](https://github.com/bpolaszek)
+
+## [5.0.2] - 2025-02-06
+
+### Added
+- [#138](https://github.com/coduo/php-humanizer/pull/138) - **Add Swedish translations** - [@adevade](https://github.com/adevade)
+
+## [5.0.1] - 2025-01-25
+
+### Fixed
+- [76e7b6](https://github.com/coduo/php-humanizer/commit/76e7b6a7bec97e095b14e7dbfb7aa19ae1cb7fc9) - **failing tests** - [@norberttech](https://github.com/norberttech)
+
+### Updated
+- [fb621f](https://github.com/coduo/php-humanizer/commit/fb621fda3e73428af8bba55f697c51daf002580b) - **project to PHP 8.4** - [@norberttech](https://github.com/norberttech)
+
+### Removed
+- [#136](https://github.com/coduo/php-humanizer/pull/136) - **symfony/yaml dependency** - [@norberttech](https://github.com/norberttech)
+
+## [5.0.0] - 2024-04-11
+
+### Added
+- [#133](https://github.com/coduo/php-humanizer/pull/133) - **Slovak translation added for Oxford and Datetime** - [@jerony-mo](https://github.com/jerony-mo)
+- [#133](https://github.com/coduo/php-humanizer/pull/133) - **Czech translation added for Oxford and Datetime** - [@jerony-mo](https://github.com/jerony-mo)
+
+### Changed
+- [#131](https://github.com/coduo/php-humanizer/pull/131) - **Using the assertSame to make assert equals restricted.** - [@peter279k](https://github.com/peter279k)
+
+### Fixed
+- [90efee](https://github.com/coduo/php-humanizer/commit/90efee54b12d083d7d4ec62d52cdb7f2a5c9641d) - **development tools dependencies configuration** - [@norberttech](https://github.com/norberttech)
+- [fe058c](https://github.com/coduo/php-humanizer/commit/fe058ca2ecb9aa90f8c688a25a9327b7c2050156) - **static analyze github workflow php version** - [@norberttech](https://github.com/norberttech)
+- [#132](https://github.com/coduo/php-humanizer/pull/132) - **Fix the CI status badge URL.** - [@peter279k](https://github.com/peter279k)
+
+### Updated
+- [b18a11](https://github.com/coduo/php-humanizer/commit/b18a11af5c694d8041fe585d687a6d5c4b8f78db) - **README.md** - [@norberttech](https://github.com/norberttech)
+- [c5023f](https://github.com/coduo/php-humanizer/commit/c5023fa601eca56a39f23e9a8274d80f4a4a6c6a) - **project to latest versio of php and dependencies** - [@norberttech](https://github.com/norberttech)
+
+## [4.0.3] - 2022-06-07
+
+### Added
+- [#129](https://github.com/coduo/php-humanizer/pull/129) - **support for PHP 8.1 and symfony 6 dependencies** - [@norberttech](https://github.com/norberttech)
+
+### Changed
+- [57c6ed](https://github.com/coduo/php-humanizer/commit/57c6ed978f48dc810e5e4540cbec022c57fecb3c) - **Delete FUNDING.yml** - [@norberttech](https://github.com/norberttech)
+
+### Updated
+- [3107e2](https://github.com/coduo/php-humanizer/commit/3107e2b6a568726f4cd40a23847ce1e305c99c95) - **static-analyze.yml** - [@norberttech](https://github.com/norberttech)
+- [6a369d](https://github.com/coduo/php-humanizer/commit/6a369d9f17855736c5f38261f6765d084e177da2) - **tests.yml** - [@norberttech](https://github.com/norberttech)
+
+## [4.0.2] - 2021-06-20
+
+### Changed
+- [fb264c](https://github.com/coduo/php-humanizer/commit/fb264c8fbfb94f7a10272ac9fca576d8aa053b4a) - **Aeon Calendar dependency** - [@norberttech](https://github.com/norberttech)
+- [#126](https://github.com/coduo/php-humanizer/pull/126) - **Using the `assertTrue` to assert expected is `true`.** - [@peter279k](https://github.com/peter279k)
+- [#126](https://github.com/coduo/php-humanizer/pull/126) - **Using the `assertFalse` to assert expected is `false`.** - [@peter279k](https://github.com/peter279k)
+
+## [4.0.1] - 2021-02-27
+
+### Fixed
+- [#125](https://github.com/coduo/php-humanizer/pull/125) - **humanization of time unit less than 1 second** - [@norberttech](https://github.com/norberttech)
+
+## [4.0.0] - 2021-02-25
+
+### Added
+- [0533da](https://github.com/coduo/php-humanizer/commit/0533da67e2a0ff97a8f504ebc8de469eaca150f1) - **more strict php cs fixer rules** - [@norberttech](https://github.com/norberttech)
+- [#123](https://github.com/coduo/php-humanizer/pull/123) - **Relative/Time Unit humanizer** - [@norberttech](https://github.com/norberttech)
+- [#123](https://github.com/coduo/php-humanizer/pull/123) - **TimePeriod humanizer** - [@norberttech](https://github.com/norberttech)
+- [#123](https://github.com/coduo/php-humanizer/pull/123) - **Support for \DateTimeInterface instead of legacy \DateTime in all DateTimeHumanizers** - [@norberttech](https://github.com/norberttech)
+- [#122](https://github.com/coduo/php-humanizer/pull/122) - **phpstan with highest possible requirements** - [@norberttech](https://github.com/norberttech)
+- [#122](https://github.com/coduo/php-humanizer/pull/122) - **psalm with highest possible requirements** - [@norberttech](https://github.com/norberttech)
+- [#122](https://github.com/coduo/php-humanizer/pull/122) - **arguments and return type hinting** - [@norberttech](https://github.com/norberttech)
+- [#122](https://github.com/coduo/php-humanizer/pull/122) - **PHP 8.0 support** - [@norberttech](https://github.com/norberttech)
+- [#122](https://github.com/coduo/php-humanizer/pull/122) - **More precise CS fixer rules** - [@norberttech](https://github.com/norberttech)
+- [#122](https://github.com/coduo/php-humanizer/pull/122) - **Full change log** - [@norberttech](https://github.com/norberttech)
+- [#122](https://github.com/coduo/php-humanizer/pull/122) - **integration with aeon-php/automation** - [@norberttech](https://github.com/norberttech)
+- [#122](https://github.com/coduo/php-humanizer/pull/122) - **Github actions integration** - [@norberttech](https://github.com/norberttech)
+- [#120](https://github.com/coduo/php-humanizer/pull/120) - **test for azerbaijani language** - [@4t87ux8](https://github.com/4t87ux8)
+- [#119](https://github.com/coduo/php-humanizer/pull/119) - **support azerbaijani language** - [@4t87ux8](https://github.com/4t87ux8)
+
+### Changed
+- [#124](https://github.com/coduo/php-humanizer/pull/124) - **load Translator only once for given locale** - [@norberttech](https://github.com/norberttech)
+- [#122](https://github.com/coduo/php-humanizer/pull/122) - **minimum required PHP version ^7.4** - [@norberttech](https://github.com/norberttech)
+- [#118](https://github.com/coduo/php-humanizer/pull/118) - **create azerbaijani translation** - [@4t87ux8](https://github.com/4t87ux8)
+- [fa52e6](https://github.com/coduo/php-humanizer/commit/fa52e6223eef2f19fbd0a290432b5a878317dca2) - **Fixxed issue with symfony translator dependency, upgraded php, phpunit and phpspec dependencies** - [@norberttech](https://github.com/norberttech)
+- [f989a9](https://github.com/coduo/php-humanizer/commit/f989a91d2d90f5d4bf4922ab9fec1674e7fe024e) - **Create FUNDING.yml** - [@norberttech](https://github.com/norberttech)
+- [142689](https://github.com/coduo/php-humanizer/commit/142689763a6aafdd9f1dfbb48db9807bbe027acc) - **Update README.md** - [@norberttech](https://github.com/norberttech)
+- [6255e0](https://github.com/coduo/php-humanizer/commit/6255e022c0ff8767cae6cdb4552d13f5f0df0d65) - **Moved php-cs-fixer to dev dependency where it belongs to** - [@norberttech](https://github.com/norberttech)
+- [4d62db](https://github.com/coduo/php-humanizer/commit/4d62dba187d89bc8276ff6e5364d2dd9a3f2ad5f) - **Migrated from travis-ci.org to travis-ci.com** - [@norberttech](https://github.com/norberttech)
+- [dc528e](https://github.com/coduo/php-humanizer/commit/dc528ebcef31b793e1dd24dbe90f14039361fad1) - **Update README.md** - [@norberttech](https://github.com/norberttech)
+- [1b2787](https://github.com/coduo/php-humanizer/commit/1b2787d28282247b3fe68cd5b9f6bf80f304fa63) - **dev-master branch aliast** - [@norberttech](https://github.com/norberttech)
+
+### Fixed
+- [16074f](https://github.com/coduo/php-humanizer/commit/16074feea40f8d96e2a31d8d18e24425149a6086) - **missing .php_cs configuration file** - [@norberttech](https://github.com/norberttech)
+- [4de08d](https://github.com/coduo/php-humanizer/commit/4de08de0b2463cfc498612a89189385b5de4f66d) - **updating changelog workflow** - [@norberttech](https://github.com/norberttech)
+- [fc3a04](https://github.com/coduo/php-humanizer/commit/fc3a043f6e03bc29e86d0cd58ae3a6b7daf40d69) - **travis configuration** - [@norberttech](https://github.com/norberttech)
+- [#115](https://github.com/coduo/php-humanizer/pull/115) - **composer autoloading deprecation notice; Support symfony 5** - [@brianwozeniak](https://github.com/brianwozeniak)
+
+### Removed
+- [#122](https://github.com/coduo/php-humanizer/pull/122) - **phpspec** - [@norberttech](https://github.com/norberttech)
+- [#122](https://github.com/coduo/php-humanizer/pull/122) - **symfony/config dependency** - [@norberttech](https://github.com/norberttech)
+- [#122](https://github.com/coduo/php-humanizer/pull/122) - **travis CI integration** - [@norberttech](https://github.com/norberttech)
+- [83a180](https://github.com/coduo/php-humanizer/commit/83a1805da9a28a98a0bb932a5236becd44ea79b6) - **php 8.0 from matrix** - [@norberttech](https://github.com/norberttech)
+
+## [3.0.2] - 2019-04-29
+
+### Changed
+- [9d83e5](https://github.com/coduo/php-humanizer/commit/9d83e509dacfd26250ee4c6b0f195affb08cb1e2) - **Moved php-cs-fixer to dev dependency where it belongs to** - [@norberttech](https://github.com/norberttech)
+
+## [3.0.1] - 2019-04-20
+
+### Changed
+- [380428](https://github.com/coduo/php-humanizer/commit/38042820e9ee7ccc76d66f9c480fe8b7f0e8aaf0) - **Update README.md** - [@norberttech](https://github.com/norberttech)
+
+## [3.0.0] - 2019-04-20
+
+### Added
+- [17a5ab](https://github.com/coduo/php-humanizer/commit/17a5ab5243ae1eec2e3d39388bf611088b8fd5e7) - **missing translations** - [@norberttech](https://github.com/norberttech)
+- [#86](https://github.com/coduo/php-humanizer/pull/86) - **test case with 0 at the end of the number** - [@norberttech](https://github.com/norberttech)
+- [#84](https://github.com/coduo/php-humanizer/pull/84) - **PFIGS ordinals** - [@martinbutt](https://github.com/martinbutt)
+
+### Changed
+- [1b2787](https://github.com/coduo/php-humanizer/commit/1b2787d28282247b3fe68cd5b9f6bf80f304fa63) - **dev-master branch aliast** - [@norberttech](https://github.com/norberttech)
+- [14ab74](https://github.com/coduo/php-humanizer/commit/14ab746762acd1856ddd386023128f23935ef119) - **CS Fixes** - [@norberttech](https://github.com/norberttech)
+- [9edceb](https://github.com/coduo/php-humanizer/commit/9edceb2d21fa879e91072308b8bbe3503a346bd2) - **CS Fixes** - [@norberttech](https://github.com/norberttech)
+- [#112](https://github.com/coduo/php-humanizer/pull/112) - **Upgraded thunderer/shortcode dependency to ^0.7** - [@thunderer](https://github.com/thunderer)
+- [#111](https://github.com/coduo/php-humanizer/pull/111) - **Allow later versions of symfony packages** - [@brianwozeniak](https://github.com/brianwozeniak)
+- [#91](https://github.com/coduo/php-humanizer/pull/91) - **Sanity check for NumberFormatter when intl is not installed** - [@thunderer](https://github.com/thunderer)
+- [#40](https://github.com/coduo/php-humanizer/pull/40) - **Romanian translations** - [@a-ungurianu](https://github.com/a-ungurianu)
+- [#106](https://github.com/coduo/php-humanizer/pull/106) - **[master] Add translation: zh_TW** - [@jfcherng](https://github.com/jfcherng)
+- [#104](https://github.com/coduo/php-humanizer/pull/104) - **Feature/update** - [@norberttech](https://github.com/norberttech)
+- [#89](https://github.com/coduo/php-humanizer/pull/89) - **remove unnecessary echo** - [@vinicius73](https://github.com/vinicius73)
+- [#87](https://github.com/coduo/php-humanizer/pull/87) - **Force $binaryPrefixes array ordering on 32-bit systems, fixes #83** - [@Forst](https://github.com/Forst)
+- [5cd850](https://github.com/coduo/php-humanizer/commit/5cd850b49b1ca30811f24c5c1a9b0d6e4cac9fba) - **Update composer.json** - [@norberttech](https://github.com/norberttech)
+- [#85](https://github.com/coduo/php-humanizer/pull/85) - **Support Japanese language** - [@serima](https://github.com/serima)
+
+### Fixed
+- [9b52c5](https://github.com/coduo/php-humanizer/commit/9b52c5dc42f10ff60f4827ff9a736b3a1a18f0e4) - **README.md** - [@norberttech](https://github.com/norberttech)
+- [#80](https://github.com/coduo/php-humanizer/pull/80) - **russian translation** - [@dizzy7](https://github.com/dizzy7)
+
+## [2.0.1] - 2019-02-25
+
+### Changed
+- [#107](https://github.com/coduo/php-humanizer/pull/107) - **[2.0] Add translation: zh_TW** - [@jfcherng](https://github.com/jfcherng)
+
+### Fixed
+- [#108](https://github.com/coduo/php-humanizer/pull/108) - **travis configuration for 2.0 branch** - [@norberttech](https://github.com/norberttech)
+
+## [2.0.0-beta] - 2016-02-21
+
+### Added
+- [#78](https://github.com/coduo/php-humanizer/pull/78) - **ext-inl to composer suggest** - [@norberttech](https://github.com/norberttech)
+- [#68](https://github.com/coduo/php-humanizer/pull/68) - **composer cache folder and move to new infrastructure** - [@norberttech](https://github.com/norberttech)
+
+### Changed
+- [e85d69](https://github.com/coduo/php-humanizer/commit/e85d6905a097f9ba6b2165d9998749eb113d0289) - **Merge pull request #78 from norzechowicz/suggest-intl** - [@norzechowicz](https://github.com/norzechowicz)
+- [#75](https://github.com/coduo/php-humanizer/pull/75) - **Cleanup before stable release** - [@norberttech](https://github.com/norberttech)
+- [f5831e](https://github.com/coduo/php-humanizer/commit/f5831e3be54ca85c9fc14ee5da00b2d6ba1143bb) - **Merge pull request #75 from norzechowicz/cleanup** - [@norzechowicz](https://github.com/norzechowicz)
+- [#73](https://github.com/coduo/php-humanizer/pull/73) - **improve strategy to handle prefix-ordinal** - [@isnani](https://github.com/isnani)
+- [6ec963](https://github.com/coduo/php-humanizer/commit/6ec963fb1c8ecee66feb0228ca5626f1c1ca09f8) - **Merge pull request #73 from isnani/improve-ordinal-strategy** - [@norzechowicz](https://github.com/norzechowicz)
+- [#70](https://github.com/coduo/php-humanizer/pull/70) - **Cleanup** - [@norberttech](https://github.com/norberttech)
+- [dac4b4](https://github.com/coduo/php-humanizer/commit/dac4b43390f320b82728f1e5e0ad45f7c68d591e) - **Merge pull request #70 from norzechowicz/cleanup** - [@norzechowicz](https://github.com/norzechowicz)
+- [#69](https://github.com/coduo/php-humanizer/pull/69) - **Renamed all facades in order to support php7** - [@norberttech](https://github.com/norberttech)
+- [b7214c](https://github.com/coduo/php-humanizer/commit/b7214ce3e0511d5172568aff4a4572a0d80762a1) - **Merge pull request #69 from norzechowicz/php7-support** - [@norzechowicz](https://github.com/norzechowicz)
+- [3f252e](https://github.com/coduo/php-humanizer/commit/3f252ef1a717a841dac1316f835494ef82104cde) - **master branch alias** - [@norberttech](https://github.com/norberttech)
+- [ae6020](https://github.com/coduo/php-humanizer/commit/ae602062f4500488dcbd119b3560a1bdd4fe2699) - **Merge pull request #68 from norzechowicz/travis-ci** - [@norzechowicz](https://github.com/norzechowicz)
+- [7c7e79](https://github.com/coduo/php-humanizer/commit/7c7e79dabc0989dbaf485d46c00d9d836c929f8a) - **Merge pull request #67 from nwatth/thai-translation** - [@norzechowicz](https://github.com/norzechowicz)
+- [#67](https://github.com/coduo/php-humanizer/pull/67) - **Thai translation** - [@nwatth](https://github.com/nwatth)
+
+## [1.0.9] - 2015-12-02
+
+### Added
+- [#54](https://github.com/coduo/php-humanizer/pull/54) - **Ukrainian to the list of languages** - [@Borales](https://github.com/Borales)
+- [d2904a](https://github.com/coduo/php-humanizer/commit/d2904ae1e1ebd79c7b8224aa31bd5aec8d9575a4) - **composer.phar into .gitignore** - [@norberttech](https://github.com/norberttech)
+- [#26](https://github.com/coduo/php-humanizer/pull/26) - **Spanish translation.** - [@orestes](https://github.com/orestes)
+- [#53](https://github.com/coduo/php-humanizer/pull/53) - **Chinese Simplified (zh_CN)** - [@arrowrowe](https://github.com/arrowrowe)
+
+### Changed
+- [#65](https://github.com/coduo/php-humanizer/pull/65) - **Oxford french translation** - [@percymamedy](https://github.com/percymamedy)
+- [b36457](https://github.com/coduo/php-humanizer/commit/b364572a7a73bed0be62a7d2df382fb1ab35cd2a) - **Merge pull request #65 from percymamedy/master** - [@norzechowicz](https://github.com/norzechowicz)
+- [#66](https://github.com/coduo/php-humanizer/pull/66) - **Danish translation** - [@hyperpanic](https://github.com/hyperpanic)
+- [7599dd](https://github.com/coduo/php-humanizer/commit/7599dd847f6b72c6c41f9458cfd92092200644e9) - **Merge pull request #66 from radiosignal/danish-translation** - [@norzechowicz](https://github.com/norzechowicz)
+- [#61](https://github.com/coduo/php-humanizer/pull/61) - **Shortcode removal utilities** - [@thunderer](https://github.com/thunderer)
+- [6bed68](https://github.com/coduo/php-humanizer/commit/6bed6804a97b0489af80ea229616d26a7224b33a) - **Merge pull request #61 from thunderer/string-shortcode-removal** - [@norzechowicz](https://github.com/norzechowicz)
+- [a78a55](https://github.com/coduo/php-humanizer/commit/a78a552671dc51f4393b2806097250d0163eee2f) - **Merge pull request #64 from ddmler/master** - [@norzechowicz](https://github.com/norzechowicz)
+- [#64](https://github.com/coduo/php-humanizer/pull/64) - **German translation** - [@ddmler](https://github.com/ddmler)
+- [3eb227](https://github.com/coduo/php-humanizer/commit/3eb227e710726d04b1905dfc2422370d716611d5) - **Merge pull request #46 from doenietzomoeilijk/master** - [@norzechowicz](https://github.com/norzechowicz)
+- [#46](https://github.com/coduo/php-humanizer/pull/46) - **Refactor Number into separate languages** - [@doenietzomoeilijk](https://github.com/doenietzomoeilijk)
+- [a68dc7](https://github.com/coduo/php-humanizer/commit/a68dc7326b1991161e423812d454bf51f4c15d5e) - **Update README.md** - [@norzechowicz](https://github.com/norzechowicz)
+- [3bcb4b](https://github.com/coduo/php-humanizer/commit/3bcb4b6c204a1d042517bb93e39f45cef1fe8615) - **Merge pull request #54 from Borales/master** - [@norzechowicz](https://github.com/norzechowicz)
+- [#58](https://github.com/coduo/php-humanizer/pull/58) - **Remove composer.phar file** - [@vinkla](https://github.com/vinkla)
+- [216c9b](https://github.com/coduo/php-humanizer/commit/216c9bbd1f173213a5137306faf5a8a04cab315e) - **Merge pull request #55 from hjason/master** - [@norzechowicz](https://github.com/norzechowicz)
+- [5c9bb3](https://github.com/coduo/php-humanizer/commit/5c9bb3393a682126bb8d2d51fcdc77476eef2b83) - **Merge pull request #26 from orestes/es-translation** - [@norzechowicz](https://github.com/norzechowicz)
+- [34ef53](https://github.com/coduo/php-humanizer/commit/34ef53fbd42ee7d33999ca4896ea17c2a1cc8a30) - **Update README.md** - [@norzechowicz](https://github.com/norzechowicz)
+- [51ea67](https://github.com/coduo/php-humanizer/commit/51ea6720069d822a9b9ef8797d708b7205123517) - **Merge pull request #53 from dyweb/master** - [@norzechowicz](https://github.com/norzechowicz)
+
+### Fixed
+- [73e99d](https://github.com/coduo/php-humanizer/commit/73e99d096f9f1bc4f66fbb13fc0a3a6f620f4eea) - **StringTest** - [@hjason2042@gmail.com](#)
+
+## [1.0.8] - 2015-11-06
+
+### Added
+- [#52](https://github.com/coduo/php-humanizer/pull/52) - **Indonesian language** - [@naprirfan](https://github.com/naprirfan)
+- [#41](https://github.com/coduo/php-humanizer/pull/41) - **russian. Add prefix at format difference.** - [@sam002](https://github.com/sam002)
+- [#51](https://github.com/coduo/php-humanizer/pull/51) - **possibility to pass forbidden words into humanizer** - [@norberttech](https://github.com/norberttech)
+- [#49](https://github.com/coduo/php-humanizer/pull/49) - **support for multiple character separators at string humanizer** - [@drgomesp](https://github.com/drgomesp)
+- [#27](https://github.com/coduo/php-humanizer/pull/27) - **Bulgarian translation** - [@lpopov](https://github.com/lpopov)
+- [f65309](https://github.com/coduo/php-humanizer/commit/f6530941c4fb5c109aa593229a3ea3da449b6781) - **the breakpoint in the constructor** - [@smeeckaert](https://github.com/smeeckaert)
+- [798d77](https://github.com/coduo/php-humanizer/commit/798d77d6b864b2d46b4c2487f616ea044f08f92c) - **breakpoint tests** - [@smeeckaert](https://github.com/smeeckaert)
+- [#38](https://github.com/coduo/php-humanizer/pull/38) - **Dutch Oxford translations.** - [@doenietzomoeilijk](https://github.com/doenietzomoeilijk)
+- [#29](https://github.com/coduo/php-humanizer/pull/29) - **Norwegian translation** - [@dagaa](https://github.com/dagaa)
+- [#16](https://github.com/coduo/php-humanizer/pull/16) - **Dutch translation.** - [@Ozmodiar](https://github.com/Ozmodiar)
+
+### Changed
+- [d6e784](https://github.com/coduo/php-humanizer/commit/d6e784a86b6f2318394fd6b8af853e5180d3ab15) - **Merge pull request #52 from naprirfan/master** - [@norzechowicz](https://github.com/norzechowicz)
+- [9d1732](https://github.com/coduo/php-humanizer/commit/9d17321e4259ff8376d5a779c0ad682b4394ae00) - **Merge pull request #47 from mostertb/master** - [@norzechowicz](https://github.com/norzechowicz)
+- [#47](https://github.com/coduo/php-humanizer/pull/47) - **Support for optional explicit BinarySuffix precision** - [@mostertb](https://github.com/mostertb)
+- [a4d68a](https://github.com/coduo/php-humanizer/commit/a4d68a956478bfe84661ca1f8a6c8984aaba741c) - **Merge pull request #41 from sam002/master** - [@norzechowicz](https://github.com/norzechowicz)
+- [#30](https://github.com/coduo/php-humanizer/pull/30) - **TruncateHtml** - [@smeeckaert](https://github.com/smeeckaert)
+- [0465bd](https://github.com/coduo/php-humanizer/commit/0465bd058e9b8c26bf9dc00f38fe14a8473f67b7) - **Merge branch 'master' of git://github.com/smeeckaert/php-humanizer into smeeckaert-master** - [@norberttech](https://github.com/norberttech)
+- [4a6ed1](https://github.com/coduo/php-humanizer/commit/4a6ed1f15345562df1eede367112d06a9fc41ab3) - **Merge pull request #51 from norzechowicz/humanizer-forbidden-words** - [@norzechowicz](https://github.com/norzechowicz)
+- [c0606e](https://github.com/coduo/php-humanizer/commit/c0606e6844a22bc5480a2527d2f043d6a52eb52a) - **Merge pull request #50 from norzechowicz/phpunit** - [@norzechowicz](https://github.com/norzechowicz)
+- [#50](https://github.com/coduo/php-humanizer/pull/50) - **Moved integration tests from phpspec into phpunit** - [@norberttech](https://github.com/norberttech)
+- [0a04e0](https://github.com/coduo/php-humanizer/commit/0a04e02fbf7ba37a2df8b4c3a5f0b93d0ce9f002) - **Merge pull request #49 from drgomesp/support-multiple-character-separator** - [@norzechowicz](https://github.com/norzechowicz)
+- [fe8f03](https://github.com/coduo/php-humanizer/commit/fe8f03731d1349fb24df7eb3d16eeda0b5d6f633) - **Merge pull request #27 from lpopov/master** - [@norzechowicz](https://github.com/norzechowicz)
+- [#44](https://github.com/coduo/php-humanizer/pull/44) - **[ADD] Support PSR-4 Composer** - [@Th3Mouk](https://github.com/Th3Mouk)
+- [75825a](https://github.com/coduo/php-humanizer/commit/75825a8ca318a3d7c523d3d489dd0547ab6a6b23) - **Merge pull request #44 from Th3Mouk/patch-1** - [@norzechowicz](https://github.com/norzechowicz)
+- [#42](https://github.com/coduo/php-humanizer/pull/42) - **Fixes a typo in French** - [@Gnomino](https://github.com/Gnomino)
+- [5bbff0](https://github.com/coduo/php-humanizer/commit/5bbff03cebefdf95eaa4cf9c53905c703a471ae4) - **style** - [@smeeckaert](https://github.com/smeeckaert)
+- [cc7a56](https://github.com/coduo/php-humanizer/commit/cc7a56a09f31a50bf32a329dea7b65c446e53631) - **refacto truncate** - [@smeeckaert](https://github.com/smeeckaert)
+- [a7cb87](https://github.com/coduo/php-humanizer/commit/a7cb8781189fb13d078530a03111bef47af8d04e) - **rename breakpoint len** - [@smeeckaert](https://github.com/smeeckaert)
+- [91d107](https://github.com/coduo/php-humanizer/commit/91d1079d1f6eb88ec784d66e71c88da459ae6e37) - **code style** - [@smeeckaert](https://github.com/smeeckaert)
+- [dac446](https://github.com/coduo/php-humanizer/commit/dac446bb4bb0a959fb39466b3729bc97060f4449) - **refacto visibility and breakpoint** - [@smeeckaert](https://github.com/smeeckaert)
+- [#34](https://github.com/coduo/php-humanizer/pull/34) - **string functions into multibyte string functions** - [@norberttech](https://github.com/norberttech)
+- [#35](https://github.com/coduo/php-humanizer/pull/35) - **Oxford italian translations** - [@omissis](https://github.com/omissis)
+- [#22](https://github.com/coduo/php-humanizer/pull/22) - **Oxford collection + phpcs fixer cleanup.** - [@defrag](https://github.com/defrag)
+- [#33](https://github.com/coduo/php-humanizer/pull/33) - **Truncate check length of append** - [@smeeckaert](https://github.com/smeeckaert)
+- [#31](https://github.com/coduo/php-humanizer/pull/31) - **Addition of Portuguese (pt) language translation (with spec tests)** - [@lightglitch](https://github.com/lightglitch)
+- [8cdeae](https://github.com/coduo/php-humanizer/commit/8cdeaef54f759d7e9a93c85cbf9e6e7b63dd6e76) - **truncate html** - [@smeeckaert](https://github.com/smeeckaert)
+- [#28](https://github.com/coduo/php-humanizer/pull/28) - **Addition of Afrikaans (af) language translation (with spec tests)** - [@sarelvdwalt](https://github.com/sarelvdwalt)
+- [#21](https://github.com/coduo/php-humanizer/pull/21) - **More correct wording for Dutch version of "... from now".** - [@Ozmodiar](https://github.com/Ozmodiar)
+- [1f9243](https://github.com/coduo/php-humanizer/commit/1f924384c5f7b8bfbced89debac2b67b78511f7a) - **Merge pull request #21 from Ozmodiar/nl-translation** - [@norzechowicz](https://github.com/norzechowicz)
+- [f5dafa](https://github.com/coduo/php-humanizer/commit/f5dafa6e721f93306496d3207e646a60c5bb4283) - **Merge pull request #18 from mattallty/patch-1** - [@norzechowicz](https://github.com/norzechowicz)
+- [120f11](https://github.com/coduo/php-humanizer/commit/120f118c7051bdde9e9ea1d442cce6a70dfea8d9) - **Merge pull request #19 from NoUseFreak/composer_install** - [@norzechowicz](https://github.com/norzechowicz)
+- [#19](https://github.com/coduo/php-humanizer/pull/19) - **Update composer installation instructions.** - [@NoUseFreak](https://github.com/NoUseFreak)
+- [158714](https://github.com/coduo/php-humanizer/commit/1587145004b2f97b0562d359ef7c6d46e96295de) - **Merge pull request #16 from Ozmodiar/nl-translation** - [@norzechowicz](https://github.com/norzechowicz)
+- [e49510](https://github.com/coduo/php-humanizer/commit/e49510dfd6e381489cfc5976b5683dba5d5e73da) - **Merge pull request #17 from Ozmodiar/readme-parenthesis** - [@norzechowicz](https://github.com/norzechowicz)
+
+### Fixed
+- [3c3b83](https://github.com/coduo/php-humanizer/commit/3c3b830fad0f6e436a08b3f1adf20334a6a77604) - **doc** - [@smeeckaert](https://github.com/smeeckaert)
+- [#18](https://github.com/coduo/php-humanizer/pull/18) - **typo in french translation** - [@mattallty](https://github.com/mattallty)
+- [#17](https://github.com/coduo/php-humanizer/pull/17) - **parenthesis.** - [@Ozmodiar](https://github.com/Ozmodiar)
+
+## [1.0.7] - 2015-10-26
+
+### Added
+- [#15](https://github.com/coduo/php-humanizer/pull/15) - **spec for Italian translations** - [@norberttech](https://github.com/norberttech)
+- [#14](https://github.com/coduo/php-humanizer/pull/14) - **italian translations.** - [@omissis](https://github.com/omissis)
+
+### Changed
+- [a23b8e](https://github.com/coduo/php-humanizer/commit/a23b8e5b32a1b41e8e0d653a2de77ca090f47f8d) - **Merge pull request #15 from norzechowicz/italian-translations-spec** - [@norzechowicz](https://github.com/norzechowicz)
+- [0db6f5](https://github.com/coduo/php-humanizer/commit/0db6f5d73b46bf8864b3dfc4823b29aeb97dd326) - **Merge pull request #14 from omissis/italian-translations** - [@norzechowicz](https://github.com/norzechowicz)
+- [d05a54](https://github.com/coduo/php-humanizer/commit/d05a5494266fe5bc13e64aaa3c85cb58919fc63f) - **Update README.md** - [@norzechowicz](https://github.com/norzechowicz)
+
+## [1.0.6] - 2015-10-26
+
+### Changed
+- [8d7fff](https://github.com/coduo/php-humanizer/commit/8d7fff6382f60b278ddb069d9088d9d35ce26540) - **Rename difference.pt_br.yml to difference.pt_BR.yml** - [@norzechowicz](https://github.com/norzechowicz)
+
+## [1.0.4] - 2015-10-26
+
+### Added
+- [#10](https://github.com/coduo/php-humanizer/pull/10) - **translation for Portuguese - Brazil** - [@IgorDePaula](https://github.com/IgorDePaula)
+- [c6a594](https://github.com/coduo/php-humanizer/commit/c6a594a57ea3687cb199183b56a232761a81f736) - **specs for FR translations** - [@norberttech](https://github.com/norberttech)
+
+### Changed
+- [6051e8](https://github.com/coduo/php-humanizer/commit/6051e89f3bacd816dced8b3d1cb3a07c1b9b0336) - **Merge pull request #12 from marcamon2013/master** - [@norzechowicz](https://github.com/norzechowicz)
+- [#12](https://github.com/coduo/php-humanizer/pull/12) - **Translation file added** - [@jebog](https://github.com/jebog)
+- [#13](https://github.com/coduo/php-humanizer/pull/13) - **create turkish translation** - [@cnkt](https://github.com/cnkt)
+- [e007db](https://github.com/coduo/php-humanizer/commit/e007dbcccdf56ae2021f13b300f78e2fca628d5b) - **Merge pull request #13 from cnkt/master** - [@norzechowicz](https://github.com/norzechowicz)
+
+### Fixed
+- [8754ad](https://github.com/coduo/php-humanizer/commit/8754ad1f0e680d547c4197cc48d13d7f0b6ab766) - **Translator Builder regexp, added spec and updated readme for pt_BR translation** - [@norberttech](https://github.com/norberttech)
+- [38bc22](https://github.com/coduo/php-humanizer/commit/38bc22377a66d24d3ebda915afa09e83cf3d8581) - **typo in TR translations and added spec** - [@norberttech](https://github.com/norberttech)
+
+## [1.0.3] - 2015-10-24
+
+### Added
+- [9c6a59](https://github.com/coduo/php-humanizer/commit/9c6a59981ca6902644c7c35c8deea1cbc994d7c7) - **German locale specs** - [@norberttech](https://github.com/norberttech)
+
+### Changed
+- [a91217](https://github.com/coduo/php-humanizer/commit/a91217819c7c1d3a0f6a41182784b98681cb6f83) - **Update README.md** - [@norzechowicz](https://github.com/norzechowicz)
+- [c227c3](https://github.com/coduo/php-humanizer/commit/c227c3bfe343ce8322daee67bfb8116add20af1e) - **Rename difference-de.yml to difference.de.yml** - [@norzechowicz](https://github.com/norzechowicz)
+
+## [1.0.2] - 2015-10-24
+
+### Added
+- [#11](https://github.com/coduo/php-humanizer/pull/11) - **german translation** - [@tbreuss](https://github.com/tbreuss)
+
+### Changed
+- [9cb14a](https://github.com/coduo/php-humanizer/commit/9cb14aa8c77d6dc6aaff87770680251c993c0b79) - **Merge pull request #11 from tbreuss/master** - [@norzechowicz](https://github.com/norzechowicz)
+
+## [1.0.1] - 2015-07-14
+
+### Changed
+- [#9](https://github.com/coduo/php-humanizer/pull/9) - **Test lowest version of dependencies** - [@norberttech](https://github.com/norberttech)
+- [97fee0](https://github.com/coduo/php-humanizer/commit/97fee0dbe7999c4305a3de686f9fdc6b3502796e) - **Merge pull request #9 from norzechowicz/test-lowest-dependencies** - [@norzechowicz](https://github.com/norzechowicz)
+- [d97917](https://github.com/coduo/php-humanizer/commit/d979178d45d631d9acd98394b90be3ff345c8c02) - **Update README.md** - [@defrag](https://github.com/defrag)
+- [80500c](https://github.com/coduo/php-humanizer/commit/80500c5c50e45f0346af394e3031307923d59b5f) - **Update README.md** - [@defrag](https://github.com/defrag)
+- [59a604](https://github.com/coduo/php-humanizer/commit/59a6045a716ec63bfb335ea326ce4ee82cf5a4f7) - **Update README.md** - [@defrag](https://github.com/defrag)
+
+## [1.0.0] - 2014-06-12
+
+### Added
+- [#8](https://github.com/coduo/php-humanizer/pull/8) - **missing require for symfony/yaml in composer.json** - [@dedik](https://github.com/dedik)
+- [#4](https://github.com/coduo/php-humanizer/pull/4) - **truncate operation** - [@norberttech](https://github.com/norberttech)
+- [#3](https://github.com/coduo/php-humanizer/pull/3) - **roman converters** - [@defrag](https://github.com/defrag)
+- [#1](https://github.com/coduo/php-humanizer/pull/1) - **number and oridinalize** - [@defrag](https://github.com/defrag)
+- [192a29](https://github.com/coduo/php-humanizer/commit/192a29e78fb2fe8595da1a43580a0a2f7914399c) - **travis configuration** - [@norberttech](https://github.com/norberttech)
+
+### Changed
+- [b5a504](https://github.com/coduo/php-humanizer/commit/b5a504fec092d6d41391a1de6db09eb756e51895) - **Merge pull request #8 from dedik/master** - [@norberttech](https://github.com/norberttech)
+- [673cc6](https://github.com/coduo/php-humanizer/commit/673cc617a158c83056ae7d1647467ef771a4fdbf) - **Update README.md** - [@defrag](https://github.com/defrag)
+- [e5906b](https://github.com/coduo/php-humanizer/commit/e5906b5ea334a52960fab67f465246079fe971e3) - **Update README.md** - [@defrag](https://github.com/defrag)
+- [43ba95](https://github.com/coduo/php-humanizer/commit/43ba95d307ae00d480393cce368491f62deee4f7) - **Merge pull request #7 from defrag/precise-date-fix** - [@norberttech](https://github.com/norberttech)
+- [#6](https://github.com/coduo/php-humanizer/pull/6) - **Precise diffs** - [@defrag](https://github.com/defrag)
+- [08b9d1](https://github.com/coduo/php-humanizer/commit/08b9d1b4f35d3f5846fb187248548d2148a261e5) - **Merge pull request #6 from defrag/precise-diff** - [@norberttech](https://github.com/norberttech)
+- [7438be](https://github.com/coduo/php-humanizer/commit/7438be84cdc9831215bf99f83601ce3c4abfeb1e) - **Merge pull request #5 from norzechowicz/time** - [@defrag](https://github.com/defrag)
+- [#5](https://github.com/coduo/php-humanizer/pull/5) - **[WIP] Introduce time difference humanizer** - [@norberttech](https://github.com/norberttech)
+- [618179](https://github.com/coduo/php-humanizer/commit/618179735f5583ca8d425a8ccf375ce0afd22e55) - **Merge pull request #4 from norzechowicz/truncate** - [@defrag](https://github.com/defrag)
+- [711775](https://github.com/coduo/php-humanizer/commit/71177557d8d4bc7b95e10170c34cd176a8287e38) - **Moved library to Coduo organization** - [@norberttech](https://github.com/norberttech)
+- [6815c6](https://github.com/coduo/php-humanizer/commit/6815c651a7570802ccc5beaf3e6408e6abab1caa) - **Merge pull request #3 from defrag/roman** - [@norberttech](https://github.com/norberttech)
+- [cee3c3](https://github.com/coduo/php-humanizer/commit/cee3c34860042bb93ce73d39ea32fd6b9acef3d1) - **Update readme** - [@norberttech](https://github.com/norberttech)
+- [fda9db](https://github.com/coduo/php-humanizer/commit/fda9db3ef94591e80d627517390c42d688021d7a) - **Merge remote-tracking branch 'origin/master'** - [@norberttech](https://github.com/norberttech)
+- [fd51e9](https://github.com/coduo/php-humanizer/commit/fd51e914d98d28943a34a3fea9237f4a8c6c7e90) - **Metric suffix** - [@norberttech](https://github.com/norberttech)
+- [7b7d4e](https://github.com/coduo/php-humanizer/commit/7b7d4e4453211e1975f3004a74670e6ebdbecb1c) - **Merge pull request #2 from pborreli/typos** - [@norberttech](https://github.com/norberttech)
+- [720bec](https://github.com/coduo/php-humanizer/commit/720becd16f48140d94a983e5eaa6c4e1b9879442) - **Update README.md** - [@norberttech](https://github.com/norberttech)
+- [e62090](https://github.com/coduo/php-humanizer/commit/e62090a6ba103a63718fd17a5d6a0001f007ecac) - **Update README.md** - [@norberttech](https://github.com/norberttech)
+- [d7fd45](https://github.com/coduo/php-humanizer/commit/d7fd45f39377298e35922843cfe004497898cf18) - **Binary suffix converter** - [@norberttech](https://github.com/norberttech)
+- [65564e](https://github.com/coduo/php-humanizer/commit/65564e1202be4e67822e40c366dd36836bdec70a) - **Refactoring** - [@norberttech](https://github.com/norberttech)
+- [58f3d5](https://github.com/coduo/php-humanizer/commit/58f3d560caba8ec66ca57ef66cc3e598ee5eb230) - **Merge pull request #1 from defrag/number** - [@norberttech](https://github.com/norberttech)
+- [35d7e6](https://github.com/coduo/php-humanizer/commit/35d7e69c62e653f2f180b96597002bf143f79ec0) - **String humanize introduction** - [@norberttech](https://github.com/norberttech)
+- [e2bfc6](https://github.com/coduo/php-humanizer/commit/e2bfc680b3f339f6bf2f6e39ce9a17f02eeaebbe) - **Initial commit** - [@norberttech](https://github.com/norberttech)
+
+### Fixed
+- [#7](https://github.com/coduo/php-humanizer/pull/7) - **precise date calculations** - [@defrag](https://github.com/defrag)
+- [#2](https://github.com/coduo/php-humanizer/pull/2) - **typos** - [@pborreli](https://github.com/pborreli)
+
+## Contributors
+
+- @4t87ux8
+- @a-ungurianu
+- @adevade
+- @arrowrowe
+- @Borales
+- @bpolaszek
+- @brianwozeniak
+- @cnkt
+- @dagaa
+- @ddmler
+- @dedik
+- @defrag
+- @dizzy7
+- @doenietzomoeilijk
+- @drgomesp
+- @Forst
+- @Gnomino
+- @hjason2042@gmail.com
+- @hyperpanic
+- @IgorDePaula
+- @isnani
+- @jebog
+- @jerony-mo
+- @jfcherng
+- @lightglitch
+- @lpopov
+- @martinbutt
+- @mattallty
+- @mostertb
+- @naprirfan
+- @norberttech
+- @norzechowicz
+- @NoUseFreak
+- @nwatth
+- @omissis
+- @orestes
+- @Ozmodiar
+- @pborreli
+- @percymamedy
+- @peter279k
+- @sam002
+- @sarelvdwalt
+- @serima
+- @smeeckaert
+- @tbreuss
+- @Th3Mouk
+- @thunderer
+- @vinicius73
+- @vinkla
+- @WatheqAlshowaiter
+
+Generated by [Automation](https://github.com/aeon-php/automation)
\ No newline at end of file
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..6681a3f
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,76 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at norbert+coduo@orzechowicz.pl. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index ee409ba..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,23 +0,0 @@
-#A quick guide to contribute to the project:
-
-##Installing the dev environment
-
-1. Fork the repo
-2. Clone the repo to local
-3. Install dependencies: `composer install` (this assumes you have 'composer' aliased to whereever your composer.phar lives)
-4. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate:
- `./bin/phpspec run --format=pretty`
-
-##The actual contribution
-
-1. Make the changes/additions to the code, committing often and making clear what you've done
-2. Make sure you write tests for your code, located in the folder structure `spec/Coduo/PHPHumanizer/...`
-3. Run your tests (often and while coding): `./bin/phpspec run --format=pretty`
-
-##Coding Standards
-
-Try use similar coding standards to what you see in the project to keep things clear to the contributors. If you're unsure, it's always a safe bet to fall-back to the PSR standards.
-
-[PSR-1: Basic Coding Standard](http://www.php-fig.org/psr/psr-1/)
-
-[PSR-2: Coding Style Guide](http://www.php-fig.org/psr/psr-2/)
diff --git a/LICENSE b/LICENSE
index 6773c8c..aac62ee 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2014 Michal Dabrowski, Norbert Orzechowicz
+Copyright (c) 2014-2021 Michal Dabrowski, Norbert Orzechowicz
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
diff --git a/README.md b/README.md
index b4ba7de..effd462 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,18 @@
-#PHP Humanizer
+# PHP Humanizer
-[](https://travis-ci.org/coduo/php-humanizer)
+[](https://github.com/coduo/php-humanizer/actions/workflows/tests.yml)
[](https://packagist.org/packages/coduo/php-humanizer)
[](https://packagist.org/packages/coduo/php-humanizer)
[](https://packagist.org/packages/coduo/php-humanizer)
[](https://packagist.org/packages/coduo/php-humanizer)
+[Readme for 5.x version](https://github.com/coduo/php-humanizer/tree/5.x/README.md)
+
+
+
Humanize values to make them readable for regular people ;)
-#Installation
+# Installation
Run the following command:
@@ -16,18 +20,18 @@ Run the following command:
composer require coduo/php-humanizer
```
-#Usage
+# Usage
## Text
**Humanize**
```php
-use Coduo\PHPHumanizer\String;
+use Coduo\PHPHumanizer\StringHumanizer;
-echo String::humanize('field_name'); // "Field Name"
-echo String::humanize('user_id'); // "User"
-echo String::humanize('field_name', false); // "field name"
+StringHumanizer::humanize('field_name'); // "Field Name"
+StringHumanizer::humanize('user_id'); // "User id"
+StringHumanizer::humanize('field_name', false); // "field name"
```
**Truncate**
@@ -35,14 +39,14 @@ echo String::humanize('field_name', false); // "field name"
Truncate string to word closest to a certain length
```php
-use Coduo\PHPHumanizer\String;
+use Coduo\PHPHumanizer\StringHumanizer;
$text = 'Lorem ipsum dolorem si amet, lorem ipsum. Dolorem sic et nunc.';
-echo String::truncate($text, 8); // "Lorem ipsum"
-echo String::truncate($text, 8, '...'); // "Lorem ipsum..."
-echo String::truncate($text, 2); // "Lorem"
-echo String::truncate($text, strlen($text)); // "Lorem ipsum dolorem si amet, lorem ipsum. Dolorem sic et nunc."
+StringHumanizer::truncate($text, 8); // "Lorem ipsum"
+StringHumanizer::truncate($text, 8, '...'); // "Lorem ipsum..."
+StringHumanizer::truncate($text, 2); // "Lorem"
+StringHumanizer::truncate($text, strlen($text)); // "Lorem ipsum dolorem si amet, lorem ipsum. Dolorem sic et nunc."
```
@@ -51,104 +55,132 @@ echo String::truncate($text, strlen($text)); // "Lorem ipsum dolorem si amet, lo
Truncate and HTML string to word closest to a certain length
```php
-use Coduo\PHPHumanizer\String;
+use Coduo\PHPHumanizer\StringHumanizer;
$text = '
HyperText Markup Language, commonly referred to as HTML, is the standard markup language used to create web pages.[1]Web browsers can read HTML files and render them into visible or audible web pages. HTML describes the structure of a websitesemantically along with cues for presentation, making it a markup language, rather than a programming language.
';
-echo String::truncateHtml($text, 3); // "HyperText"
-echo String::truncateHtml($text, 12, ''); // "HyperText Markup"
-echo String::truncateHtml($text, 50, '', '...'); // "HyperText Markup Language, commonly referred to as..."
-echo String::truncateHtml($text, 75, '', '...'); // 'HyperText Markup Language, commonly referred to as HTML, is the standard markup...'
+StringHumanizer::truncateHtml($text, 3); // "HyperText"
+StringHumanizer::truncateHtml($text, 12, ''); // "HyperText Markup"
+StringHumanizer::truncateHtml($text, 50, '', '...'); // "HyperText Markup Language, commonly referred to as..."
+StringHumanizer::truncateHtml($text, 75, '', '...'); // 'HyperText Markup Language, commonly referred to as HTML, is the standard markup...'
```
+**Remove shortcodes**
+
+```php
+$text = 'A text with [short]random[/short] [codes]words[/codes].';
+StringHumanizer::removeShortcodes($text); // "A text with ."
+StringHumanizer::removeShortcodeTags($text); // "A text with random words."
+```
+
## Number
**Ordinalize**
```php
-use Coduo\PHPHumanizer\Number;
+use Coduo\PHPHumanizer\NumberHumanizer;
-echo Number::ordinalize(0); // "0th"
-echo Number::ordinalize(1); // "1st"
-echo Number::ordinalize(2); // "2nd"
-echo Number::ordinalize(23); // "23rd"
-echo Number::ordinalize(1002); // "1002nd"
-echo Number::ordinalize(-111); // "-111th"
+NumberHumanizer::ordinalize(0); // "0th"
+NumberHumanizer::ordinalize(1); // "1st"
+NumberHumanizer::ordinalize(2); // "2nd"
+NumberHumanizer::ordinalize(23); // "23rd"
+NumberHumanizer::ordinalize(1002, 'nl'); // "1002e"
+NumberHumanizer::ordinalize(-111); // "-111th"
```
**Ordinal**
```php
-use Coduo\PHPHumanizer\Number;
-
-echo Number::ordinal(0); // "th"
-echo Number::ordinal(1); // "st"
-echo Number::ordinal(2); // "nd"
-echo Number::ordinal(23); // "rd"
-echo Number::ordinal(1002); // "nd"
-echo Number::ordinal(-111); // "th"
+use Coduo\PHPHumanizer\NumberHumanizer;
+
+NumberHumanizer::ordinal(0); // "th"
+NumberHumanizer::ordinal(1); // "st"
+NumberHumanizer::ordinal(2); // "nd"
+NumberHumanizer::ordinal(23); // "rd"
+NumberHumanizer::ordinal(1002); // "nd"
+NumberHumanizer::ordinal(-111, 'nl'); // "e"
```
**Roman numbers**
```php
-use Coduo\PHPHumanizer\Number;
+use Coduo\PHPHumanizer\NumberHumanizer;
-echo Number::toRoman(1); // "I"
-echo Number::toRoman(5); // "V"
-echo Number::toRoman(1300); // "MCCC"
+NumberHumanizer::toRoman(1); // "I"
+NumberHumanizer::toRoman(5); // "V"
+NumberHumanizer::toRoman(1300); // "MCCC"
-echo Number::fromRoman("MMMCMXCIX"); // 3999
-echo Number::fromRoman("V"); // 5
-echo Number::fromRoman("CXXV"); // 125
+NumberHumanizer::fromRoman("MMMCMXCIX"); // 3999
+NumberHumanizer::fromRoman("V"); // 5
+NumberHumanizer::fromRoman("CXXV"); // 125
```
**Binary Suffix**
-```php
-use Coduo\PHPHumanizer\Number;
+Convert a number of bytes in to the highest applicable data unit
-echo Number::binarySuffix(0); // "0 bytes"
-echo Number::binarySuffix(1); // "1 bytes"
-echo Number::binarySuffix(1024); // "1 kB"
-echo Number::binarySuffix(1025); // "1 kB"
-echo Number::binarySuffix(1536); // "1.5 kB"
-echo Number::binarySuffix(1048576 * 5); // "5 MB"
-echo Number::binarySuffix(1073741824 * 2); // "2 GB"
-echo Number::binarySuffix(1099511627776 * 3); // "3 TB"
-echo Number::binarySuffix(1325899906842624); // "1.18 PB"
+```php
+use Coduo\PHPHumanizer\NumberHumanizer;
+
+NumberHumanizer::binarySuffix(0); // "0 bytes"
+NumberHumanizer::binarySuffix(1); // "1 bytes"
+NumberHumanizer::binarySuffix(1024); // "1 kB"
+NumberHumanizer::binarySuffix(1025); // "1 kB"
+NumberHumanizer::binarySuffix(1536); // "1.5 kB"
+NumberHumanizer::binarySuffix(1048576 * 5); // "5 MB"
+NumberHumanizer::binarySuffix(1073741824 * 2); // "2 GB"
+NumberHumanizer::binarySuffix(1099511627776 * 3); // "3 TB"
+NumberHumanizer::binarySuffix(1325899906842624); // "1.18 PB"
```
Number can be also formatted for specific locale
```php
-use Coduo\PHPHumanizer\Number;
+use Coduo\PHPHumanizer\NumberHumanizer;
-echo Number::binarySuffix(1536, 'pl'); // "1,5 kB"
+NumberHumanizer::binarySuffix(1536, 'pl'); // "1,5 kB"
```
-**Metric Suffix**
+Number can also be humanized with a specific number of decimal places with `preciseBinarySuffix($number, $precision, $locale = 'en')`
+The precision parameter must be between 0 and 3.
```php
-use Coduo\PHPHumanizer\Number;
+use Coduo\PHPHumanizer\NumberHumanizer;
-echo Number::metricSuffix(-1); // "-1"
-echo Number::metricSuffix(0); // "0"
-echo Number::metricSuffix(1); // "1"
-echo Number::metricSuffix(101); // "101"
-echo Number::metricSuffix(1000); // "1k"
-echo Number::metricSuffix(1240); // "1.2k"
-echo Number::metricSuffix(1240000); // "1.24M"
-echo Number::metricSuffix(3500000); // "3.5M"
+NumberHumanizer::preciseBinarySuffix(1024, 2); // "1.00 kB"
+NumberHumanizer::preciseBinarySuffix(1325899906842624, 3); // "1.178 PB"
+```
+
+This function also supports locale
+
+```php
+use Coduo\PHPHumanizer\NumberHumanizer;
+
+NumberHumanizer::preciseBinarySuffix(1325899906842624, 3, 'pl'); // "1,178 PB"
+```
+
+**Metric Suffix**
+
+```php
+use Coduo\PHPHumanizer\NumberHumanizer;
+
+NumberHumanizer::metricSuffix(-1); // "-1"
+NumberHumanizer::metricSuffix(0); // "0"
+NumberHumanizer::metricSuffix(1); // "1"
+NumberHumanizer::metricSuffix(101); // "101"
+NumberHumanizer::metricSuffix(1000); // "1k"
+NumberHumanizer::metricSuffix(1240); // "1.2k"
+NumberHumanizer::metricSuffix(1240000); // "1.24M"
+NumberHumanizer::metricSuffix(3500000); // "3.5M"
```
Number can be also formatted for specific locale
```php
-use Coduo\PHPHumanizer\Number;
+use Coduo\PHPHumanizer\NumberHumanizer;
-echo Number::metricSuffix(1240000, 'pl'); // "1,24M"
+NumberHumanizer::metricSuffix(1240000, 'pl'); // "1,24M"
```
## Collections
@@ -156,11 +188,11 @@ echo Number::metricSuffix(1240000, 'pl'); // "1,24M"
**Oxford**
```php
-use Coduo\PHPHumanizer\Collection;
+use Coduo\PHPHumanizer\CollectionHumanizer;
-echo Collection::oxford(['Michal', 'Norbert', 'Lukasz', 'Pawel'], 2); // "Michal, Norbert, and 2 others"
-echo Collection::oxford(['Michal', 'Norbert', 'Lukasz'], 2); // "Michal, Norbert, and 1 other"
-echo Collection::oxford(['Michal', 'Norbert']); // "Michal and Norbert"
+CollectionHumanizer::oxford(['Michal', 'Norbert', 'Lukasz', 'Pawel'], 2); // "Michal, Norbert, and 2 others"
+CollectionHumanizer::oxford(['Michal', 'Norbert', 'Lukasz'], 2); // "Michal, Norbert, and 1 other"
+CollectionHumanizer::oxford(['Michal', 'Norbert']); // "Michal and Norbert"
```
Oxford is using translator component, so you can use whatever string format you like.
@@ -170,38 +202,55 @@ Oxford is using translator component, so you can use whatever string format you
**Difference**
```php
-use Coduo\PHPHumanizer\DateTime;
-
-echo DateTime::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 13:00:00")); // just now
-echo DateTime::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 13:00:05")); // 5 seconds from now
-echo DateTime::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 12:59:00")); // 1 minute ago
-echo DateTime::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 12:45:00")); // 15 minutes ago
-echo DateTime::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 13:15:00")); // 15 minutes from now
-echo DateTime::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 14:00:00")); // 1 hour from now
-echo DateTime::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 15:00:00")); // 2 hours from now
-echo DateTime::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 12:00:00")); // 1 hour ago
-echo DateTime::difference(new \DateTime("2014-04-26"), new \DateTime("2014-04-25")); // 1 day ago
-echo DateTime::difference(new \DateTime("2014-04-26"), new \DateTime("2014-04-24")); // 2 days ago
-echo DateTime::difference(new \DateTime("2014-04-26"), new \DateTime("2014-04-28")); // 2 days from now
-echo DateTime::difference(new \DateTime("2014-04-01"), new \DateTime("2014-04-15")); // 2 weeks from now
-echo DateTime::difference(new \DateTime("2014-04-15"), new \DateTime("2014-04-07")); // 1 week ago
-echo DateTime::difference(new \DateTime("2014-01-01"), new \DateTime("2014-04-01")); // 3 months from now
-echo DateTime::difference(new \DateTime("2014-05-01"), new \DateTime("2014-04-01")); // 1 month ago
-echo DateTime::difference(new \DateTime("2015-05-01"), new \DateTime("2014-04-01")); // 1 year ago
-echo DateTime::difference(new \DateTime("2014-05-01"), new \DateTime("2016-04-01")); // 2 years from now
+use Coduo\PHPHumanizer\DateTimeHumanizer;
+
+DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 13:00:00")); // just now
+DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 13:00:05")); // 5 seconds from now
+DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 12:59:00")); // 1 minute ago
+DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 12:45:00")); // 15 minutes ago
+DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 13:15:00")); // 15 minutes from now
+DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 14:00:00")); // 1 hour from now
+DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 15:00:00")); // 2 hours from now
+DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 12:00:00")); // 1 hour ago
+DateTimeHumanizer::difference(new \DateTime("2014-04-26"), new \DateTime("2014-04-25")); // 1 day ago
+DateTimeHumanizer::difference(new \DateTime("2014-04-26"), new \DateTime("2014-04-24")); // 2 days ago
+DateTimeHumanizer::difference(new \DateTime("2014-04-26"), new \DateTime("2014-04-28")); // 2 days from now
+DateTimeHumanizer::difference(new \DateTime("2014-04-01"), new \DateTime("2014-04-15")); // 2 weeks from now
+DateTimeHumanizer::difference(new \DateTime("2014-04-15"), new \DateTime("2014-04-07")); // 1 week ago
+DateTimeHumanizer::difference(new \DateTime("2014-01-01"), new \DateTime("2014-04-01")); // 3 months from now
+DateTimeHumanizer::difference(new \DateTime("2014-05-01"), new \DateTime("2014-04-01")); // 1 month ago
+DateTimeHumanizer::difference(new \DateTime("2015-05-01"), new \DateTime("2014-04-01")); // 1 year ago
+DateTimeHumanizer::difference(new \DateTime("2014-05-01"), new \DateTime("2016-04-01")); // 2 years from now
```
**Precise difference**
```php
-use Coduo\PHPHumanizer\DateTime;
+use Coduo\PHPHumanizer\DateTimeHumanizer;
+
+DateTimeHumanizer::preciseDifference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-25 11:20:00")); // 1 day, 1 hour, 40 minutes ago
+DateTimeHumanizer::preciseDifference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2015-04-28 17:00:00")); // 1 year, 2 days, 4 hours from now
+DateTimeHumanizer::preciseDifference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2016-04-27 13:00:00")); // 2 years, 1 day from now
+```
-echo DateTime::preciseDifference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-25 11:20:00")); // 1 day, 1 hour, 40 minutes ago
-echo DateTime::preciseDifference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2015-04-28 17:00:00")); // 1 year, 2 days, 4 hours from now
-echo DateTime::preciseDifference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2016-04-27 13:00:00")); // 2 years, 1 day from now
+## Aeon Calendar
+
+[Aeon PHP](https://aeon-php.org/) is a date&time oriented set of libraries.
+
+```php
+use Coduo\PHPHumanizer\DateTimeHumanizer;
+
+$timeUnit = TimeUnit::days(2)
+ ->add(TimeUnit::hours(3))
+ ->add(TimeUnit::minutes(25))
+ ->add(TimeUnit::seconds(30))
+ ->add(TimeUnit::milliseconds(200));
+
+DateTimeHumanizer::timeUnit($timeUnit); // 2 days, 3 hours, 25 minutes, and 30.2 seconds
```
Currently we support following languages:
+* [Azerbaijani](src/Coduo/PHPHumanizer/Resources/translations/difference.az.yml)
* [English](src/Coduo/PHPHumanizer/Resources/translations/difference.en.yml)
* [Polish](src/Coduo/PHPHumanizer/Resources/translations/difference.pl.yml)
* [German](src/Coduo/PHPHumanizer/Resources/translations/difference.de.yml)
@@ -210,6 +259,46 @@ Currently we support following languages:
* [Português - Brasil](src/Coduo/PHPHumanizer/Resources/translations/difference.pt_BR.yml)
* [Italian](src/Coduo/PHPHumanizer/Resources/translations/difference.it.yml)
* [Dutch](src/Coduo/PHPHumanizer/Resources/translations/difference.nl.yml)
+* [Русский](src/Coduo/PHPHumanizer/Resources/translations/difference.ru.yml)
+* [Norwegian](src/Coduo/PHPHumanizer/Resources/translations/difference.no.yml)
+* [Afrikaans](src/Coduo/PHPHumanizer/Resources/translations/difference.af.yml)
+* [Bulgarian](src/Coduo/PHPHumanizer/Resources/translations/difference.bg.yml)
+* [Indonesian](src/Coduo/PHPHumanizer/Resources/translations/difference.id.yml)
+* [Chinese Simplified](src/Coduo/PHPHumanizer/Resources/translations/difference.zh_CN.yml)
+* [Chinese Taiwan](src/Coduo/PHPHumanizer/Resources/translations/difference.zh_TW.yml)
+* [Spanish](src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml)
+* [Ukrainian](src/Coduo/PHPHumanizer/Resources/translations/difference.uk.yml)
+* [Danish](src/Coduo/PHPHumanizer/Resources/translations/difference.da.yml)
+* [Thai](src/Coduo/PHPHumanizer/Resources/translations/difference.th.yml)
+* [Japanese](src/Coduo/PHPHumanizer/Resources/translations/difference.ja.yml)
+* [Romanian](src/Coduo/PHPHumanizer/Resources/translations/difference.ro.yml)
+
+# Development
+
+After downloading library update dependencies:
+
+```
+composer update
+```
+
+In order to check lowest possible versions of dependencies add
+
+```
+composer update --prefer-lowest
+````
+
+Execute test suite:
+
+```
+composer run test
+```
+
+Run CS Fixer
+
+```
+composer run cs:php:fix
+```
+
# Credits
diff --git a/UPGRADE.md b/UPGRADE.md
new file mode 100644
index 0000000..ab3a500
--- /dev/null
+++ b/UPGRADE.md
@@ -0,0 +1,9 @@
+# Upgrade 1.0 to 2.0
+
+* All classes are now marked as final in order to close extra extension points
+* Renamed ``Coduo\PHPHumanizer\Collection`` into ``Coduo\PHPHumanizer\CollectionHumanizer``
+* Renamed ``Coduo\PHPHumanizer\DateTime`` into ``Coduo\PHPHumanizer\DateTimeHumanizer``
+* Renamed ``Coduo\PHPHumanizer\Number`` into ``Coduo\PHPHumanizer\NumberHumanizer``
+* Renamed ``Coduo\PHPHumanizer\String`` into ``Coduo\PHPHumanizer\StringHumanizer``
+* Replaced ``ordinalSuffix($number)`` method in ``Coduo\PHPHumanizer\Number\Ordinal\StrategyInterface`` with ``isPrefix()`` and ``ordinalIndicator($number)``
+* Dependency ``thunderer/shortcode`` was removed, now shortcode lib needs to be added to project
\ No newline at end of file
diff --git a/composer.json b/composer.json
index ad08edc..ad191e7 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,7 @@
{
"name": "coduo/php-humanizer",
"type": "library",
+ "description": "Humanize values that are readable only for developers",
"keywords": ["php", "humanize", "humanizer"],
"license": "MIT",
"authors": [
@@ -14,24 +15,49 @@
}
],
"require": {
- "php": ">=5.3.0",
- "symfony/intl": "~2.3",
- "symfony/config": "~2.3",
- "symfony/translation": "~2.3",
- "symfony/yaml": "~2.3"
+ "php": "~8.3 || ~8.4 || ~8.5",
+ "symfony/translation": "~5.4 || ~6.4 || ~7 || ~8"
},
"require-dev": {
- "phpspec/phpspec": "2.0.*"
+ "thunderer/shortcode": "^0.7",
+ "aeon-php/calendar": "^1.0"
},
"config": {
"bin-dir": "bin"
},
"autoload": {
- "psr-0": {"": "src"}
+ "psr-4": {
+ "": "src/"
+ }
},
- "extra": {
- "branch-alias": {
- "dev-master": "1.1-dev"
+ "autoload-dev": {
+ "psr-4": {
+ "": "tests/"
}
+ },
+ "suggest": {
+ "ext-intl": "Required if you are going to use humanizer with locales different than en_EN"
+ },
+ "scripts": {
+ "build": [
+ "@static:analyze",
+ "@test"
+ ],
+ "test": [
+ "tools/vendor/bin/phpunit"
+ ],
+ "static:analyze": [
+ "tools/vendor/bin/phpstan analyze -c phpstan.neon",
+ "tools/vendor/bin/php-cs-fixer fix --dry-run"
+ ],
+ "cs:php:fix": "tools/vendor/bin/php-cs-fixer fix",
+ "tools:install": "composer install --working-dir=./tools",
+ "tools:update": "composer update --working-dir=./tools",
+ "post-install-cmd": [
+ "@tools:install"
+ ],
+ "post-update-cmd": [
+ "@tools:update"
+ ]
}
}
diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644
index 0000000..d05e1a4
--- /dev/null
+++ b/phpstan.neon
@@ -0,0 +1,6 @@
+parameters:
+ level: max
+ paths:
+ - src
+
+ tmpDir: var/phpstan/cache
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..9f54b7e
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,22 @@
+
+
+
+
+ ./tests/
+
+
+
+
+
+
+
+
+
+ ./src/
+
+
+
diff --git a/spec/Coduo/PHPHumanizer/Collection/FormatterSpec.php b/spec/Coduo/PHPHumanizer/Collection/FormatterSpec.php
deleted file mode 100644
index 81164ef..0000000
--- a/spec/Coduo/PHPHumanizer/Collection/FormatterSpec.php
+++ /dev/null
@@ -1,48 +0,0 @@
-beConstructedWith($translator);
- $translator->trans(
- 'only_two',
- array('%first%' => 'Michal', '%second%' => 'Norbert'),
- 'oxford'
- )->willReturn('Michal and Norbert');
-
- $translator->transChoice(
- 'comma_separated_with_limit',
- 1,
- array('%count%' => 1, "%list%" => 'Michal, Norbert'),
- 'oxford'
- )->willReturn('Michal, Norbert and 1 more');
-
- $translator->trans(
- 'comma_separated',
- array("%list%" => 'Michal, Norbert', '%last%' => "Lukasz"),
- 'oxford'
- )->willReturn('Michal, Norbert and Lukasz');
- }
-
- function it_formats_two_elements()
- {
- $this->format(array("Michal", "Norbert"), null)->shouldReturn("Michal and Norbert");
- }
-
- function it_formats_elements_with_limit()
- {
- $this->format(array("Michal", "Norbert", "Lukasz"), 2)->shouldReturn("Michal, Norbert and 1 more");
- }
-
- function it_formats_elements_without_limit()
- {
- $this->format(array("Michal", "Norbert", "Lukasz"), null)->shouldReturn("Michal, Norbert and Lukasz");
- }
-}
diff --git a/spec/Coduo/PHPHumanizer/Collection/OxfordSpec.php b/spec/Coduo/PHPHumanizer/Collection/OxfordSpec.php
deleted file mode 100644
index 0a6b56f..0000000
--- a/spec/Coduo/PHPHumanizer/Collection/OxfordSpec.php
+++ /dev/null
@@ -1,45 +0,0 @@
-formatter = new Formatter(
- $translator->getWrappedObject()
- );
- $this->beConstructedWith($this->formatter);
- }
- function it_returns_empty_string_when_collection_is_empty()
- {
- $this->format(array())->shouldReturn('');
- }
-
- function it_returns_collection_item_string_when_collection_has_one_element()
- {
- $this->format(array(new CollectionItem("Michal")))->shouldReturn('Michal');
- }
-}
-
-class CollectionItem
-{
- private $name;
-
- public function __construct($name)
- {
- $this->name = $name;
- }
-
- public function __toString()
- {
- return $this->name;
- }
-}
diff --git a/spec/Coduo/PHPHumanizer/CollectionSpec.php b/spec/Coduo/PHPHumanizer/CollectionSpec.php
deleted file mode 100644
index 8e9a6fa..0000000
--- a/spec/Coduo/PHPHumanizer/CollectionSpec.php
+++ /dev/null
@@ -1,53 +0,0 @@
-oxford($example[0], $example[1])->shouldReturn($example[2]);
- }
- }
-
- function it_humanizes_collections_for_polish_locale()
- {
- $examples = array(
- array(array("Michal"), null, 'Michal'),
- array(array("Michal", "Norbert"), null, 'Michal i Norbert'),
- array(array("Michal", "Norbert", "Lukasz"), 2, 'Michal, Norbert i 1 inny'),
- array(array("Michal", "Norbert", "Lukasz", "Pawel"), 2, 'Michal, Norbert i 2 innych'),
- );
-
- foreach ($examples as $example) {
- $this->oxford($example[0], $example[1], 'pl')->shouldReturn($example[2]);
- }
- }
-
- function it_humanizes_collections_for_dutch_locale()
- {
- $examples = array(
- array(array("Michal"), null, 'Michal'),
- array(array("Michal", "Norbert"), null, 'Michal en Norbert'),
- array(array("Michal", "Norbert", "Lukasz"), 2, 'Michal, Norbert, en 1 andere'),
- array(array("Michal", "Norbert", "Lukasz", "Pawel"), 2, 'Michal, Norbert, en 2 andere'),
- array(array("Michal", "Norbert", "Lukasz", "Pawel"), null, 'Michal, Norbert, Lukasz, en Pawel'),
- );
-
- foreach ($examples as $example) {
- $this->oxford($example[0], $example[1], 'nl')->shouldReturn($example[2]);
- }
- }
-}
diff --git a/spec/Coduo/PHPHumanizer/DateTime/DifferenceSpec.php b/spec/Coduo/PHPHumanizer/DateTime/DifferenceSpec.php
deleted file mode 100644
index dc41b9e..0000000
--- a/spec/Coduo/PHPHumanizer/DateTime/DifferenceSpec.php
+++ /dev/null
@@ -1,106 +0,0 @@
-beConstructedWith(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 12:45:00"));
- $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Minute');
- $this->getQuantity()->shouldReturn(15);
- $this->isPast()->shouldReturn(true);
- }
-
- function it_calculate_diff_between_present_and_future_date_in_minutes()
- {
- $this->beConstructedWith(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 13:15:00"));
- $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Minute');
- $this->getQuantity()->shouldReturn(15);
- $this->isPast()->shouldReturn(false);
- }
-
- function it_calculate_diff_between_present_and_past_date_in_hours()
- {
- $this->beConstructedWith(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 11:00:00"));
- $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Hour');
- $this->getQuantity()->shouldReturn(2);
- $this->isPast()->shouldReturn(true);
- }
-
- function it_calculate_diff_between_present_and_future_date_in_hours()
- {
- $this->beConstructedWith(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 16:00:00"));
- $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Hour');
- $this->getQuantity()->shouldReturn(3);
- $this->isPast()->shouldReturn(false);
- }
-
- function it_calculate_diff_between_present_and_past_date_in_days()
- {
- $this->beConstructedWith(new \DateTime("2014-04-10"), new \DateTime("2014-04-09"));
- $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Day');
- $this->getQuantity()->shouldReturn(1);
- $this->isPast()->shouldReturn(true);
- }
-
- function it_calculate_diff_between_present_and_future_date_in_days()
- {
- $this->beConstructedWith(new \DateTime("2014-04-10"), new \DateTime("2014-04-11"));
- $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Day');
- $this->getQuantity()->shouldReturn(1);
- $this->isPast()->shouldReturn(false);
- }
-
- function it_calculate_diff_between_present_and_past_date_in_weeks()
- {
- $this->beConstructedWith(new \DateTime("2014-04-15"), new \DateTime("2014-04-01"));
- $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Week');
- $this->getQuantity()->shouldReturn(2);
- $this->isPast()->shouldReturn(true);
- }
-
- function it_calculate_diff_between_present_and_future_date_in_weeks()
- {
- $this->beConstructedWith(new \DateTime("2014-04-01"), new \DateTime("2014-04-15"));
- $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Week');
- $this->getQuantity()->shouldReturn(2);
- $this->isPast()->shouldReturn(false);
- }
-
- function it_calculate_diff_between_present_and_past_date_in_months()
- {
- $this->beConstructedWith(new \DateTime("2014-04-01"), new \DateTime("2014-03-01"));
- $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Month');
- $this->getQuantity()->shouldReturn(1);
- $this->isPast()->shouldReturn(true);
- }
-
- function it_calculate_diff_between_present_and_future_date_in_months()
- {
- $this->beConstructedWith(new \DateTime("2014-04-01"), new \DateTime("2014-05-01"));
- $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Month');
- $this->getQuantity()->shouldReturn(1);
- $this->isPast()->shouldReturn(false);
- }
-
- function it_calculate_diff_between_present_and_past_date_in_years()
- {
- $this->beConstructedWith(new \DateTime("2014-01-01"), new \DateTime("2012-01-01"));
- $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Year');
- $this->getQuantity()->shouldReturn(2);
- $this->isPast()->shouldReturn(true);
- }
-
- function it_calculate_diff_between_present_and_future_date_in_years()
- {
- $this->beConstructedWith(new \DateTime("2014-01-01"), new \DateTime("2015-01-01"));
- $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Year');
- $this->getQuantity()->shouldReturn(1);
- $this->isPast()->shouldReturn(false);
- }
-}
diff --git a/spec/Coduo/PHPHumanizer/DateTime/FormatterSpec.php b/spec/Coduo/PHPHumanizer/DateTime/FormatterSpec.php
deleted file mode 100644
index 97e08d8..0000000
--- a/spec/Coduo/PHPHumanizer/DateTime/FormatterSpec.php
+++ /dev/null
@@ -1,48 +0,0 @@
-beConstructedWith($translator);
- $translator->transChoice(
- 'minute.past',
- 10,
- array('%count%' => 10),
- 'difference',
- 'en'
- )->willReturn('10 minutes ago');
-
- $translator->transChoice(
- 'minute.past',
- 10,
- array('%count%' => 10),
- 'difference',
- 'pl'
- )->willReturn('10 minut temu');
- }
-
- function it_format_datetime_diff(Difference $diff)
- {
- $diff->getUnit()->willReturn(new Minute());
- $diff->getQuantity()->willReturn(10);
- $diff->isPast()->willReturn(true);
- $this->formatDifference($diff)->shouldReturn('10 minutes ago');
- }
-
- function it_format_datetime_diff_for_specific_locale(Difference $diff)
- {
- $diff->getUnit()->willReturn(new Minute());
- $diff->getQuantity()->willReturn(10);
- $diff->isPast()->willReturn(true);
- $this->formatDifference($diff, 'pl')->shouldReturn('10 minut temu');
- }
-}
diff --git a/spec/Coduo/PHPHumanizer/DateTimeSpec.php b/spec/Coduo/PHPHumanizer/DateTimeSpec.php
deleted file mode 100644
index 009cd8b..0000000
--- a/spec/Coduo/PHPHumanizer/DateTimeSpec.php
+++ /dev/null
@@ -1,302 +0,0 @@
-difference(new \DateTime($example[0]), new \DateTime($example[1]))->shouldReturn($example[2]);
- }
- }
-
- function it_humanize_difference_between_dates_for_pl_locale()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 13:00:00", 'w tym momencie'),
- array("2014-04-26 13:00:00", "2014-04-26 13:00:05", 'za 5 sekund'),
- array("2014-04-26 13:00:00", "2014-04-26 12:59:00", 'minutę temu'),
- array("2014-04-26 13:00:00", "2014-04-26 12:45:00", '15 minut temu'),
- array("2014-04-26 13:00:00", "2014-04-26 13:15:00", 'za 15 minut'),
- array("2014-04-26 13:00:00", "2014-04-26 14:00:00", 'za godzinę'),
- array("2014-04-26 13:00:00", "2014-04-26 15:00:00", 'za 2 godziny'),
- array("2014-04-26 13:00:00", "2014-04-26 12:00:00", 'godzinę temu'),
- array("2014-04-26 13:00:00", "2014-04-26 15:00:00", 'za 2 godziny'),
- array("2014-04-26 13:00:00", "2014-04-26 12:00:00", 'godzinę temu'),
- array("2014-04-26", "2014-04-25", 'wczoraj'),
- array("2014-04-26", "2014-04-24", '2 dni temu'),
- array("2014-04-26", "2014-04-28", 'za 2 dni'),
- array("2014-04-01", "2014-04-15", 'za 2 tygodnie'),
- array("2014-04-15", "2014-04-07", 'tydzień temu'),
- array("2014-01-01", "2014-04-01", 'za 3 miesiące'),
- array("2014-05-01", "2014-04-01", 'miesiąc temu'),
- array("2015-05-01", "2014-04-01", 'rok temu'),
- array("2014-05-01", "2016-04-01", 'za 2 lata'),
- array("2014-05-01", "2009-04-01", '5 lat temu'),
- );
-
- foreach ($examples as $example) {
- $this->difference(new \DateTime($example[0]), new \DateTime($example[1]), 'pl')->shouldReturn($example[2]);
- }
- }
-
- function it_humanize_difference_between_dates_for_af_locale()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 13:00:00", 'nou nou'),
- array("2014-04-26 13:00:00", "2014-04-26 13:00:05", '5 sekondes van nou af'),
- array("2014-04-26 13:00:00", "2014-04-26 12:59:00", '1 minuut gelede'),
- array("2014-04-26 13:00:00", "2014-04-26 12:45:00", '15 minute gelede'),
- array("2014-04-26 13:00:00", "2014-04-26 13:15:00", '15 minute van nou af'),
- array("2014-04-26 13:00:00", "2014-04-26 14:00:00", '1 uur van nou af'),
- array("2014-04-26 13:00:00", "2014-04-26 15:00:00", '2 ure van nou af'),
- array("2014-04-26 13:00:00", "2014-04-26 12:00:00", '1 uur gelede'),
- array("2014-04-26 13:00:00", "2014-04-26 11:00:00", '2 ure gelede'),
- array("2014-04-26 13:00:00", "2014-04-26 12:00:00", '1 uur gelede'),
- array("2014-04-26", "2014-04-25", '1 dag gelede'),
- array("2014-04-26", "2014-04-24", '2 dae gelede'),
- array("2014-04-26", "2014-04-28", '2 dae van nou af'),
- array("2014-04-01", "2014-04-15", '2 weke van nou af'),
- array("2014-04-15", "2014-04-07", '1 week gelede'),
- array("2014-01-01", "2014-04-01", '3 maande van nou af'),
- array("2014-05-01", "2014-04-01", '1 maand gelede'),
- array("2015-05-01", "2014-04-01", '1 jaar gelede'),
- array("2014-05-01", "2016-04-01", '2 jaar van nou af'),
- array("2014-05-01", "2009-04-01", '5 jaar gelede'),
- );
-
- foreach ($examples as $example) {
- $this->difference(new \DateTime($example[0]), new \DateTime($example[1]), 'af')->shouldReturn($example[2]);
- }
- }
-
- function it_humanize_difference_between_dates_for_pt_locale()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 13:00:00", 'agora'),
- array("2014-04-26 13:00:00", "2014-04-26 13:00:05", '5 segundos a partir de agora'),
- array("2014-04-26 13:00:00", "2014-04-26 12:59:00", '1 minuto atrás'),
- array("2014-04-26 13:00:00", "2014-04-26 12:45:00", '15 minutos atrás'),
- array("2014-04-26 13:00:00", "2014-04-26 13:15:00", '15 minutos a partir de agora'),
- array("2014-04-26 13:00:00", "2014-04-26 14:00:00", '1 hora a partir de agora'),
- array("2014-04-26 13:00:00", "2014-04-26 15:00:00", '2 horas a partir de agora'),
- array("2014-04-26 13:00:00", "2014-04-26 12:00:00", '1 hora atrás'),
- array("2014-04-26", "2014-04-25", '1 dia atrás'),
- array("2014-04-26", "2014-04-24", '2 dias atrás'),
- array("2014-04-26", "2014-04-28", '2 dias a partir de agora'),
- array("2014-04-01", "2014-04-15", '2 semanas a partir de agora'),
- array("2014-04-15", "2014-04-07", '1 semana atrás'),
- array("2014-01-01", "2014-04-01", '3 meses a partir de agora'),
- array("2014-05-01", "2014-04-01", '1 mês atrás'),
- array("2015-05-01", "2014-04-01", '1 ano atrás'),
- array("2014-05-01", "2016-04-01", '2 anos a partir de agora'),
- );
-
- foreach ($examples as $example) {
- $this->difference(new \DateTime($example[0]), new \DateTime($example[1]), 'pt')->shouldReturn($example[2]);
- }
- }
-
- function it_humanizes_precise_difference_between_dates()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minute, 45 seconds ago'),
- array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 hour, 40 minutes ago'),
- array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 day, 15 minutes from now'),
- array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 days, 2 hours from now'),
- array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 year, 2 days, 4 hours from now'),
- array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 days, 10 hours from now'),
- array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 day, 1 hour, 40 minutes ago'),
- array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 years, 1 day from now'),
- );
-
- foreach ($examples as $example) {
- $this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]))->shouldReturn($example[2]);
- }
- }
-
- function it_humanizes_precise_difference_between_dates_for_pl_locale()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minuta, 45 sekund temu'),
- array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 godzina, 40 minut temu'),
- array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 dzień, 15 minut od teraz'),
- array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 dni, 2 godziny od teraz'),
- array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 rok, 2 dni, 4 godziny od teraz'),
- array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 dni, 10 godzin od teraz'),
- array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 dzień, 1 godzina, 40 minut temu'),
- array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 lata, 1 dzień od teraz'),
- );
-
- foreach ($examples as $example) {
- $this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'pl')->shouldReturn($example[2]);
- }
- }
-
- function it_humanizes_precise_difference_between_dates_for_af_locale()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minuut, 45 sekondes gelede'),
- array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 uur, 40 minute gelede'),
- array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 dag, 15 minute van nou af'),
- array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 dae, 2 ure van nou af'),
- array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 jaar, 2 dae, 4 ure van nou af'),
- array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 dae, 10 ure van nou af'),
- array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 dag, 1 uur, 40 minute gelede'),
- array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 jaar, 1 dag van nou af'),
- );
-
- foreach ($examples as $example) {
- $this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'af')->shouldReturn($example[2]);
- }
- }
-
- function it_humanizes_precise_difference_between_dates_for_de_locale()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 Minute, 45 Sekunden vor'),
- array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 Stunde, 40 Minuten vor'),
- array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 Tag, 15 Minuten ab jetzt'),
- array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 Tage, 2 Stunden ab jetzt'),
- array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 Jahr, 2 Tage, 4 Stunden ab jetzt'),
- array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 Tage, 10 Stunden ab jetzt'),
- array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 Tag, 1 Stunde, 40 Minuten vor'),
- array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 Jahre, 1 Tag ab jetzt'),
- );
-
- foreach ($examples as $example) {
- $this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'de')->shouldReturn($example[2]);
- }
- }
-
- function it_humanizes_precise_difference_between_dates_for_tr_locale()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 dakika, 45 saniye önce'),
- array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 saat, 40 dakika önce'),
- array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 gün, 15 dakika sonra'),
- array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 gün, 2 saat sonra'),
- array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 yıl, 2 gün, 4 saat sonra'),
- array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 gün, 10 saat sonra'),
- array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 gün, 1 saat, 40 dakika önce'),
- array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 yıl, 1 gün sonra'),
- );
-
- foreach ($examples as $example) {
- $this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'tr')->shouldReturn($example[2]);
- }
- }
-
- function it_humanizes_precise_difference_between_dates_for_fr_locale()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minute, 45 secondes il y a'),
- array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 heure, 40 minutes il y a'),
- array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 jour, 15 minutes maintenant'),
- array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 jours, 2 heures maintenant'),
- array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 année, 2 jours, 4 heures maintenant'),
- array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 jours, 10 heures maintenant'),
- array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 jour, 1 heure, 40 minutes il y a'),
- array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 années, 1 jour maintenant'),
- );
-
- foreach ($examples as $example) {
- $this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'fr')->shouldReturn($example[2]);
- }
- }
-
- function it_humanizes_precise_difference_between_dates_for_pt_locale()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minuto, 45 segundos atrás'),
- array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 hora, 40 minutos atrás'),
- array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 dia, 15 minutos a partir de agora'),
- array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 dias, 2 horas a partir de agora'),
- array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 ano, 2 dias, 4 horas a partir de agora'),
- array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 dias, 10 horas a partir de agora'),
- array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 dia, 1 hora, 40 minutos atrás'),
- array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 anos, 1 dia a partir de agora'),
- );
-
- foreach ($examples as $example) {
- $this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'pt_BR')->shouldReturn($example[2]);
- }
- }
-
- function it_humanizes_precise_difference_between_dates_for_pt_BR_locale()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minuto, 45 segundos atrás'),
- array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 hora, 40 minutos atrás'),
- array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 dia, 15 minutos a partir de agora'),
- array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 dias, 2 horas a partir de agora'),
- array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 ano, 2 dias, 4 horas a partir de agora'),
- array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 dias, 10 horas a partir de agora'),
- array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 dia, 1 hora, 40 minutos atrás'),
- array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 anos, 1 dia a partir de agora'),
- );
-
- foreach ($examples as $example) {
- $this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'pt_BR')->shouldReturn($example[2]);
- }
- }
-
- function it_humanizes_precise_difference_between_dates_for_it_locale()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minuto, 45 secondi fa'),
- array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 ora, 40 minuti fa'),
- array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 giorno, 15 minuti da adesso'),
- array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 giorni, 2 ore da adesso'),
- array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 anno, 2 giorni, 4 ore da adesso'),
- array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 giorni, 10 ore da adesso'),
- array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 giorno, 1 ora, 40 minuti fa'),
- array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 anni, 1 giorno da adesso'),
- );
-
- foreach ($examples as $example) {
- $this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'it')->shouldReturn($example[2]);
- }
- }
-
- function it_humanizes_precise_difference_between_dates_for_no_locale()
- {
- $examples = array(
- array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minutt, 45 sekunder siden'),
- array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 time, 40 minutter siden'),
- array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 dag, 15 minutter fra nå'),
- array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 dager, 2 timer fra nå'),
- array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 år, 2 dager, 4 timer fra nå'),
- array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 dager, 10 timer fra nå'),
- array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 dag, 1 time, 40 minutter siden'),
- array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 år, 1 dag fra nå'),
- );
- foreach ($examples as $example) {
- $this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'no')->shouldReturn($example[2]);
- }
- }
-}
diff --git a/spec/Coduo/PHPHumanizer/NumberSpec.php b/spec/Coduo/PHPHumanizer/NumberSpec.php
deleted file mode 100644
index 6acaa24..0000000
--- a/spec/Coduo/PHPHumanizer/NumberSpec.php
+++ /dev/null
@@ -1,112 +0,0 @@
-ordinalize(1)->shouldReturn("1st");
- $this->ordinalize(2)->shouldReturn("2nd");
- $this->ordinalize(23)->shouldReturn("23rd");
- $this->ordinalize(1002)->shouldReturn("1002nd");
- $this->ordinalize(-111)->shouldReturn("-111th");
- }
-
- function it_returns_ordinal_suffix()
- {
- $this->ordinal(1)->shouldReturn("st");
- $this->ordinal(2)->shouldReturn("nd");
- $this->ordinal(23)->shouldReturn("rd");
- $this->ordinal(1002)->shouldReturn("nd");
- $this->ordinal(-111)->shouldReturn("th");
- }
-
- function it_convert_number_to_string_with_binary_suffix()
- {
- $this->binarySuffix(-1)->shouldReturn(-1);
- $this->binarySuffix(0)->shouldReturn("0 bytes");
- $this->binarySuffix(1)->shouldReturn("1 bytes");
- $this->binarySuffix(1024)->shouldReturn("1 kB");
- $this->binarySuffix(1025)->shouldReturn("1 kB");
- $this->binarySuffix(1536)->shouldReturn("1.5 kB");
- $this->binarySuffix(1048576 * 5)->shouldReturn("5 MB");
- $this->binarySuffix(1073741824 * 2)->shouldReturn("2 GB");
- $this->binarySuffix(1099511627776 * 3)->shouldReturn("3 TB");
- $this->binarySuffix(1325899906842624)->shouldReturn("1.18 PB");
- }
-
- function it_convert_number_to_string_with_binary_suffix_for_specific_locale()
- {
- $this->binarySuffix(1536, 'pl')->shouldReturn("1,5 kB");
- $this->binarySuffix(1325899906842624, 'pl')->shouldReturn("1,18 PB");
- }
-
- function it_throw_exception_when_converting_to_string_with_binary_suffix_non_numeric_values()
- {
- $this->shouldThrow(new \InvalidArgumentException("Binary suffix converter accept only numeric values."))
- ->during('binarySuffix', array('as12'));
- }
-
- function it_convert_number_to_string_with_metric_suffix()
- {
- $this->metricSuffix(-1)->shouldReturn("-1");
- $this->metricSuffix(0)->shouldReturn("0");
- $this->metricSuffix(1)->shouldReturn("1");
- $this->metricSuffix(101)->shouldReturn("101");
- $this->metricSuffix(1000)->shouldReturn("1k");
- $this->metricSuffix(1240)->shouldReturn("1.2k");
- $this->metricSuffix(1240000)->shouldReturn("1.24M");
- $this->metricSuffix(3500000)->shouldReturn("3.5M");
- }
-
- function it_convert_number_to_string_with_metric_suffix_for_specific_locale()
- {
- $this->metricSuffix(1240, 'pl')->shouldReturn("1,2k");
- $this->metricSuffix(1240000, 'pl')->shouldReturn("1,24M");
- $this->metricSuffix(3500000, 'pl')->shouldReturn("3,5M");
- }
-
- function it_throw_exception_when_converting_to_string_with_metric_suffix_non_numeric_values()
- {
- $this->shouldThrow(new \InvalidArgumentException("Metric suffix converter accept only numeric values."))
- ->during('metricSuffix', array('as12'));
- }
-
- function it_converts_numbers_to_roman()
- {
- $this->toRoman(1)->shouldReturn("I");
- $this->toRoman(5)->shouldReturn("V");
- $this->toRoman(9)->shouldReturn("IX");
- $this->toRoman(10)->shouldReturn("X");
- $this->toRoman(125)->shouldReturn("CXXV");
- $this->toRoman(1300)->shouldReturn("MCCC");
- $this->toRoman(3999)->shouldReturn("MMMCMXCIX");
- }
-
- function it_throws_exception_when_converting_number_is_out_of_range()
- {
- $this->shouldThrow(new \InvalidArgumentException())->during('toRoman', array(-1));
- $this->shouldThrow(new \InvalidArgumentException())->during('toRoman', array(4000));
- }
-
- function it_converts_roman_numbers_to_arabic()
- {
- $this->fromRoman("I")->shouldReturn(1);
- $this->fromRoman("V")->shouldReturn(5);
- $this->fromRoman("IX")->shouldReturn(9);
- $this->fromRoman("CXXV")->shouldReturn(125);
- $this->fromRoman("MCCC")->shouldReturn(1300);
- $this->fromRoman("MMMCMXCIX")->shouldReturn(3999);
- }
-
- function it_throws_exception_when_converting_roman_number_is_invalid()
- {
- $this->shouldThrow(new \InvalidArgumentException())->during('fromRoman', array(1234));
- $this->shouldThrow(new \InvalidArgumentException())->during('fromRoman', array(""));
- $this->shouldThrow(new \InvalidArgumentException())->during('fromRoman', array("foobar"));
- }
-}
diff --git a/spec/Coduo/PHPHumanizer/String/WordBreakpointSpec.php b/spec/Coduo/PHPHumanizer/String/WordBreakpointSpec.php
deleted file mode 100644
index f608032..0000000
--- a/spec/Coduo/PHPHumanizer/String/WordBreakpointSpec.php
+++ /dev/null
@@ -1,36 +0,0 @@
-calculatePosition('Lorem ipsum dolorem', 2)->shouldReturn(5);
- $this->calculatePosition('Lorem ipsum dolorem', 4)->shouldReturn(5);
- $this->calculatePosition('Lorem ipsum dolorem', 5)->shouldReturn(5);
- $this->calculatePosition('Lorem ipsum dolorem', 10)->shouldReturn(11);
- $this->calculatePosition('Lorem ipsum dolorem', -2)->shouldReturn(19);
- $this->calculatePosition('Lorem ipsum dolorem', 0)->shouldReturn(5);
- }
-
- function it_calculate_breakpoint_position_when_sentence_is_shorter_than_characters_count()
- {
- $this->calculatePosition('Lorem ipsum dolorem', 20)->shouldReturn(19);
- }
-
- function it_calculate_breakpoint_position_when_characters_count_ends_in_last_word()
- {
- $this->calculatePosition('Lorem ipsum', 7)->shouldReturn(11);
- }
-
- function it_calculate_breakpoint_position_when_characters_count_ends_in_last_space()
- {
- $this->calculatePosition('Lorem ipsum', 5)->shouldReturn(5);
- }
-}
diff --git a/spec/Coduo/PHPHumanizer/StringSpec.php b/spec/Coduo/PHPHumanizer/StringSpec.php
deleted file mode 100644
index 6e8deeb..0000000
--- a/spec/Coduo/PHPHumanizer/StringSpec.php
+++ /dev/null
@@ -1,74 +0,0 @@
-humanize('news_count')->shouldReturn('News count');
- }
-
- function it_humanize_strings_without_capitalize()
- {
- $this->humanize('user', false)->shouldReturn('user');
- }
-
- function it_humanize_string_excluding_forbidden_words()
- {
- $this->humanize('news_id')->shouldReturn('News');
- }
-
- function it_truncate_string_to_word_closest_to_a_certain_number_of_characters()
- {
- $text = 'Lorem ipsum dolorem si amet, lorem ipsum. Dolorem sic et nunc.';
-
- $this->truncate($text, 2)->shouldReturn("Lorem");
- $this->truncate($text, 10, '...')->shouldReturn("Lorem ipsum...");
- $this->truncate($text, 30)->shouldReturn("Lorem ipsum dolorem si amet, lorem");
- $this->truncate($text, 0)->shouldReturn("Lorem");
- $this->truncate($text, 0, '...')->shouldReturn("Lorem...");
- $this->truncate($text, -2)->shouldReturn($text);
-
- $textShort = 'Short text';
- $this->truncate($textShort, 1, '...')->shouldReturn("Short...");
- $this->truncate($textShort, 2, '...')->shouldReturn("Short...");
- $this->truncate($textShort, 3, '...')->shouldReturn("Short...");
- $this->truncate($textShort, 4, '...')->shouldReturn("Short...");
- $this->truncate($textShort, 5, '...')->shouldReturn("Short...");
- $this->truncate($textShort, 6, '...')->shouldReturn("Short text");
- $this->truncate($textShort, 7, '...')->shouldReturn("Short text");
- $this->truncate($textShort, 8, '...')->shouldReturn("Short text");
- $this->truncate($textShort, 9, '...')->shouldReturn("Short text");
- $this->truncate($textShort, 10, '...')->shouldReturn("Short text");
- }
-
-
- function it_truncate_string_to_word_closest_to_a_certain_number_of_characters_with_html_tags()
- {
- $text = '
HyperText Markup Language, commonly referred to as HTML, is the standard markup language used to create web pages.[1]Web browsers can read HTML files and render them into visible or audible web pages. HTML describes the structure of a websitesemantically along with cues for presentation, making it a markup language, rather than a programming language.