-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEdxUniversityNameConverter.php
48 lines (41 loc) · 1.27 KB
/
EdxUniversityNameConverter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Converts Edx short X names to normal university names
*
* @author Tatiana Braginets
*/
require_once 'UnknownUniversityNameException.php';
class EdxUniversityNameConverter
{
private static $names = array (
'MITx' => 'Massachusetts Institute of Technology',
'HarvardX' => 'Harvard University',
'BerkeleyX' => 'University of California, Berkeley',
'UTx' => 'The University of Texas System',
'McGillX' => 'McGill University',
'ANUx' => 'Australian National University',
'WellesleyX' => 'Wellesley College',
'GeorgetownX' => 'Georgetown University',
'University of TorontoX' => 'University of Toronto',
'EPFLx' => 'École Polytechnique Fédérale de Lausanne',
'DelftX' => 'Delft University of Technology',
'RiceX' => 'Rice University',
'UTAustinX' => 'University of Texas at Austin'
);
/**
* Converts edX short university name to full name
*
* @param string edX short university name
* @return string full university name
* @throws UnknownUniversityNameException
*/
public static function convert($name)
{
if(!key_exists($name, EdxUniversityNameConverter::$names)) {
throw new UnknownUniversityNameException("unkown university name on edx");
} else {
return EdxUniversityNameConverter::$names[$name];
}
}
}
?>