@@ -7,90 +7,90 @@ |
||
7 | 7 | class WeeklySchedule extends Collection |
8 | 8 | { |
9 | 9 | |
10 | - public static function mergeFromTimeSlots(Collection $timeSlots) |
|
11 | - { |
|
12 | - $scheduledShows = new Collection(); |
|
13 | - $timeSlots = $timeSlots->reduce(function($scheduledShows, $timeslot) { |
|
14 | - $scheduledShow = $scheduledShows->last(); |
|
15 | - if (static::showContinuesIntoCurrentTimeslot($scheduledShow, $timeslot)) |
|
16 | - { |
|
17 | - $scheduledShow->extendShowByHour(); |
|
18 | - } |
|
19 | - else |
|
20 | - { |
|
21 | - $show = ScheduledShow::fromShowAndDJ($timeslot->showForTimeslot, $timeslot->djForTimeslot); |
|
22 | - $show->setId($timeslot->id); |
|
23 | - $show->startsAt($timeslot->hour); |
|
24 | - $show->airsDayOfWeek($timeslot->day); |
|
25 | - $scheduledShows->push($show); |
|
26 | - } |
|
27 | - return $scheduledShows; |
|
28 | - }, $scheduledShows); |
|
29 | - $weeklySchedule = new WeeklySchedule($timeSlots); |
|
10 | + public static function mergeFromTimeSlots(Collection $timeSlots) |
|
11 | + { |
|
12 | + $scheduledShows = new Collection(); |
|
13 | + $timeSlots = $timeSlots->reduce(function($scheduledShows, $timeslot) { |
|
14 | + $scheduledShow = $scheduledShows->last(); |
|
15 | + if (static::showContinuesIntoCurrentTimeslot($scheduledShow, $timeslot)) |
|
16 | + { |
|
17 | + $scheduledShow->extendShowByHour(); |
|
18 | + } |
|
19 | + else |
|
20 | + { |
|
21 | + $show = ScheduledShow::fromShowAndDJ($timeslot->showForTimeslot, $timeslot->djForTimeslot); |
|
22 | + $show->setId($timeslot->id); |
|
23 | + $show->startsAt($timeslot->hour); |
|
24 | + $show->airsDayOfWeek($timeslot->day); |
|
25 | + $scheduledShows->push($show); |
|
26 | + } |
|
27 | + return $scheduledShows; |
|
28 | + }, $scheduledShows); |
|
29 | + $weeklySchedule = new WeeklySchedule($timeSlots); |
|
30 | 30 | |
31 | - return $weeklySchedule; |
|
32 | - } |
|
31 | + return $weeklySchedule; |
|
32 | + } |
|
33 | 33 | |
34 | - public static function fromTimeSlots(Collection $timeSlots) |
|
35 | - { |
|
36 | - $timeSlots = $timeSlots->map(function($timeslot) { |
|
37 | - $show = ScheduledShow::fromShowAndDJ($timeslot->showForTimeslot, $timeslot->djForTimeslot); |
|
38 | - $show->setId($timeslot->id); |
|
39 | - $show->startsAt($timeslot->hour); |
|
40 | - $show->airsDayOfWeek($timeslot->day); |
|
41 | - return $show; |
|
42 | - }); |
|
34 | + public static function fromTimeSlots(Collection $timeSlots) |
|
35 | + { |
|
36 | + $timeSlots = $timeSlots->map(function($timeslot) { |
|
37 | + $show = ScheduledShow::fromShowAndDJ($timeslot->showForTimeslot, $timeslot->djForTimeslot); |
|
38 | + $show->setId($timeslot->id); |
|
39 | + $show->startsAt($timeslot->hour); |
|
40 | + $show->airsDayOfWeek($timeslot->day); |
|
41 | + return $show; |
|
42 | + }); |
|
43 | 43 | |
44 | - return new WeeklySchedule($timeSlots); |
|
45 | - } |
|
44 | + return new WeeklySchedule($timeSlots); |
|
45 | + } |
|
46 | 46 | |
47 | - private static function showContinuesIntoCurrentTimeslot($scheduledShow, $timeslot) |
|
48 | - { |
|
49 | - return $scheduledShow != null |
|
50 | - && $scheduledShow->djId() == $timeslot->djForTimeslot->id |
|
51 | - && $scheduledShow->showId() == $timeslot->showForTimeslot->id |
|
52 | - && $scheduledShow->airDayOfWeek() == $timeslot->day; |
|
53 | - } |
|
47 | + private static function showContinuesIntoCurrentTimeslot($scheduledShow, $timeslot) |
|
48 | + { |
|
49 | + return $scheduledShow != null |
|
50 | + && $scheduledShow->djId() == $timeslot->djForTimeslot->id |
|
51 | + && $scheduledShow->showId() == $timeslot->showForTimeslot->id |
|
52 | + && $scheduledShow->airDayOfWeek() == $timeslot->day; |
|
53 | + } |
|
54 | 54 | |
55 | - public function scheduleFor($weekday) |
|
56 | - { |
|
57 | - return $this->filter(function($timeslot) use ($weekday) { |
|
58 | - return $timeslot->airDayOfWeek() == $weekday; |
|
59 | - }); |
|
60 | - } |
|
55 | + public function scheduleFor($weekday) |
|
56 | + { |
|
57 | + return $this->filter(function($timeslot) use ($weekday) { |
|
58 | + return $timeslot->airDayOfWeek() == $weekday; |
|
59 | + }); |
|
60 | + } |
|
61 | 61 | |
62 | - public function getShowsForSlideshow() |
|
63 | - { |
|
64 | - $shows = new Collection(); |
|
65 | - $sortedShows = $this->getShowsInPlayOrder(); |
|
66 | - $shows->push($sortedShows->shift()); |
|
67 | - $nonPulseShows = $sortedShows->filter(function ($show) { |
|
68 | - return strtolower($show->show()) != 'the pulse of music'; |
|
69 | - }); |
|
62 | + public function getShowsForSlideshow() |
|
63 | + { |
|
64 | + $shows = new Collection(); |
|
65 | + $sortedShows = $this->getShowsInPlayOrder(); |
|
66 | + $shows->push($sortedShows->shift()); |
|
67 | + $nonPulseShows = $sortedShows->filter(function ($show) { |
|
68 | + return strtolower($show->show()) != 'the pulse of music'; |
|
69 | + }); |
|
70 | 70 | |
71 | - $shows = $shows->merge($nonPulseShows->take(2)); |
|
71 | + $shows = $shows->merge($nonPulseShows->take(2)); |
|
72 | 72 | |
73 | - do |
|
74 | - { |
|
75 | - $random = $nonPulseShows->random(); |
|
76 | - $exists = $shows->filter(function($show) use($random) { |
|
77 | - return $show->showId() == $random->showId(); |
|
78 | - }); |
|
79 | - } while(!$exists->isEmpty()); |
|
73 | + do |
|
74 | + { |
|
75 | + $random = $nonPulseShows->random(); |
|
76 | + $exists = $shows->filter(function($show) use($random) { |
|
77 | + return $show->showId() == $random->showId(); |
|
78 | + }); |
|
79 | + } while(!$exists->isEmpty()); |
|
80 | 80 | |
81 | - $shows->push($random); |
|
81 | + $shows->push($random); |
|
82 | 82 | |
83 | - return $shows; |
|
84 | - } |
|
83 | + return $shows; |
|
84 | + } |
|
85 | 85 | |
86 | - public function getShowsInPlayOrder() |
|
87 | - { |
|
88 | - $first = $this->first(function ($key, $show) { |
|
89 | - return $show->nowPlaying(); |
|
90 | - }); |
|
91 | - $firstKey = $this->search($first); |
|
92 | - $sorted = $this->slice($firstKey); |
|
93 | - $firstHalfSorted = $this->slice(0, $firstKey); |
|
94 | - return $sorted->merge($firstHalfSorted); |
|
95 | - } |
|
86 | + public function getShowsInPlayOrder() |
|
87 | + { |
|
88 | + $first = $this->first(function ($key, $show) { |
|
89 | + return $show->nowPlaying(); |
|
90 | + }); |
|
91 | + $firstKey = $this->search($first); |
|
92 | + $sorted = $this->slice($firstKey); |
|
93 | + $firstHalfSorted = $this->slice(0, $firstKey); |
|
94 | + return $sorted->merge($firstHalfSorted); |
|
95 | + } |
|
96 | 96 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $shows = new Collection(); |
65 | 65 | $sortedShows = $this->getShowsInPlayOrder(); |
66 | 66 | $shows->push($sortedShows->shift()); |
67 | - $nonPulseShows = $sortedShows->filter(function ($show) { |
|
67 | + $nonPulseShows = $sortedShows->filter(function($show) { |
|
68 | 68 | return strtolower($show->show()) != 'the pulse of music'; |
69 | 69 | }); |
70 | 70 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $exists = $shows->filter(function($show) use($random) { |
77 | 77 | return $show->showId() == $random->showId(); |
78 | 78 | }); |
79 | - } while(!$exists->isEmpty()); |
|
79 | + } while (!$exists->isEmpty()); |
|
80 | 80 | |
81 | 81 | $shows->push($random); |
82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | public function getShowsInPlayOrder() |
87 | 87 | { |
88 | - $first = $this->first(function ($key, $show) { |
|
88 | + $first = $this->first(function($key, $show) { |
|
89 | 89 | return $show->nowPlaying(); |
90 | 90 | }); |
91 | 91 | $firstKey = $this->search($first); |
@@ -15,8 +15,7 @@ |
||
15 | 15 | if (static::showContinuesIntoCurrentTimeslot($scheduledShow, $timeslot)) |
16 | 16 | { |
17 | 17 | $scheduledShow->extendShowByHour(); |
18 | - } |
|
19 | - else |
|
18 | + } else |
|
20 | 19 | { |
21 | 20 | $show = ScheduledShow::fromShowAndDJ($timeslot->showForTimeslot, $timeslot->djForTimeslot); |
22 | 21 | $show->setId($timeslot->id); |
@@ -7,27 +7,27 @@ |
||
7 | 7 | class IcecastListeners extends Collection |
8 | 8 | { |
9 | 9 | |
10 | - protected $mounts; |
|
10 | + protected $mounts; |
|
11 | 11 | |
12 | - public static function forMounts($mounts) |
|
13 | - { |
|
14 | - $listeners = new IcecastListeners(); |
|
12 | + public static function forMounts($mounts) |
|
13 | + { |
|
14 | + $listeners = new IcecastListeners(); |
|
15 | 15 | |
16 | - $listeners->mounts = $mounts; |
|
16 | + $listeners->mounts = $mounts; |
|
17 | 17 | |
18 | - return $listeners; |
|
19 | - } |
|
18 | + return $listeners; |
|
19 | + } |
|
20 | 20 | |
21 | - public function getMounts() |
|
22 | - { |
|
23 | - return $this->mounts; |
|
24 | - } |
|
21 | + public function getMounts() |
|
22 | + { |
|
23 | + return $this->mounts; |
|
24 | + } |
|
25 | 25 | |
26 | - public function forMount($mount) |
|
27 | - { |
|
28 | - return $this->filter(function($listener) use($mount) { |
|
29 | - return $listener->mount == $mount; |
|
30 | - }); |
|
31 | - } |
|
26 | + public function forMount($mount) |
|
27 | + { |
|
28 | + return $this->filter(function($listener) use($mount) { |
|
29 | + return $listener->mount == $mount; |
|
30 | + }); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | } |
@@ -4,104 +4,104 @@ |
||
4 | 4 | |
5 | 5 | class Slide |
6 | 6 | { |
7 | - protected $show; |
|
8 | - protected $type; |
|
9 | - protected $playOrder; |
|
10 | - protected $index; |
|
11 | - |
|
12 | - public static function fromScheduledShow($show) |
|
13 | - { |
|
14 | - $slide = new Slide(); |
|
15 | - |
|
16 | - $slide->type = 'SHOW'; |
|
17 | - $slide->show = $show; |
|
18 | - |
|
19 | - return $slide; |
|
20 | - } |
|
21 | - |
|
22 | - public static function fromEvent($event) |
|
23 | - { |
|
24 | - $slide = new Slide(); |
|
25 | - |
|
26 | - $slide->type = 'EVENT'; |
|
27 | - $slide->event = $event; |
|
28 | - |
|
29 | - return $slide; |
|
30 | - } |
|
31 | - |
|
32 | - public function playOrder($playOrder) |
|
33 | - { |
|
34 | - $this->playOrder = $playOrder; |
|
35 | - } |
|
36 | - |
|
37 | - public function displayText() |
|
38 | - { |
|
39 | - if ($this->type == 'EVENT') |
|
40 | - { |
|
41 | - return; |
|
42 | - } |
|
43 | - |
|
44 | - if ($this->playOrder == 0) |
|
45 | - { |
|
46 | - return '► Now Playing'; |
|
47 | - } |
|
48 | - |
|
49 | - if ($this->playOrder == 1) |
|
50 | - { |
|
51 | - return 'Up Next:'; |
|
52 | - } |
|
53 | - |
|
54 | - return $this->show->getRelativeAirDate() . ' ' . $this->show->timespan(); |
|
55 | - } |
|
56 | - |
|
57 | - public function image() |
|
58 | - { |
|
59 | - if ($this->type == 'EVENT') |
|
60 | - { |
|
61 | - return $this->event->picture; |
|
62 | - } |
|
63 | - |
|
64 | - return $this->show->sliderPicture(); |
|
65 | - } |
|
66 | - |
|
67 | - public function textStyle() |
|
68 | - { |
|
69 | - if ($this->type != 'SHOW') |
|
70 | - { |
|
71 | - return; |
|
72 | - } |
|
7 | + protected $show; |
|
8 | + protected $type; |
|
9 | + protected $playOrder; |
|
10 | + protected $index; |
|
11 | + |
|
12 | + public static function fromScheduledShow($show) |
|
13 | + { |
|
14 | + $slide = new Slide(); |
|
15 | + |
|
16 | + $slide->type = 'SHOW'; |
|
17 | + $slide->show = $show; |
|
18 | + |
|
19 | + return $slide; |
|
20 | + } |
|
21 | + |
|
22 | + public static function fromEvent($event) |
|
23 | + { |
|
24 | + $slide = new Slide(); |
|
25 | + |
|
26 | + $slide->type = 'EVENT'; |
|
27 | + $slide->event = $event; |
|
28 | + |
|
29 | + return $slide; |
|
30 | + } |
|
31 | + |
|
32 | + public function playOrder($playOrder) |
|
33 | + { |
|
34 | + $this->playOrder = $playOrder; |
|
35 | + } |
|
36 | + |
|
37 | + public function displayText() |
|
38 | + { |
|
39 | + if ($this->type == 'EVENT') |
|
40 | + { |
|
41 | + return; |
|
42 | + } |
|
43 | + |
|
44 | + if ($this->playOrder == 0) |
|
45 | + { |
|
46 | + return '► Now Playing'; |
|
47 | + } |
|
48 | + |
|
49 | + if ($this->playOrder == 1) |
|
50 | + { |
|
51 | + return 'Up Next:'; |
|
52 | + } |
|
53 | + |
|
54 | + return $this->show->getRelativeAirDate() . ' ' . $this->show->timespan(); |
|
55 | + } |
|
56 | + |
|
57 | + public function image() |
|
58 | + { |
|
59 | + if ($this->type == 'EVENT') |
|
60 | + { |
|
61 | + return $this->event->picture; |
|
62 | + } |
|
63 | + |
|
64 | + return $this->show->sliderPicture(); |
|
65 | + } |
|
66 | + |
|
67 | + public function textStyle() |
|
68 | + { |
|
69 | + if ($this->type != 'SHOW') |
|
70 | + { |
|
71 | + return; |
|
72 | + } |
|
73 | 73 | |
74 | - return $this->show->sliderStyle(); |
|
75 | - } |
|
76 | - |
|
77 | - public function url() |
|
78 | - { |
|
79 | - if ($this->type != 'EVENT') |
|
80 | - { |
|
81 | - return; |
|
82 | - } |
|
83 | - |
|
84 | - return $this->event->url; |
|
85 | - } |
|
86 | - |
|
87 | - public function type() |
|
88 | - { |
|
89 | - return $this->type; |
|
90 | - } |
|
91 | - |
|
92 | - public function index($index) |
|
93 | - { |
|
94 | - $this->index = $index; |
|
95 | - } |
|
96 | - |
|
97 | - public function displayIndex() |
|
98 | - { |
|
99 | - $display = [ |
|
100 | - 0 => 'first', |
|
101 | - 1 => 'second', |
|
102 | - 2 => 'third', |
|
103 | - 3 => 'fourth', |
|
104 | - ]; |
|
105 | - return $display[$this->index]; |
|
106 | - } |
|
74 | + return $this->show->sliderStyle(); |
|
75 | + } |
|
76 | + |
|
77 | + public function url() |
|
78 | + { |
|
79 | + if ($this->type != 'EVENT') |
|
80 | + { |
|
81 | + return; |
|
82 | + } |
|
83 | + |
|
84 | + return $this->event->url; |
|
85 | + } |
|
86 | + |
|
87 | + public function type() |
|
88 | + { |
|
89 | + return $this->type; |
|
90 | + } |
|
91 | + |
|
92 | + public function index($index) |
|
93 | + { |
|
94 | + $this->index = $index; |
|
95 | + } |
|
96 | + |
|
97 | + public function displayIndex() |
|
98 | + { |
|
99 | + $display = [ |
|
100 | + 0 => 'first', |
|
101 | + 1 => 'second', |
|
102 | + 2 => 'third', |
|
103 | + 3 => 'fourth', |
|
104 | + ]; |
|
105 | + return $display[$this->index]; |
|
106 | + } |
|
107 | 107 | } |
@@ -7,27 +7,27 @@ |
||
7 | 7 | class Slides extends Collection |
8 | 8 | { |
9 | 9 | |
10 | - public static function forShows($shows) |
|
11 | - { |
|
12 | - $slides = new Slides(); |
|
10 | + public static function forShows($shows) |
|
11 | + { |
|
12 | + $slides = new Slides(); |
|
13 | 13 | |
14 | - foreach ($shows as $key => $show) { |
|
15 | - $slide = Slide::fromScheduledShow($show); |
|
16 | - $slide->playOrder($key); |
|
17 | - $slide->index($key); |
|
18 | - $slides->push($slide); |
|
19 | - } |
|
14 | + foreach ($shows as $key => $show) { |
|
15 | + $slide = Slide::fromScheduledShow($show); |
|
16 | + $slide->playOrder($key); |
|
17 | + $slide->index($key); |
|
18 | + $slides->push($slide); |
|
19 | + } |
|
20 | 20 | |
21 | - return $slides; |
|
22 | - } |
|
21 | + return $slides; |
|
22 | + } |
|
23 | 23 | |
24 | - public function addEvent($event) |
|
25 | - { |
|
26 | - $this->pop(); |
|
27 | - $this->prepend(Slide::fromEvent($event)); |
|
28 | - $index = 0; |
|
29 | - foreach ($this as $value) { |
|
30 | - $value->index($index++); |
|
31 | - } |
|
32 | - } |
|
24 | + public function addEvent($event) |
|
25 | + { |
|
26 | + $this->pop(); |
|
27 | + $this->prepend(Slide::fromEvent($event)); |
|
28 | + $index = 0; |
|
29 | + foreach ($this as $value) { |
|
30 | + $value->index($index++); |
|
31 | + } |
|
32 | + } |
|
33 | 33 | } |
@@ -21,12 +21,12 @@ |
||
21 | 21 | public $timestamps = false; |
22 | 22 | |
23 | 23 | public function setUrlTagAttribute($value) |
24 | - { |
|
25 | - parse_str( parse_url( $value, PHP_URL_QUERY ), $params ); |
|
24 | + { |
|
25 | + parse_str( parse_url( $value, PHP_URL_QUERY ), $params ); |
|
26 | 26 | if (isset($params['v']) || array_key_exists('v', $params)) { |
27 | 27 | $this->attributes['url_tag'] = $params['v']; |
28 | 28 | } else { |
29 | 29 | $this->attributes['url_tag'] = $value; |
30 | 30 | } |
31 | - } |
|
31 | + } |
|
32 | 32 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | public function setUrlTagAttribute($value) |
24 | 24 | { |
25 | - parse_str( parse_url( $value, PHP_URL_QUERY ), $params ); |
|
25 | + parse_str(parse_url($value, PHP_URL_QUERY), $params); |
|
26 | 26 | if (isset($params['v']) || array_key_exists('v', $params)) { |
27 | 27 | $this->attributes['url_tag'] = $params['v']; |
28 | 28 | } else { |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | class DJsViewComposer { |
9 | 9 | |
10 | - protected $djs; |
|
10 | + protected $djs; |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Bind data to the view. |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | * @return void |
17 | 17 | */ |
18 | 18 | public function compose(View $view) |
19 | - { |
|
20 | - if ($this->djs == null) { |
|
21 | - $this->djs = DJ::orderBy('name', 'asc')->get(); |
|
22 | - } |
|
19 | + { |
|
20 | + if ($this->djs == null) { |
|
21 | + $this->djs = DJ::orderBy('name', 'asc')->get(); |
|
22 | + } |
|
23 | 23 | $view->with('djs', $this->djs); |
24 | 24 | } |
25 | 25 | } |
@@ -18,8 +18,8 @@ |
||
18 | 18 | */ |
19 | 19 | public function compose(View $view) |
20 | 20 | { |
21 | - $client = new Client(); |
|
22 | - try { |
|
21 | + $client = new Client(); |
|
22 | + try { |
|
23 | 23 | $response = $client->get('http://logger.witr.rit.edu/latest.json', [ |
24 | 24 | 'timeout' => 1, |
25 | 25 | ]); |