ok
Direktori : /home2/selectio/www/fms-worksuite/vendor/yandex/translate-api/src/ |
Current File : /home2/selectio/www/fms-worksuite/vendor/yandex/translate-api/src/Translation.php |
<?php namespace Yandex\Translate; /** * Translation * @author Nikita Gusakov <dev@nkt.me> */ class Translation { /** * @var string|array */ protected $source; /** * @var string|array */ protected $result; /** * @var array */ protected $language; /** * @param string|array $source The source text * @param string|array $result The translation result * @param string $language Translation language */ public function __construct($source, $result, $language) { $this->source = $source; $this->result = $result; $this->language = explode('-', $language); } /** * @return string|array The source text */ public function getSource() { return $this->source; } /** * @return array|string The result text */ public function getResult() { return $this->result; } /** * @return string The source language. */ public function getSourceLanguage() { return $this->language[0]; } /** * @return string The translation language. */ public function getResultLanguage() { return $this->language[1]; } /** * @return string The translation text. */ public function __toString() { if (is_array($this->result)) { return join(' ', $this->result); } return (string) $this->result; } }