/** * Generate descriptive text * @since Version 3.9.1 * @return string */ public function generateDescription() { $mckey = sprintf(self::CACHE_KEY_DESC, $this->id); if ($str = $this->Memcached->fetch($mckey)) { return $str; } $bits = array(); /** * Built as... by... */ $bits = Utility\LocomotiveUtility::getDescriptionBits_Manufacturer($this, $bits); /** * Process the dates */ $bits = Utility\LocomotiveUtility::getDescriptionBits_Dates($this, $bits); /** * The loco is currently... */ $bits = Utility\LocomotiveUtility::getDescriptionBits_Status($this, $bits); /** * Join it all together */ $str = trim(implode("", $bits)); if (preg_match("/([a-zA-Z0-9]+)/", substr($str, -1))) { $str .= "."; } if (substr($str, -1) === ",") { $str = substr($str, 0, -1) . "."; } $this->Memcached->save($mckey, $str, strtotime("+1 year")); return $str; }