Skip to content

Commit

Permalink
Merge pull request #115 from ARCANEDEV/patch-3
Browse files Browse the repository at this point in the history
Minor Update
  • Loading branch information
arcanedev-maroc authored Feb 7, 2018
2 parents 1a99a62 + 2e3afc4 commit 5f7c2ec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
21 changes: 16 additions & 5 deletions src/Entities/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
*/
class Locale implements Arrayable, Jsonable, JsonSerializable
{
/* -----------------------------------------------------------------
| Constants
| -----------------------------------------------------------------
*/

const DIRECTION_LEFT_TO_RIGHT = 'ltr';
const DIRECTION_RIGHT_TO_LEFT = 'rtl';

/* -----------------------------------------------------------------
| Properties
| -----------------------------------------------------------------
Expand Down Expand Up @@ -173,9 +181,13 @@ private function setScript($script)
public function direction()
{
if (empty($this->direction)) {
$this->direction = in_array($this->script, [
'Arab', 'Hebr', 'Mong', 'Tfng', 'Thaa'
]) ? 'rtl' : 'ltr';
$rtlScripts = ['Arab', 'Hebr', 'Mong', 'Tfng', 'Thaa'];

$this->setDirection(
in_array($this->script, $rtlScripts)
? self::DIRECTION_RIGHT_TO_LEFT
: self::DIRECTION_LEFT_TO_RIGHT
);
}

return $this->direction;
Expand All @@ -190,9 +202,8 @@ public function direction()
*/
private function setDirection($direction)
{
if ( ! empty($direction)) {
if ( ! empty($direction))
$this->direction = strtolower($direction);
}

return $this;
}
Expand Down
10 changes: 2 additions & 8 deletions src/Entities/LocaleCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,8 @@ public function toNative()
*/
public function loadFromConfig()
{
$this->loadFromArray(
config('localization.locales', [])
);
$this->setSupportedKeys(
config('localization.supported-locales', [])
);

return $this;
return $this->loadFromArray(config('localization.locales', []))
->setSupportedKeys(config('localization.supported-locales', []));
}

/**
Expand Down

0 comments on commit 5f7c2ec

Please sign in to comment.