Skip to content

Commit b9d257a

Browse files
authored
Merge pull request #2 from josantonius/pre-release/v2.0.2
pre-release/v2.0.2
2 parents dcb5e5a + ff52334 commit b9d257a

File tree

6 files changed

+53
-69
lines changed

6 files changed

+53
-69
lines changed

.github/lang/es-ES/README.md

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,56 +62,46 @@ clone https://github.com/josantonius/php-language-code.git
6262

6363
### Clase LanguageCode
6464

65-
```php
66-
use Josantonius\LanguageCode\LanguageCode;
67-
```
68-
69-
Crear objeto:
70-
71-
```php
72-
$languageCode = new LanguageCode();
73-
```
65+
`Josantonius\LanguageCode\LanguageCode`
7466

7567
Obtener array con todos los códigos de idioma:
7668

7769
```php
78-
$languageCode->all(): array
70+
public static function all(): array
7971
```
8072

8173
Obtener código de idioma desde el nombre del idioma:
8274

8375
```php
84-
$languageCode->getCode(string $languageName): string|null
76+
public static function getCode(string $languageName): string|null
8577
```
8678

8779
Obtener el nombre del idioma desde código de idioma:
8880

8981
```php
90-
$languageCode->getName(string $languageCode): string|null
82+
public static function getName(string $languageCode): string|null
9183
```
9284

9385
### Clase LanguageCodeCollection
9486

95-
```php
96-
use Josantonius\LanguageCode\LanguageCodeCollection;
97-
```
87+
`Josantonius\LanguageCode\LanguageCodeCollection`
9888

9989
Obtener array con todos los códigos de idioma:
10090

10191
```php
102-
LanguageCodeCollection::all(): array
92+
public static function all(): array
10393
```
10494

10595
Obtener código de idioma desde el nombre del idioma:
10696

10797
```php
108-
LanguageCodeCollection::getCode(string $languageName): string|null
98+
public static function getCode(string $languageName): string|null
10999
```
110100

111101
Obtener el nombre del idioma desde código de idioma:
112102

113103
```php
114-
LanguageCodeCollection::getName(string $languageCode): string|null
104+
public static function getName(string $languageCode): string|null
115105
```
116106

