Issues (3627)

app/bundles/CalendarBundle/Model/CalendarModel.php (1 issue)

1
<?php
2
3
/*
4
 * @copyright   2014 Mautic Contributors. All rights reserved
5
 * @author      Mautic
6
 *
7
 * @link        http://mautic.org
8
 *
9
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
 */
11
12
namespace Mautic\CalendarBundle\Model;
13
14
use Mautic\CalendarBundle\CalendarEvents;
15
use Mautic\CalendarBundle\Event\CalendarGeneratorEvent;
16
use Mautic\CalendarBundle\Event\EventGeneratorEvent;
17
use Mautic\CoreBundle\Model\FormModel;
18
19
/**
20
 * Class CalendarModel.
21
 */
22
class CalendarModel extends FormModel
23
{
24
    /**
25
     * Collects data for the calendar display.
26
     *
27
     * @param array $dates Associative array containing a 'start_date' and 'end_date' key
28
     *
29
     * @return array
30
     */
31
    public function getCalendarEvents(array $dates)
32
    {
33
        $event = new CalendarGeneratorEvent($dates);
34
        $this->dispatcher->dispatch(CalendarEvents::CALENDAR_ON_GENERATE, $event);
35
36
        return $event->getEvents();
37
    }
38
39
    /**
40
     * Collects data for the calendar display.
41
     *
42
     * @param string $bundle
43
     * @param int    $id
44
     *
45
     * @return array
46
     */
47
    public function editCalendarEvent($bundle, $id)
48
    {
49
        $event = new EventGeneratorEvent($bundle, $id);
50
        $this->dispatcher->dispatch(CalendarEvents::CALENDAR_EVENT_ON_GENERATE, $event);
51
52
        return $event;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $event returns the type Mautic\CalendarBundle\Event\EventGeneratorEvent which is incompatible with the documented return type array.
Loading history...
53
    }
54
}
55