Code Duplication    Length = 5-5 lines in 5 locations

packages/core/src/Models/Task/Base/Task.php 2 locations

@@ 807-811 (lines=5) @@
804
        );
805
806
        $utc = new \DateTimeZone('utc');
807
        if ($result[$keys[1]] instanceof \DateTime) {
808
            // When changing timezone we don't want to change existing instances
809
            $dateTime = clone $result[$keys[1]];
810
            $result[$keys[1]] = $dateTime->setTimezone($utc)->format('Y-m-d\TH:i:s\Z');
811
        }
812
813
        if ($result[$keys[2]] instanceof \DateTime) {
814
            // When changing timezone we don't want to change existing instances
@@ 813-817 (lines=5) @@
810
            $result[$keys[1]] = $dateTime->setTimezone($utc)->format('Y-m-d\TH:i:s\Z');
811
        }
812
813
        if ($result[$keys[2]] instanceof \DateTime) {
814
            // When changing timezone we don't want to change existing instances
815
            $dateTime = clone $result[$keys[2]];
816
            $result[$keys[2]] = $dateTime->setTimezone($utc)->format('Y-m-d\TH:i:s\Z');
817
        }
818
819
        $virtualColumns = $this->virtualColumns;
820
        foreach ($virtualColumns as $key => $virtualColumn) {

packages/core/src/Models/User/Base/User.php 2 locations

@@ 1031-1035 (lines=5) @@
1028
        );
1029
1030
        $utc = new \DateTimeZone('utc');
1031
        if ($result[$keys[5]] instanceof \DateTime) {
1032
            // When changing timezone we don't want to change existing instances
1033
            $dateTime = clone $result[$keys[5]];
1034
            $result[$keys[5]] = $dateTime->setTimezone($utc)->format('Y-m-d\TH:i:s\Z');
1035
        }
1036
1037
        if ($result[$keys[6]] instanceof \DateTime) {
1038
            // When changing timezone we don't want to change existing instances
@@ 1037-1041 (lines=5) @@
1034
            $result[$keys[5]] = $dateTime->setTimezone($utc)->format('Y-m-d\TH:i:s\Z');
1035
        }
1036
1037
        if ($result[$keys[6]] instanceof \DateTime) {
1038
            // When changing timezone we don't want to change existing instances
1039
            $dateTime = clone $result[$keys[6]];
1040
            $result[$keys[6]] = $dateTime->setTimezone($utc)->format('Y-m-d\TH:i:s\Z');
1041
        }
1042
1043
        $virtualColumns = $this->virtualColumns;
1044
        foreach ($virtualColumns as $key => $virtualColumn) {

packages/selfprice/src/Models/Selfprice/Base/Selfprice.php 1 location

@@ 843-847 (lines=5) @@
840
        );
841
842
        $utc = new \DateTimeZone('utc');
843
        if ($result[$keys[2]] instanceof \DateTime) {
844
            // When changing timezone we don't want to change existing instances
845
            $dateTime = clone $result[$keys[2]];
846
            $result[$keys[2]] = $dateTime->setTimezone($utc)->format('Y-m-d\TH:i:s\Z');
847
        }
848
849
        $virtualColumns = $this->virtualColumns;
850
        foreach ($virtualColumns as $key => $virtualColumn) {