optimize GraphObject.php