Code Duplication    Length = 15-15 lines in 2 locations

src/LatLng.php 2 locations

@@ 329-343 (lines=15) @@
326
     *
327
     * @return OSRef
328
     */
329
    public function toOSRef(): OSRef
330
    {
331
        $asOSGB36 = $this->toOSGB36();
332
333
        $OSGB = new OSRef(0, 0); //dummy to get reference data
334
        $scale = $OSGB->getScaleFactor();
335
        $N0 = $OSGB->getOriginNorthing();
336
        $E0 = $OSGB->getOriginEasting();
337
        $phi0 = $OSGB->getOriginLatitude();
338
        $lambda0 = $OSGB->getOriginLongitude();
339
340
        $coords = $asOSGB36->toTransverseMercatorEastingNorthing($scale, $E0, $N0, $phi0, $lambda0);
341
342
        return new OSRef($coords['E'], $coords['N'], $this->h);
343
    }
344
345
    /**
346
     * Convert this LatLng object into an ITM grid reference
@@ 350-364 (lines=15) @@
347
     *
348
     * @return ITMRef
349
     */
350
    public function toITMRef()
351
    {
352
        $asWGS84 = $this->toWGS84();
353
354
        $ITM = new ITMRef(0, 0); //dummy to get reference data
355
        $scale = $ITM->getScaleFactor();
356
        $N0 = $ITM->getOriginNorthing();
357
        $E0 = $ITM->getOriginEasting();
358
        $phi0 = $ITM->getOriginLatitude();
359
        $lambda0 = $ITM->getOriginLongitude();
360
361
        $coords = $asWGS84->toTransverseMercatorEastingNorthing($scale, $E0, $N0, $phi0, $lambda0);
362
363
        return new ITMRef($coords['E'], $coords['N'], $this->h);
364
    }
365
366
367
    /**