117107
## Uso
@@ -184,6 +174,10 @@ use Josantonius\LanguageCode\LanguageCodeCollection;
184174
LanguageCodeCollection::getName('de'); // German
185175
```
186176

177+
## Listado en formato JSON
178+
179+
[Ir al recurso](https://gist.github.com/josantonius/b455e315bc7f790d14b136d61d9ae469).
180+
187181
## Tests
188182

189183
Para ejecutar las [pruebas](tests) necesitarás [Composer](http://getcomposer.org/download/)

README.md

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ PHP library to get language name from code.
2626
- [TODO](#todo)
2727
- [Changelog](#changelog)
2828
- [Contribution](#contribution)
29-
- [Sponsor](#Sponsor)
29+
- [Sponsor](#sponsor)
3030
- [License](#license)
3131

3232
---
@@ -62,56 +62,46 @@ clone https://github.com/josantonius/php-language-code.git
6262

6363
### LanguageCode Class
6464

65-
```php
66-
use Josantonius\LanguageCode\LanguageCode;
67-
```
68-
69-
Create object:
70-
71-
```php
72-
$languageCode = new LanguageCode();
73-
```
65+
`Josantonius\LanguageCode\LanguageCode`
7466

7567
Get all language codes as array:
7668

7769
```php
78-
$languageCode->all(): array
70+
public static function all(): array;
7971
```
8072

8173
Get language code from language name:
8274

8375
```php
84-
$languageCode->getCode(string $languageName): string|null
76+
public static function getCode(string $languageName): string|null;
8577
```
8678

8779
Get language name from language code:
8880

8981
```php
90-
$languageCode->getName(string $languageCode): string|null
82+
public static function getName(string $languageCode): string|null;
9183
```
9284

9385
### LanguageCodeCollection Class
9486

95-
```php
96-
use Josantonius\LanguageCode\LanguageCodeCollection;
97-
```
87+
`Josantonius\LanguageCode\LanguageCodeCollection`
9888

9989
Get all language codes as array:
10090

10191
```php
102-
LanguageCodeCollection::all(): array
92+
public static function all(): array
10393
```
10494

10595
Get language code from language name:
10696

10797
```php
108-
LanguageCodeCollection::getCode(string $languageName): string|null
98+
public static function getCode(string $languageName): string|null
10999
```
110100

111101
Get language name from language code:
112102

113103
```php
114-
LanguageCodeCollection::getName(string $languageCode): string|null
104+
public static function getName(string $languageCode): string|null
115105
```
116106

117107
## Usage

phpmd.xml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<?xml version="1.0"?>
22
<ruleset name="PHPMD rule set"
3-
xmlns="http://pmd.sf.net/ruleset/1.0.0"
4-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
6-
http://pmd.sf.net/ruleset_xml_schema.xsd"
7-
xsi:noNamespaceSchemaLocation="
3+
xmlns="http://pmd.sf.net/ruleset/1.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
5+
http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation="
86
http://pmd.sf.net/ruleset_xml_schema.xsd">
97
<description>Coding standard.</description>
108

@@ -34,7 +32,7 @@
3432
<rule ref="rulesets/controversial.xml/Superglobals"/>
3533
<rule ref="rulesets/controversial.xml/CamelCaseClassName"/>
3634
<rule ref="rulesets/controversial.xml/CamelCasePropertyName"/>
37-
<rule ref="rulesets/controversial.xml/CamelCaseMethodName"/>
35+
<!--<rule ref="rulesets/controversial.xml/CamelCaseMethodName"/>-->
3836
<rule ref="rulesets/controversial.xml/CamelCaseParameterName"/>
3937
<rule ref="rulesets/controversial.xml/CamelCaseVariableName"/>
4038

src/LanguageCode.php

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

33
/*
4-
* This file is part of https://github.com/josantonius/php-language-code repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-language-code repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
1111

1212
namespace Josantonius\LanguageCode;
1313

src/LanguageCodeCollection.php

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

33
/*
4-
* This file is part of https://github.com/josantonius/php-language-code repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-language-code repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
1111

1212
namespace Josantonius\LanguageCode;
1313

tests/LanguageCodeTest.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

33
/*
4-
* This file is part of https://github.com/josantonius/php-language-code repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-language-code repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
12+
*/
1113

1214
namespace Josantonius\LanguageCode\Tests;
1315

@@ -27,35 +29,35 @@ public function setUp(): void
2729
$this->languageCode = new LanguageCode();
2830
}
2931

30-
public function testShouldGetAllLanguageCodes(): void
32+
public function test_should_get_all_language_codes(): void
3133
{
3234
$this->assertNotEmpty($this->languageCode->all());
3335

3436
$this->assertNotEmpty($this->collection->all());
3537
}
3638

37-
public function testShouldGetLanguageCodeFromLanguageName(): void
39+
public function test_should_get_language_code_from_language_name(): void
3840
{
3941
$this->assertSame('es', $this->languageCode->getCode('Spanish'));
4042

4143
$this->assertSame('es', $this->collection->getCode('Spanish'));
4244
}
4345

44-
public function testShouldReturnNullWithUnknownLanguageName(): void
46+
public function test_should_return_null_with_unknown_language_name(): void
4547
{
4648
$this->assertNull($this->languageCode->getCode('foo'));
4749

4850
$this->assertNull($this->collection->getCode('foo'));
4951
}
5052

51-
public function testShouldGetLanguageNameFromLanguageCode(): void
53+
public function test_should_get_language_name_from_language_code(): void
5254
{
5355
$this->assertSame('Spanish', $this->languageCode->getName('es'));
5456

5557
$this->assertSame('Spanish', $this->collection->getName('es'));
5658
}
5759

58-
public function testShouldReturnNullWithUnknownLanguageCode(): void
60+
public function test_should_return_null_with_unknown_language_code(): void
5961
{
6062
$this->assertNull($this->languageCode->getName('bar'));
6163

0 commit comments

Comments
 (0)