Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php  | 
            ||
| 25 | 	class Give_Stripe_Logs { | 
            ||
| 26 | |||
| 27 | /**  | 
            ||
| 28 | * Set single instance.  | 
            ||
| 29 | *  | 
            ||
| 30 | * @since 2.5.0  | 
            ||
| 31 | * @access private  | 
            ||
| 32 | *  | 
            ||
| 33 | * @var Give_Stripe_Logs $instance  | 
            ||
| 34 | */  | 
            ||
| 35 | private static $instance;  | 
            ||
| 36 | |||
| 37 | /**  | 
            ||
| 38 | * Get single instance of class object.  | 
            ||
| 39 | *  | 
            ||
| 40 | * @since 2.5.0  | 
            ||
| 41 | * @access public  | 
            ||
| 42 | *  | 
            ||
| 43 | * @return Give_Stripe_Logs  | 
            ||
| 44 | */  | 
            ||
| 45 | 		public static function get_instance() { | 
            ||
| 52 | |||
| 53 | /**  | 
            ||
| 54 | * Setup hooks.  | 
            ||
| 55 | *  | 
            ||
| 56 | * @since 2.5.0  | 
            ||
| 57 | * @access public  | 
            ||
| 58 | */  | 
            ||
| 59 | 		public function setup_hooks() { | 
            ||
| 70 | |||
| 71 | /**  | 
            ||
| 72 | * This function will set new stripe log type as valid log type.  | 
            ||
| 73 | *  | 
            ||
| 74 | * @param array $types List of log types.  | 
            ||
| 75 | *  | 
            ||
| 76 | * @since 2.5.0  | 
            ||
| 77 | * @access public  | 
            ||
| 78 | *  | 
            ||
| 79 | * @return array  | 
            ||
| 80 | */  | 
            ||
| 81 | 		public function set_stripe_log_type( $types ) { | 
            ||
| 87 | |||
| 88 | /**  | 
            ||
| 89 | * This function will set new stripe log section.  | 
            ||
| 90 | *  | 
            ||
| 91 | * @param array $sections List of log sections.  | 
            ||
| 92 | *  | 
            ||
| 93 | * @since 2.5.0  | 
            ||
| 94 | * @access public  | 
            ||
| 95 | *  | 
            ||
| 96 | * @return array  | 
            ||
| 97 | */  | 
            ||
| 98 | 		public function set_stripe_log_section( $sections ) { | 
            ||
| 106 | |||
| 107 | |||
| 108 | /**  | 
            ||
| 109 | * Stripe Logs View  | 
            ||
| 110 | *  | 
            ||
| 111 | * @since 2.5.0  | 
            ||
| 112 | *  | 
            ||
| 113 | * @return void  | 
            ||
| 114 | */  | 
            ||
| 115 | View Code Duplication | 		public function give_stripe_logs_view() { | 
            |
| 150 | |||
| 151 | }  | 
            ||
| 152 | }  | 
            ||
| 155 | 
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.