| Conditions | 5 |
| Paths | 5 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | 5 | private function getDates( Subject $subject ): array { |
|
| 33 | 5 | $startDate = null; |
|
| 34 | 5 | $endDate = null; |
|
| 35 | |||
| 36 | 5 | foreach ( $this->getPropertyValueCollectionsWithDates( $subject ) as $propertyValues ) { |
|
| 37 | 4 | $dataItem = $propertyValues->getDataItems()[0]; |
|
| 38 | |||
| 39 | 4 | if ( $dataItem instanceof SMWDITime ) { |
|
| 40 | 4 | if ( $startDate === null ) { |
|
| 41 | 4 | $startDate = $dataItem; |
|
| 42 | } |
||
| 43 | 1 | else if ( $endDate === null ) { |
|
| 44 | 1 | $endDate = $dataItem; |
|
| 45 | 1 | break; |
|
| 46 | } |
||
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 50 | 5 | return [ $startDate, $endDate ]; |
|
| 51 | } |
||
| 52 | |||
| 67 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.