%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64 User : addictionfreeind ( 1003) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system Directory : /home/addictionfreeind/public_html/admin1/vendor/yandex/translate-api/src/ |
Upload File : |
<?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;
}
}