public static function cloneLine($line_id, $ignore_clone_name = FALSE, $graph_id = NULL) { $line_to_clone = new Line($line_id); if (empty($graph_id)) { $graph_id = $line_to_clone->getGraphId(); } $line = new Line(); if ($ignore_clone_name) { $clone_alias = $line_to_clone->getAlias(); } else { $clone_alias = 'Clone of ' . $line_to_clone->getAlias(); // If it's too long, we truncate if (strlen($clone_alias) > 255) { $clone_alias = substr($clone_alias, 0, 255); } } $line->setAlias($clone_alias); $line->setTarget($line_to_clone->getTarget()); $line->setColor($line_to_clone->getColor()); $line->setGraphId($graph_id); $line->setWeight($line_to_clone->getWeight()); $line->store(); }
/** * Test set/get color */ public function testSetGetColor() { $expected = 'red'; $object = new Line(); $object->setColor($expected); $this->assertEquals($expected, $object->getColor()); }