aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/commerceguys/intl/src/Language/Language.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-10 12:49:51 +0000
committerMario <mario@mariovavti.com>2019-11-10 14:10:03 +0100
commit580c3f4ffe9608d2beb56d418c68b3b112420e76 (patch)
tree82335d01179ac361d3f547a4b8e8c598d302e9f3 /vendor/commerceguys/intl/src/Language/Language.php
parentd22766f458a8539a40a57f3946459a9be1f21cd6 (diff)
downloadvolse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.gz
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.bz2
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.zip
another bulk of composer updates
(cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce)
Diffstat (limited to 'vendor/commerceguys/intl/src/Language/Language.php')
-rw-r--r--vendor/commerceguys/intl/src/Language/Language.php71
1 files changed, 36 insertions, 35 deletions
diff --git a/vendor/commerceguys/intl/src/Language/Language.php b/vendor/commerceguys/intl/src/Language/Language.php
index 9958d5481..d8196f26c 100644
--- a/vendor/commerceguys/intl/src/Language/Language.php
+++ b/vendor/commerceguys/intl/src/Language/Language.php
@@ -2,7 +2,10 @@
namespace CommerceGuys\Intl\Language;
-class Language implements LanguageEntityInterface
+/**
+ * Represents a language.
+ */
+final class Language
{
/**
* The two-letter language code.
@@ -19,42 +22,56 @@ class Language implements LanguageEntityInterface
protected $name;
/**
- * The language locale (i.e. "en-US").
+ * The locale (i.e. "en-US").
*
* @var string
*/
protected $locale;
/**
- * Returns the string representation of the Language.
+ * Creates a new Language instance.
*
- * @return string
+ * @param array $definition The definition array.
*/
- public function __toString()
+ public function __construct(array $definition)
{
- return $this->getLanguageCode();
+ foreach (['language_code', 'name', 'locale'] as $requiredProperty) {
+ if (empty($definition[$requiredProperty])) {
+ throw new \InvalidArgumentException(sprintf('Missing required property "%s".', $requiredProperty));
+ }
+ }
+
+ $this->languageCode = $definition['language_code'];
+ $this->name = $definition['name'];
+ $this->locale = $definition['locale'];
}
/**
- * {@inheritdoc}
+ * Returns the string representation of the Language.
+ *
+ * @return string
*/
- public function getLanguageCode()
+ public function __toString()
{
return $this->languageCode;
}
/**
- * {@inheritdoc}
+ * Gets the two-letter language code.
+ *
+ * @return string
*/
- public function setLanguageCode($languageCode)
+ public function getLanguageCode()
{
- $this->languageCode = $languageCode;
-
- return $this;
+ return $this->languageCode;
}
/**
- * {@inheritdoc}
+ * Gets the language name.
+ *
+ * This value is locale specific.
+ *
+ * @return string
*/
public function getName()
{
@@ -62,30 +79,14 @@ class Language implements LanguageEntityInterface
}
/**
- * {@inheritdoc}
- */
- public function setName($name)
- {
- $this->name = $name;
-
- return $this;
- }
-
- /**
- * {@inheritdoc}
+ * Gets the locale.
+ *
+ * The language name is locale specific.
+ *
+ * @return string
*/
public function getLocale()
{
return $this->locale;
}
-
- /**
- * {@inheritdoc}
- */
- public function setLocale($locale)
- {
- $this->locale = $locale;
-
- return $this;
- }
}