Skip to content

Commit 0697dc3

Browse files
Merge pull request #1 from mrge-group/laravel10_compatibility
Laravel10 compatibility
2 parents 27cdaa7 + e50e4f1 commit 0697dc3

28 files changed

+400
-322
lines changed

.github/workflows/php-cs-fixer.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check & fix styling
2+
3+
on: [push]
4+
5+
jobs:
6+
php-cs-fixer:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- name: Run PHP CS Fixer
16+
uses: docker://oskarstark/php-cs-fixer-ga
17+
with:
18+
args: --config=.php_cs.dist.php --allow-risky=yes
19+
20+
- name: Commit changes
21+
uses: stefanzweifel/git-auto-commit-action@v4
22+
with:
23+
commit_message: Fix styling

.github/workflows/run-tests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: run-tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
os: [ubuntu-latest]
12+
php: [8.1]
13+
laravel: [10.*]
14+
dependency-version: [prefer-lowest, prefer-stable]
15+
include:
16+
- laravel: 10.*
17+
testbench: 8.*
18+
19+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v2
24+
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php }}
29+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
30+
coverage: none
31+
32+
- name: Install dependencies
33+
run: |
34+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
35+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
36+
37+
- name: Execute tests
38+
run: vendor/bin/phpunit

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
/vendor
22
composer.phar
33
composer.lock
4+
5+
.idea/
6+
7+
.phpunit.result.cache

.php-cs-fixer.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"php":"8.3.2","version":"3.48.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces_position":true,"class_definition":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":{"elements":["method","property"]},"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"ordered_imports":{"sort_algorithm":"alpha"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}},"single_trait_insert_per_statement":true},"hashes":{"src\/Commands\/TransCommand.php":"fb42c64cb7e50a610ac6affe273a03e2","src\/Commands\/MissingCommand.php":"209347df1c302654677d234756619ab6","src\/Commands\/RenameCommand.php":"7c017fed4284e3aa7f085ef01f1ff13c","src\/Commands\/ShowCommand.php":"6493876ce899d1ba684ec330825516b0","src\/Commands\/FindCommand.php":"00ff2a25269ea8f919605e86f9bbc835","src\/Commands\/SyncCommand.php":"e29867a1c6a984672156cc981ef72d72","src\/Commands\/RemoveCommand.php":"364f9f3c15a1b3e97d0c7f67206220dd","src\/Manager.php":"1451b96b911bb3eb707e97b4a8975109","src\/LangmanServiceProvider.php":"97135894ddcbce677615698a1844ff10","tests\/ManagerTest.php":"d27905a621c44997ece2d43bef717ab4","tests\/TestCase.php":"93301f8abcc0af9f421bee880ba1be79","tests\/ShowCommandTest.php":"04239415c5ef6d7e1530d6133de22e66","tests\/TransCommandTest.php":"f62bfa6dbf83547e806132d41d0ac89b","tests\/MissingCommandTest.php":"2ff8e658ec9d0e216f21bd51e90933ce","tests\/RemoveCommandTest.php":"4260e6a2f64acf58cb76fc7951d137c2","tests\/SyncCommandTest.php":"0c95c883a98c27b8881777272c1e5ded","tests\/Kernel.php":"cfa0d64c25ba87ee36609b84cd1b0764","tests\/FindCommandTest.php":"84df6f0c6e9de514841c7aa3bb0ab330","tests\/RenameCommandTest.php":"33e8b352b17c7428948b5a0ee59fe9cd"}}

.php_cs.dist.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->in([
5+
__DIR__ . '/src',
6+
__DIR__ . '/tests',
7+
])
8+
->name('*.php')
9+
->notName('*.blade.php')
10+
->ignoreDotFiles(true)
11+
->ignoreVCS(true);
12+
13+
return (new PhpCsFixer\Config())
14+
->setRules([
15+
'@PSR2' => true,
16+
'array_syntax' => ['syntax' => 'short'],
17+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
18+
'no_unused_imports' => true,
19+
'not_operator_with_successor_space' => true,
20+
'trailing_comma_in_multiline' => true,
21+
'phpdoc_scalar' => true,
22+
'unary_operator_spaces' => true,
23+
'binary_operator_spaces' => true,
24+
'blank_line_before_statement' => [
25+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
26+
],
27+
'phpdoc_single_line_var_spacing' => true,
28+
'phpdoc_var_without_name' => true,
29+
'class_attributes_separation' => [
30+
'elements' => [
31+
'method' => 'one',
32+
],
33+
],
34+
'method_argument_space' => [
35+
'on_multiline' => 'ensure_fully_multiline',
36+
'keep_multiple_spaces_after_comma' => true,
37+
],
38+
'single_trait_insert_per_statement' => true,
39+
])
40+
->setFinder($finder);

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
1-
<h1 align="center">Laravel Langman</h1>
1+
# Laravel Langman
22

