public function getTitleArgs() { $bits = explode("_", $this->exchange, 2); if ($bits[0] != "securities") { throw new GraphException("Expected exchange of securities_exchange format"); } $instances = get_security_instances($bits[1], $this->currency); foreach ($instances as $instance) { if ($instance['id'] == $this->account_id) { return array(':exchange' => $instance['title']); } } return "(could not find security)"; }
function get_security_instance_title($graph_id, $name) { $bits = explode("_", $graph_id, 3); if (count($bits) != 3) { return "[Unknown graph_id type]"; } $input = get_security_instances($bits[1], $bits[2]); foreach ($input as $key => $value) { if ($value['name'] == $name) { return $value['title']; } } return $name; // fallback }