| Conditions | 6 | 
| Paths | 13 | 
| Total Lines | 24 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 16 | 
| CRAP Score | 6 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 19 | 107 | public function getName()  | 
            |
| 20 |     { | 
            ||
| 21 | 107 |         if (!empty($this->config)) { | 
            |
| 22 | 95 | return $this->config->getName();  | 
            |
| 
                                                                                                    
                        
                         | 
                |||
| 23 | }  | 
            ||
| 24 | |||
| 25 | 49 | $className = get_called_class();  | 
            |
| 26 | |||
| 27 | 49 |         if ($prevPos = strrpos($className, '\\')) { | 
            |
| 28 | 49 | $className = substr($className, $prevPos + 1);  | 
            |
| 29 | 49 | }  | 
            |
| 30 | 49 |         if (substr($className, -5) == 'Field') { | 
            |
| 31 | 4 | $className = lcfirst(substr($className, 0, -5));  | 
            |
| 32 | 49 |         } elseif (substr($className, -4) == 'Type') { | 
            |
| 33 | 46 | $className = substr($className, 0, -4);  | 
            |
| 34 | 46 | }  | 
            |
| 35 | |||
| 36 | 49 |         if ($this instanceof FieldInterface) { | 
            |
| 37 | 3 | $className = lcfirst($className);  | 
            |
| 38 | 3 | }  | 
            |
| 39 | |||
| 40 | |||
| 41 | 49 | return $className;  | 
            |
| 42 | }  | 
            ||
| 43 | |||
| 45 | 
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: