| Conditions | 4 | 
| Paths | 5 | 
| Total Lines | 30 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 21 | 
| CRAP Score | 4.0015 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 57 | 1 | 	public function addAnnotation( DIProperty $property, SemanticData $semanticData ) { | 
            |
| 58 | |||
| 59 | 1 | $title = $semanticData->getSubject()->getTitle();  | 
            |
| 60 | |||
| 61 | 1 | 		if ( !$title->inNamespace( NS_USER ) ) { | 
            |
| 62 | return;  | 
            ||
| 63 | }  | 
            ||
| 64 | |||
| 65 | 1 | $user = $this->appFactory->newUserFromTitle( $title );  | 
            |
| 
                                                                                                    
                        
                         | 
                |||
| 66 | 1 | $dataItem = null;  | 
            |
| 67 | |||
| 68 | 1 | 		if ( $user instanceof User ) { | 
            |
| 69 | |||
| 70 | 1 | $timestamp = wfTimestamp( TS_ISO_8601, $user->getRegistration() );  | 
            |
| 71 | 1 | $date = new \DateTime( $timestamp );  | 
            |
| 72 | |||
| 73 | 1 | $dataItem = new DITime(  | 
            |
| 74 | 1 | DITime::CM_GREGORIAN,  | 
            |
| 75 | 1 | 				$date->format('Y'), | 
            |
| 76 | 1 | 				$date->format('m'), | 
            |
| 77 | 1 | 				$date->format('d'), | 
            |
| 78 | 1 | 				$date->format('H'), | 
            |
| 79 | 1 | 				$date->format('i') | 
            |
| 80 | 1 | );  | 
            |
| 81 | 1 | }  | 
            |
| 82 | |||
| 83 | 1 | 		if ( $dataItem instanceof DataItem ) { | 
            |
| 84 | 1 | $semanticData->addPropertyObjectValue( $property, $dataItem );  | 
            |
| 85 | 1 | }  | 
            |
| 86 | 1 | }  | 
            |
| 87 | |||
| 89 | 
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: