clubdeuce /
wplib-olm-google-maps
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Clubdeuce\WPLib\Components\GoogleMaps; |
||
| 4 | |||
| 5 | /** |
||
| 6 | * Class Marker_Label_Model |
||
| 7 | * @package Clubdeuce\WPLib\Components\GoogleMaps |
||
| 8 | * |
||
| 9 | * @mixin Marker_Label; |
||
| 10 | */ |
||
| 11 | View Code Duplication | class Marker_Label_Model extends Model_Base { |
|
|
0 ignored issues
–
show
|
|||
| 12 | |||
| 13 | /** |
||
| 14 | * @var \Clubdeuce\WPGoogleMaps\Marker_Label |
||
| 15 | */ |
||
| 16 | protected $_label; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @return bool |
||
| 20 | */ |
||
| 21 | 1 | function has_label() { |
|
| 22 | |||
| 23 | 1 | return $this->_has( '_label' ); |
|
| 24 | |||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param string $method_name |
||
| 29 | * @param array $args |
||
| 30 | * |
||
| 31 | * @return mixed |
||
| 32 | */ |
||
| 33 | 1 | function __call( $method_name, $args = array() ) { |
|
| 34 | 1 | $value = null; |
|
| 35 | |||
| 36 | do { |
||
| 37 | |||
| 38 | 1 | if ( property_exists( $this, "_{$method_name}" ) ) { |
|
| 39 | $property = "_{$method_name}"; |
||
| 40 | $value = $this->{$property}; |
||
| 41 | break; |
||
| 42 | } |
||
| 43 | |||
| 44 | 1 | if ( ! isset( $this->_label ) ) { |
|
| 45 | break; |
||
| 46 | } |
||
| 47 | |||
| 48 | 1 | $value = call_user_func_array( array( $this->_label, $method_name ), $args ); |
|
| 49 | |||
| 50 | 1 | } while ( false ); |
|
| 51 | |||
| 52 | 1 | return $value; |
|
| 53 | } |
||
| 54 | |||
| 55 | } |
||
| 56 |
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.