3-
<p align="center">
3+
[![Latest Version](https://img.shields.io/github/release/oss-tools/laravel-langman.svg?style=flat-square)](https://github.com/oss-tools/laravel-langman/releases)
4+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
5+
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/oss-tools/laravel-langman/run-tests?label=tests)
6+
![Check & fix styling](https://github.com/oss-tools/laravel-langman/workflows/Check%20&%20fix%20styling/badge.svg)
7+
[![Total Downloads](https://img.shields.io/packagist/dt/oss-tools/laravel-langman.svg?style=flat-square)](https://packagist.org/packages/oss-tools/laravel-langman)
8+
9+
### What is Langman?
410
Langman is a language files manager in your artisan console, it helps you search, update, add, and remove
511
translation lines with ease. Taking care of a multilingual interface is not a headache anymore.
6-
<br>
7-
<br>
8-
9-
<img src="http://s16.postimg.org/mghfe2v3p/ezgif_com_optimize.gif" alt="Laravel Langman">
10-
<br>
11-
<a href="https://travis-ci.org/themsaid/laravel-langman"><img src="https://travis-ci.org/themsaid/laravel-langman.svg?branch=master" alt="Build Status"></a>
12-
<a href="https://styleci.io/repos/55088784"><img src="https://styleci.io/repos/55088784/shield?style=flat" alt="StyleCI"></a>
13-
<a href="https://packagist.org/packages/themsaid/laravel-langman"><img src="https://poser.pugx.org/themsaid/laravel-langman/v/stable.svg" alt="Latest Stable Version"></a>
14-
<a href="https://packagist.org/packages/themsaid/laravel-langman"><img src="https://poser.pugx.org/themsaid/laravel-langman/d/total.svg" alt="Total Downloads"></a>
15-
<a href="https://packagist.org/packages/themsaid/laravel-langman"><img src="https://poser.pugx.org/themsaid/laravel-langman/license.svg" alt="License"></a>
1612

17-
</p>
13+
## Note
14+
This package is a detached fork of [themsaid/laravel-langman](https://github.com/themsaid/laravel-langman)
1815

1916
## Installation
2017

2118
Begin by installing the package through Composer. Run the following command in your terminal:
2219

2320
```
24-
$ composer require themsaid/laravel-langman
21+
$ composer require mrge-group/laravel-langman
2522
```
2623

2724
Once done, add the following line in your providers array of `config/app.php`:
2825

2926
```php
30-
Themsaid\Langman\LangmanServiceProvider::class
27+
mrgegroup\Langman\LangmanServiceProvider::class
3128
```
3229

3330
This package has a single configuration option that points to the `resources/lang` directory, if only you need to change
3431
the path then publish the config file:
3532

3633
```
37-
php artisan vendor:publish --provider="Themsaid\Langman\LangmanServiceProvider"
34+
php artisan vendor:publish --provider="mrgegroup\Langman\LangmanServiceProvider"
3835
```
3936

4037
## Usage
@@ -163,3 +160,8 @@ This will rename `users.name` to be `users.full_name`, the console will output a
163160

164161
If you want a web interface to manage your language files instead, I recommend [Laravel 5 Translation Manager](https://github.com/barryvdh/laravel-translation-manager)
165162
by [Barry vd. Heuvel](https://github.com/barryvdh).
163+
164+
## Testing
165+
```
166+
composer test
167+
```

composer.json

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
{
2-
"name": "themsaid/laravel-langman",
2+
"name": "mrge-group/laravel-langman",
33
"description": "Manage language files with ease.",
44
"keywords": ["laravel", "localization", "multilingual"],
5-
"homepage": "https://github.com/themsaid/laravel-langman",
5+
"homepage": "https://github.com/oss-tools/laravel-langman",
66
"license": "MIT",
7-
"authors": [
8-
{
9-
"name": "Mohamed Said",
10-
"email": "[email protected]",
11-
"homepage": "https://themsaid.github.io"
12-
}
13-
],
147
"require": {
15-
"php": "^5.5.9 || ^7.0",
16-
"illuminate/support": "~5.1",
17-
"illuminate/console": "~5.1",
18-
"illuminate/filesystem": "~5.1"
8+
"php": "^8.0.2",
9+
"illuminate/database": "^9.0 || ^10.0",
10+
"illuminate/support": "^9.0 || ^10.0",
11+
"illuminate/console": "^9.0 || ^10.0",
12+
"illuminate/filesystem": "^9.0 || ^10.0"
1913
},
2014
"require-dev": {
21-
"phpunit/phpunit" : "^4.8 || ^5.0",
22-
"orchestra/testbench": "~3.0",
23-
"orchestra/database": "~3.0",
24-
"mockery/mockery": "~0.9.4"
15+
"orchestra/testbench": "^7.0 || ^8.0",
16+
"phpunit/phpunit": "^9.5.10 || ^10.1",
17+
"mockery/mockery": "^1.6.0"
2518
},
2619
"autoload": {
2720
"psr-4": {
@@ -34,8 +27,11 @@
3427
"extra": {
3528
"laravel": {
3629
"providers": [
37-
"Themsaid\\Langman\\LangmanServiceProvider"
30+
"mrgegroup\\Langman\\LangmanServiceProvider"
3831
]
3932
}
33+
},
34+
"scripts": {
35+
"test": "vendor/bin/phpunit"
4036
}
4137
}

phpunit.xml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
11-
syntaxCheck="false">
12-
<testsuites>
13-
<testsuite name="Langman Test Suite">
14-
<directory suffix=".php">./tests/</directory>
15-
</testsuite>
16-
</testsuites>
17-
<php>
18-
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
19-
</php>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3+
<coverage/>
4+
<testsuites>
5+
<testsuite name="Langman Test Suite">
6+
<directory suffix=".php">./tests/</directory>
7+
<exclude>tests/Kernel.php</exclude>
8+
<exclude>tests/TestCase.php</exclude>
9+
</testsuite>
10+
</testsuites>
11+
<php>
12+
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
13+
</php>
14+
<source/>
2015
</phpunit>

src/Commands/FindCommand.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
22

3-
namespace Themsaid\Langman\Commands;
3+
namespace OSSTools\Langman\Commands;
44

55
use Illuminate\Console\Command;
66
use Illuminate\Support\Arr;
7-
use Themsaid\Langman\Manager;
8-
use Illuminate\Support\Str;
7+
use OSSTools\Langman\Manager;
98

109
class FindCommand extends Command
1110
{
@@ -26,7 +25,7 @@ class FindCommand extends Command
2625
/**
2726
* The Languages manager instance.
2827
*
29-
* @var \Themsaid\LangMan\Manager
28+
* @var \OSSTools\LangMan\Manager
3029
*/
3130
private $manager;
3231

@@ -40,7 +39,7 @@ class FindCommand extends Command
4039
/**
4140
* ListCommand constructor.
4241
*
43-
* @param \Themsaid\LangMan\Manager $manager
42+
* @param \OSSTools\LangMan\Manager $manager
4443
* @return void
4544
*/
4645
public function __construct(Manager $manager)
@@ -112,7 +111,7 @@ private function tableRows()
112111
$original[$languageKey] =
113112
isset($values[$languageKey])
114113
? $values[$languageKey]
115-
: isset($filesContent[$fileName][$languageKey][$key]) ? $filesContent[$fileName][$languageKey][$key] : '';
114+
: (isset($filesContent[$fileName][$languageKey][$key]) ? $filesContent[$fileName][$languageKey][$key] : '');
116115
}
117116

118117
// Sort the language values based on language name

0 commit comments

Comments
 (0)