1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
<?php
namespace Catapult;
final class Voice extends Types {
public static $available_voices = array(
"Jorge" => "male",
"Kate" => "female",
"Susan" => "female",
"Julie" => "female",
"Dave" => "male",
"Paul" => "male",
"Bridget" => "male",
"Violeta" => "female",
"Jolie" => "female",
"Bernard" => "male",
"Katrin" => "female",
"Stefan" => "male",
"Paola" => "male",
"Luca" => "male"
);
public $gender = "male";
public function __construct($voice)
{
$this->voice = $voice;
$this->gender = self::$available_voices[$voice];
}
public function perform($warn=TRUE)
{
$in = array_key_exists($this->voice, self::$available_voices);
if (!$in && $warn)
throw new \CatapultApiException("Voice unrecognized");
if (!$in)
return FALSE;
return TRUE;
}
public function __toString()
{
return (string) $this->voice;
}
}