public function calculateDistanceInKilometers(
        \Tx_Oelib_Interface_Geo $object1,
        \Tx_Oelib_Interface_Geo $object2
    ) {
        if ($object1->hasGeoError()) {
            throw new \InvalidArgumentException('$object1 has a geo error.');
        }
        if ($object2->hasGeoError()) {
            throw new \InvalidArgumentException('$object2 has a geo error.');
        }
        if (!$object1->hasGeoCoordinates()) {
            throw new \InvalidArgumentException(
                '$object1 needs to have coordinates, but has none.'
            );
        }
        if (!$object2->hasGeoCoordinates()) {
            throw new \InvalidArgumentException(
                '$object2 needs to have coordinates, but has none.'
            );
        }

        $coordinates1 = $object1->getGeoCoordinates();
        $latitude1 = \deg2rad($coordinates1['latitude']);
        $longitude1 = \deg2rad($coordinates1['longitude']);
        $coordinates2 = $object2->getGeoCoordinates();
        $latitude2 = \deg2rad($coordinates2['latitude']);
        $longitude2 = \deg2rad($coordinates2['longitude']);

        return \acos(
                \sin($latitude1) * \sin($latitude2)
                + \cos($latitude1) * \cos($latitude2) * \cos($longitude2 - $longitude1)
            ) * self::EARTH_RADIUS_IN_KILOMETERS;
    }