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  | 
            ||
| 9 | class BlocksUtility extends Object { | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 10 | |||
| 11 | /**  | 
            ||
| 12 | * Patterns to parse video's id on different providers.  | 
            ||
| 13 | *  | 
            ||
| 14 | * @var array  | 
            ||
| 15 | * @config  | 
            ||
| 16 | */  | 
            ||
| 17 | private static $patterns = [  | 
            ||
| 
                                                                                                    
                         1 ignored issue 
                            –
                            show
                         | 
                |||
| 18 | 'youtube' => '/^(?:http(?:s)?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com\/(?:(?:watch)?\?(?:.*&)?v(?:i)?=|(?:embed|v|vi|user)\/))([^\?&\"\'>]+)/',  | 
            ||
| 19 | 'vimeo' => '/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/',  | 
            ||
| 20 | ];  | 
            ||
| 21 | |||
| 22 | /**  | 
            ||
| 23 | * Parse video's id of the given URL address.  | 
            ||
| 24 | *  | 
            ||
| 25 | * @param string $url | url address to the video  | 
            ||
| 26 | * @param string $provider | default: youtube (supports - youtube, vimeo)  | 
            ||
| 27 | *  | 
            ||
| 28 | * @return string  | 
            ||
| 29 | * @throws ProviderNotFound  | 
            ||
| 30 | */  | 
            ||
| 31 |     public static function parse_video_id($url, $provider = 'youtube') { | 
            ||
| 52 | |||
| 53 | /**  | 
            ||
| 54 | * Get localized answers example 0 - No, 1 - Yes. This mostly using  | 
            ||
| 55 | * for drop down fields.  | 
            ||
| 56 | *  | 
            ||
| 57 | * @return array  | 
            ||
| 58 | */  | 
            ||
| 59 |     public static function localized_answers() { | 
            ||
| 65 | }  | 
            
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.