Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / common / tests / Doctrine / Tests / Common / Annotations / Fixtures / ClassWithClosure.php
1 <?php
2
3 namespace Doctrine\Tests\Common\Annotations\Fixtures;
4
5 use Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll;
6 use Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation;
7
8 /**
9  * @AnnotationTargetAll("Foo")
10  */
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         $self = $this;
29         return function() use ($self, $callback) {
30             return $callback;
31         };
32     }
33
34     /**
35      * @param   integer $year
36      * @param   integer $month
37      * @param   integer $day
38      * @return  \Doctrine\Common\Collections\ArrayCollection
39      */
40     public function getEventsForDate($year, $month, $day){
41         $extractEvents  = null; // check if date of item is inside day given
42         $extractEvents  = $this->events->filter(function ($item) use ($year, $month, $day) {
43             $leftDate   = new \DateTime($year.'-'.$month.'-'.$day.' 00:00');
44             $rigthDate  = new \DateTime($year.'-'.$month.'-'.$day.' +1 day 00:00');
45             return ( ( $leftDate <= $item->getDateStart() ) && ( $item->getDateStart() < $rigthDate ) );
46
47             }
48         );
49         return $extractEvents;
50     }
51
52 }