| Total Complexity | 3 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | final class ClassWithClosure |
||
| 12 | { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @AnnotationTargetAll(@AnnotationTargetAnnotation) |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | public $value; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @AnnotationTargetAll(@AnnotationTargetAnnotation) |
||
| 22 | * |
||
| 23 | * @param \Closure $callback |
||
| 24 | * @return \Closure |
||
| 25 | */ |
||
| 26 | public function methodName(\Closure $callback) |
||
| 27 | { |
||
| 28 | return function() use ($callback) { |
||
| 29 | return $callback; |
||
| 30 | }; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param integer $year |
||
| 35 | * @param integer $month |
||
| 36 | * @param integer $day |
||
| 37 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
| 38 | */ |
||
| 39 | public function getEventsForDate($year, $month, $day){ |
||
| 40 | $extractEvents = null; // check if date of item is inside day given |
||
| 41 | $extractEvents = $this->events->filter(function ($item) use ($year, $month, $day) { |
||
| 42 | $leftDate = new \DateTime($year.'-'.$month.'-'.$day.' 00:00'); |
||
| 43 | $rigthDate = new \DateTime($year.'-'.$month.'-'.$day.' +1 day 00:00'); |
||
| 44 | return ( ( $leftDate <= $item->getDateStart() ) && ( $item->getDateStart() < $rigthDate ) ); |
||
| 45 | |||
| 46 | } |
||
| 47 | ); |
||
| 48 | return $extractEvents; |
||
| 49 | } |
||
| 52 |