public function addWaypoint()
    {
        $args = func_get_args();

        if (isset($args[0]) && ($args[0] instanceof DirectionsWaypoint)) {
            $this->waypoints[] = $args[0];
        } elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) {
            $waypoint = new DirectionsWaypoint();
            $waypoint->setLocation($args[0], $args[1]);

            if (isset($args[2]) && is_bool($args[2])) {
                $waypoint->getLocation()->setNoWrap($args[2]);
            }

            $this->waypoints[] = $waypoint;
        } elseif (isset($args[0]) && (is_string($args[0]) || ($args[0] instanceof Coordinate))) {
            $waypoint = new DirectionsWaypoint();
            $waypoint->setLocation($args[0]);

            $this->waypoints[] = $waypoint;
        } else {
            throw DirectionsException::invalidDirectionsRequestWaypoint();
        }
    }