6 public static function url($url, $helpName)
8 $parts = parse_url($url);
9 if (!isset($parts['scheme'])) {
10 $url = 'http://' . $url;
11 } else if ($parts['scheme'] != 'http' && $parts['scheme'] != 'https') {
13 'Invalid URL scheme in ' . $helpName . ': ' . $parts['scheme']
18 if (!isset($parts['host'])) {
19 if (count($parts) == 1 && isset($parts['path'])) {
20 //parse_url('example.org') puts 'example.org' in the path
21 // but this is common, so we fix it.
22 $url = 'http://' . $parts['path'];
24 Log::err('Invalid URL: No host in ' . $helpName);
32 public static function rsvp($answer)
34 $allowed = ['yes', 'no', 'maybe'];
35 if (false === array_search($answer, $allowed)) {
37 'Invalid RSVP answer given; allowed are: '
38 . implode(', ', $allowed)