Code Duplication    Length = 9-9 lines in 4 locations

src/DB.php 4 locations

@@ 801-809 (lines=9) @@
798
            }
799
800
            $var = [];
801
            if (is_array($entities)) {
802
                foreach ($entities as $elm) {
803
                    $var[] = json_decode($elm, true);
804
                }
805
806
                $entities = json_encode($var);
807
            } else {
808
                $entities = null;
809
            }
810
811
            $sth->bindParam(':reply_to_chat', $reply_chat_id, PDO::PARAM_INT);
812
            $sth->bindParam(':reply_to_message', $reply_to_message_id, PDO::PARAM_INT);
@@ 819-827 (lines=9) @@
816
            $sth->bindParam(':document', $document, PDO::PARAM_STR);
817
818
            $var = [];
819
            if (is_array($photo)) {
820
                foreach ($photo as $elm) {
821
                    $var[] = json_decode($elm, true);
822
                }
823
824
                $photo = json_encode($var);
825
            } else {
826
                $photo = '';
827
            }
828
829
            $sth->bindParam(':photo', $photo, PDO::PARAM_STR);
830
            $sth->bindParam(':sticker', $sticker, PDO::PARAM_STR);
@@ 843-851 (lines=9) @@
840
841
            //Array of PhotoSize
842
            $var = [];
843
            if (is_array($new_chat_photo)) {
844
                foreach ($new_chat_photo as $elm) {
845
                    $var[] = json_decode($elm, true);
846
                }
847
848
                $new_chat_photo = json_encode($var);
849
            } else {
850
                $new_chat_photo = '';
851
            }
852
853
            $sth->bindParam(':new_chat_photo', $new_chat_photo, PDO::PARAM_STR);
854
            $sth->bindParam(':delete_chat_photo', $delete_chat_photo, PDO::PARAM_STR);
@@ 918-926 (lines=9) @@
915
            $sth->bindParam(':date', $edit_date, PDO::PARAM_STR);
916
917
            $var = [];
918
            if (is_array($entities)) {
919
                foreach ($entities as $elm) {
920
                    $var[] = json_decode($elm, true);
921
                }
922
923
                $entities = json_encode($var);
924
            } else {
925
                $entities = null;
926
            }
927
928
            $sth->bindParam(':text', $text, PDO::PARAM_STR);
929
            $sth->bindParam(':entities', $entities, PDO::PARAM_STR);