Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Eichhorn committed Jul 17, 2023
1 parent ebbc08f commit 27ac3f1
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Localization/ISO3166CharEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,5 +528,5 @@ class ISO3166CharEnum extends Enum

public const _XXX = 'XXX';

use ISO3166RegionTrait;
use ISO3166Trait;
}
2 changes: 1 addition & 1 deletion Localization/ISO3166NameEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,5 +528,5 @@ class ISO3166NameEnum extends Enum

public const _XXX = 'XXX';

use ISO3166RegionTrait;
use ISO3166Trait;
}
2 changes: 1 addition & 1 deletion Localization/ISO3166NumEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,5 +528,5 @@ class ISO3166NumEnum extends Enum

public const _XXX = '000';

use ISO3166RegionTrait;
use ISO3166Trait;
}
9 changes: 8 additions & 1 deletion Localization/ISO3166RegionTrait.php → Localization/ISO3166Trait.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,15 @@
* @link https://jingga.app
* @since 1.0.0
*/
trait ISO3166RegionTrait
trait ISO3166Trait
{
public static function getBy2Code(string $code)
{
$code3 = ISO3166TwoEnum::getName($code);

return self::getByName($code3);
}

/**
* Get countries in a region
*
Expand Down
2 changes: 1 addition & 1 deletion Localization/ISO3166TwoEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,5 +528,5 @@ class ISO3166TwoEnum extends Enum

public const _XXX = 'XX';

use ISO3166RegionTrait;
use ISO3166Trait;
}
2 changes: 1 addition & 1 deletion Localization/ISO639Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,5 +396,5 @@ class ISO639Enum extends Enum

public const _ZU = 'Zulu';

use ISO639CountryTrait;
use ISO639Trait;
}
9 changes: 7 additions & 2 deletions Localization/ISO639CountryTrait.php → Localization/ISO639Trait.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@
* @link https://jingga.app
* @since 1.0.0
*/
trait ISO639CountryTrait
trait ISO639Trait
{
public static function getBy2Code(string $code)
{
return self::getByName('_' . \strtoupper($code));
}

/**
* Get language from country.
*
* @param string $country Country
* @param string $country Country 2 code
*
* @return array
*
Expand Down
2 changes: 1 addition & 1 deletion Localization/ISO639x1Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,5 +396,5 @@ class ISO639x1Enum extends Enum

public const _ZH = 'zh';

use ISO639CountryTrait;
use ISO639Trait;
}
2 changes: 1 addition & 1 deletion Localization/ISO639x2Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,5 +396,5 @@ class ISO639x2Enum extends Enum

public const _ZU = 'zul';

use ISO639CountryTrait;
use ISO639Trait;
}
38 changes: 38 additions & 0 deletions Utils/Formatter/HtmlFormatter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package phpOMS\Utils\Formatter
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);

namespace phpOMS\Utils\Formatter;

/**
* Gray encoding class
*
* @package phpOMS\Utils\Formatter
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class HtmlFormatter
{
public static function format(string $text) : string
{
$dom = new \DOMDocument();

$dom->loadHTML($text);

$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;

return $dom->saveXML($dom->documentElement);
}
}

0 comments on commit 27ac3f1

Please sign in to comment.