Code Duplication    Length = 9-9 lines in 4 locations

src/DB.php 4 locations

@@ 784-792 (lines=9) @@
781
            }
782
783
            $var = [];
784
            if (is_array($entities)) {
785
                foreach ($entities as $elm) {
786
                    $var[] = json_decode($elm, true);
787
                }
788
789
                $entities = json_encode($var);
790
            } else {
791
                $entities = null;
792
            }
793
794
            $sth->bindParam(':reply_to_chat', $reply_chat_id, PDO::PARAM_INT);
795
            $sth->bindParam(':reply_to_message', $reply_to_message_id, PDO::PARAM_INT);
@@ 802-810 (lines=9) @@
799
            $sth->bindParam(':document', $document, PDO::PARAM_STR);
800
801
            $var = [];
802
            if (is_array($photo)) {
803
                foreach ($photo as $elm) {
804
                    $var[] = json_decode($elm, true);
805
                }
806
807
                $photo = json_encode($var);
808
            } else {
809
                $photo = '';
810
            }
811
812
            $sth->bindParam(':photo', $photo, PDO::PARAM_STR);
813
            $sth->bindParam(':sticker', $sticker, PDO::PARAM_STR);
@@ 826-834 (lines=9) @@
823
824
            //Array of PhotoSize
825
            $var = [];
826
            if (is_array($new_chat_photo)) {
827
                foreach ($new_chat_photo as $elm) {
828
                    $var[] = json_decode($elm, true);
829
                }
830
831
                $new_chat_photo = json_encode($var);
832
            } else {
833
                $new_chat_photo = '';
834
            }
835
836
            $sth->bindParam(':new_chat_photo', $new_chat_photo, PDO::PARAM_STR);
837
            $sth->bindParam(':delete_chat_photo', $delete_chat_photo, PDO::PARAM_STR);
@@ 901-909 (lines=9) @@
898
            $sth->bindParam(':date', $edit_date, PDO::PARAM_STR);
899
900
            $var = [];
901
            if (is_array($entities)) {
902
                foreach ($entities as $elm) {
903
                    $var[] = json_decode($elm, true);
904
                }
905
906
                $entities = json_encode($var);
907
            } else {
908
                $entities = null;
909
            }
910
911
            $sth->bindParam(':text', $text, PDO::PARAM_STR);
912
            $sth->bindParam(':entities', $entities, PDO::PARAM_STR);