@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function index() |
14 | 14 | { |
15 | - $banner = SystemSetting::frontPageBannerText(); |
|
15 | + $banner = SystemSetting::frontPageBannerText(); |
|
16 | 16 | return view('home.index')->withBanner($banner); |
17 | 17 | } |
18 | 18 |
@@ -46,8 +46,7 @@ |
||
46 | 46 | if ($request->ajax()) |
47 | 47 | { |
48 | 48 | return response('Unauthorized.', 401); |
49 | - } |
|
50 | - else |
|
49 | + } else |
|
51 | 50 | { |
52 | 51 | return redirect()->guest('auth/login'); |
53 | 52 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $this->app->bind('WITR\TopTwenty\Reader', 'WITR\TopTwenty\DummyReader'); |
39 | 39 | } |
40 | 40 | |
41 | - if($this->app->environment('local')) |
|
41 | + if ($this->app->environment('local')) |
|
42 | 42 | { |
43 | 43 | $this->app->register('Barryvdh\Debugbar\ServiceProvider'); |
44 | 44 | $this->app->register('Laracasts\Generators\GeneratorsServiceProvider'); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $router->group(['namespace' => $this->namespace], function($router) |
39 | 39 | { |
40 | 40 | require app_path('Http/routes.php'); |
41 | - $router->group(['namespace' => 'Admin', 'prefix' => 'admin'], function ($router) { |
|
41 | + $router->group(['namespace' => 'Admin', 'prefix' => 'admin'], function($router) { |
|
42 | 42 | require app_path('Http/admin_routes.php'); |
43 | 43 | }); |
44 | 44 | }); |
@@ -8,43 +8,43 @@ |
||
8 | 8 | class Reader |
9 | 9 | { |
10 | 10 | |
11 | - protected $parser; |
|
11 | + protected $parser; |
|
12 | 12 | |
13 | - public static function forParser(Parser $parser) |
|
14 | - { |
|
15 | - $reader = new Reader(); |
|
13 | + public static function forParser(Parser $parser) |
|
14 | + { |
|
15 | + $reader = new Reader(); |
|
16 | 16 | |
17 | - $reader->parser = $parser; |
|
17 | + $reader->parser = $parser; |
|
18 | 18 | |
19 | - return $reader; |
|
20 | - } |
|
19 | + return $reader; |
|
20 | + } |
|
21 | 21 | |
22 | - public function get() |
|
23 | - { |
|
24 | - $results = new Collection; |
|
22 | + public function get() |
|
23 | + { |
|
24 | + $results = new Collection; |
|
25 | 25 | |
26 | - $client = new Client(); |
|
27 | - $response = $client->get($this->parser->url(), [ |
|
28 | - 'headers' => ['User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36'] |
|
29 | - ]); |
|
26 | + $client = new Client(); |
|
27 | + $response = $client->get($this->parser->url(), [ |
|
28 | + 'headers' => ['User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36'] |
|
29 | + ]); |
|
30 | 30 | |
31 | - $xml = simplexml_load_string($response->getBody())->channel->item; |
|
32 | - foreach ($xml as $node) |
|
33 | - { |
|
34 | - $this->adjustNamespaces($node); |
|
35 | - $results[] = $this->parser->parse($node); |
|
36 | - } |
|
37 | - |
|
38 | - return $results; |
|
39 | - } |
|
40 | - |
|
41 | - private function adjustNamespaces($el) |
|
42 | - { |
|
43 | - foreach ($el->getNamespaces(TRUE) as $prefix => $ns) { |
|
44 | - $children = $el->children($ns); |
|
45 | - foreach ($children as $tag => $content) { |
|
46 | - $el->{$prefix . ':' . $tag} = $content; |
|
47 | - } |
|
48 | - } |
|
49 | - } |
|
31 | + $xml = simplexml_load_string($response->getBody())->channel->item; |
|
32 | + foreach ($xml as $node) |
|
33 | + { |
|
34 | + $this->adjustNamespaces($node); |
|
35 | + $results[] = $this->parser->parse($node); |
|
36 | + } |
|
37 | + |
|
38 | + return $results; |
|
39 | + } |
|
40 | + |
|
41 | + private function adjustNamespaces($el) |
|
42 | + { |
|
43 | + foreach ($el->getNamespaces(TRUE) as $prefix => $ns) { |
|
44 | + $children = $el->children($ns); |
|
45 | + foreach ($children as $tag => $content) { |
|
46 | + $el->{$prefix . ':' . $tag} = $content; |
|
47 | + } |
|
48 | + } |
|
49 | + } |
|
50 | 50 | } |
@@ -11,5 +11,5 @@ |
||
11 | 11 | */ |
12 | 12 | protected $table = 'user_roles'; |
13 | 13 | |
14 | - public $timestamps = false; |
|
14 | + public $timestamps = false; |
|
15 | 15 | } |
@@ -7,68 +7,68 @@ |
||
7 | 7 | class ScheduleTime |
8 | 8 | { |
9 | 9 | |
10 | - protected $datetime; |
|
10 | + protected $datetime; |
|
11 | 11 | |
12 | - public static function now() |
|
13 | - { |
|
14 | - return ScheduleTime::fromDate(Carbon::now('America/New_York')); |
|
15 | - } |
|
12 | + public static function now() |
|
13 | + { |
|
14 | + return ScheduleTime::fromDate(Carbon::now('America/New_York')); |
|
15 | + } |
|
16 | 16 | |
17 | - public static function setTestNow($now) |
|
18 | - { |
|
19 | - Carbon::setTestNow($now); |
|
20 | - } |
|
17 | + public static function setTestNow($now) |
|
18 | + { |
|
19 | + Carbon::setTestNow($now); |
|
20 | + } |
|
21 | 21 | |
22 | - public function value() |
|
23 | - { |
|
24 | - return $this->datetime; |
|
25 | - } |
|
22 | + public function value() |
|
23 | + { |
|
24 | + return $this->datetime; |
|
25 | + } |
|
26 | 26 | |
27 | - public static function fromDate($datetime) |
|
28 | - { |
|
29 | - $scheduleTime = new ScheduleTime(); |
|
27 | + public static function fromDate($datetime) |
|
28 | + { |
|
29 | + $scheduleTime = new ScheduleTime(); |
|
30 | 30 | |
31 | - $scheduleTime->datetime = $datetime; |
|
31 | + $scheduleTime->datetime = $datetime; |
|
32 | 32 | |
33 | - return $scheduleTime; |
|
34 | - } |
|
33 | + return $scheduleTime; |
|
34 | + } |
|
35 | 35 | |
36 | - public function dayOfWeek() |
|
37 | - { |
|
38 | - $day = $this->datetime->dayOfWeek; |
|
39 | - if ($this->datetime->hour < 1) |
|
40 | - { |
|
41 | - $day--; |
|
42 | - } |
|
43 | - return $day; |
|
44 | - } |
|
36 | + public function dayOfWeek() |
|
37 | + { |
|
38 | + $day = $this->datetime->dayOfWeek; |
|
39 | + if ($this->datetime->hour < 1) |
|
40 | + { |
|
41 | + $day--; |
|
42 | + } |
|
43 | + return $day; |
|
44 | + } |
|
45 | 45 | |
46 | - public function hour() |
|
47 | - { |
|
48 | - $hour = $this->datetime->hour; |
|
49 | - if ($hour == 0) { |
|
50 | - return 24; |
|
51 | - } else { |
|
52 | - return $hour; |
|
53 | - } |
|
54 | - } |
|
46 | + public function hour() |
|
47 | + { |
|
48 | + $hour = $this->datetime->hour; |
|
49 | + if ($hour == 0) { |
|
50 | + return 24; |
|
51 | + } else { |
|
52 | + return $hour; |
|
53 | + } |
|
54 | + } |
|
55 | 55 | |
56 | - public function __get($name) |
|
57 | - { |
|
58 | - if ($name == 'dayOfWeek') |
|
59 | - { |
|
60 | - return $this->dayOfWeek(); |
|
61 | - } |
|
62 | - return $this->datetime->$name; |
|
63 | - } |
|
56 | + public function __get($name) |
|
57 | + { |
|
58 | + if ($name == 'dayOfWeek') |
|
59 | + { |
|
60 | + return $this->dayOfWeek(); |
|
61 | + } |
|
62 | + return $this->datetime->$name; |
|
63 | + } |
|
64 | 64 | |
65 | - public function __call($method, $arguments) |
|
66 | - { |
|
67 | - if (method_exists($this, $method)) |
|
68 | - { |
|
69 | - return $this->$method(); |
|
70 | - } |
|
71 | - call_user_func_array(array($this->datetime, $method), $arguments); |
|
72 | - return $this; |
|
73 | - } |
|
65 | + public function __call($method, $arguments) |
|
66 | + { |
|
67 | + if (method_exists($this, $method)) |
|
68 | + { |
|
69 | + return $this->$method(); |
|
70 | + } |
|
71 | + call_user_func_array(array($this->datetime, $method), $arguments); |
|
72 | + return $this; |
|
73 | + } |
|
74 | 74 | } |
@@ -4,25 +4,25 @@ |
||
4 | 4 | |
5 | 5 | abstract class Weekday { |
6 | 6 | const SUNDAY = 0; |
7 | - const MONDAY = 1; |
|
8 | - const TUESDAY = 2; |
|
9 | - const WEDNESDAY = 3; |
|
10 | - const THURSDAY = 4; |
|
11 | - const FRIDAY = 5; |
|
12 | - const SATURDAY = 6; |
|
7 | + const MONDAY = 1; |
|
8 | + const TUESDAY = 2; |
|
9 | + const WEDNESDAY = 3; |
|
10 | + const THURSDAY = 4; |
|
11 | + const FRIDAY = 5; |
|
12 | + const SATURDAY = 6; |
|
13 | 13 | |
14 | - protected static $days = [ |
|
15 | - Weekday::SUNDAY => 'Sunday', |
|
16 | - Weekday::MONDAY => 'Monday', |
|
17 | - Weekday::TUESDAY => 'Tuesday', |
|
18 | - Weekday::WEDNESDAY => 'Wednesday', |
|
19 | - Weekday::THURSDAY => 'Thursday', |
|
20 | - Weekday::FRIDAY => 'Friday', |
|
21 | - Weekday::SATURDAY => 'Saturday' |
|
22 | - ]; |
|
14 | + protected static $days = [ |
|
15 | + Weekday::SUNDAY => 'Sunday', |
|
16 | + Weekday::MONDAY => 'Monday', |
|
17 | + Weekday::TUESDAY => 'Tuesday', |
|
18 | + Weekday::WEDNESDAY => 'Wednesday', |
|
19 | + Weekday::THURSDAY => 'Thursday', |
|
20 | + Weekday::FRIDAY => 'Friday', |
|
21 | + Weekday::SATURDAY => 'Saturday' |
|
22 | + ]; |
|
23 | 23 | |
24 | - public static function display($weekday) |
|
25 | - { |
|
26 | - return static::$days[$weekday]; |
|
27 | - } |
|
24 | + public static function display($weekday) |
|
25 | + { |
|
26 | + return static::$days[$weekday]; |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | \ No newline at end of file |
@@ -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); |