-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
namespace Packaged\Rwd\Language; | ||
|
||
abstract class AbstractLanguage implements LanguageInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
namespace Packaged\Rwd\Language; | ||
|
||
abstract class AbstractRegionalLanguage extends AbstractLanguage implements RegionalLanguageInterface | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function getFullCode() | ||
{ | ||
return $this->getCode() . '-' . $this->getRegionCode(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
namespace Packaged\Rwd\Language; | ||
|
||
class RegionalLanguage extends AbstractRegionalLanguage implements RegionalLanguageInterface | ||
{ | ||
protected $_language; | ||
protected $_regionCode; | ||
|
||
public function __construct(LanguageInterface $baseLanguage, string $regionCode) | ||
{ | ||
$this->_language = $baseLanguage; | ||
$this->_regionCode = $regionCode; | ||
} | ||
|
||
public function getEnglishName() | ||
{ | ||
return $this->_language->getEnglishName(); | ||
} | ||
|
||
public function getNativeName() | ||
{ | ||
return $this->_language->getNativeName(); | ||
} | ||
|
||
public function getCode() | ||
{ | ||
return $this->_language->getCode(); | ||
} | ||
|
||
public function getDirection() | ||
{ | ||
return $this->_language->getDirection(); | ||
} | ||
|
||
public function getRegionCode() | ||
{ | ||
return $this->_regionCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
namespace Packaged\Rwd\Language; | ||
|
||
interface RegionalLanguageInterface extends LanguageInterface | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function getRegionCode(); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getFullCode(); | ||
} |