@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | if (version_compare(PHP_VERSION, '5.4.0', '<')) { |
9 | - throw new Exception('The TopMcApi requires PHP version 5.4 or higher.'); |
|
9 | + throw new Exception('The TopMcApi requires PHP version 5.4 or higher.'); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | /** |
@@ -18,29 +18,29 @@ discard block |
||
18 | 18 | */ |
19 | 19 | spl_autoload_register(function ($class) |
20 | 20 | { |
21 | - // project-specific namespace prefix |
|
22 | - $prefix = 'TopMcFrance\\\Api\\'; |
|
21 | + // project-specific namespace prefix |
|
22 | + $prefix = 'TopMcFrance\\\Api\\'; |
|
23 | 23 | |
24 | - // base directory for the namespace prefix |
|
25 | - $base_dir = __DIR__ . '/src/'; |
|
24 | + // base directory for the namespace prefix |
|
25 | + $base_dir = __DIR__ . '/src/'; |
|
26 | 26 | |
27 | - // does the class use the namespace prefix? |
|
28 | - $len = strlen($prefix); |
|
29 | - if (strncmp($prefix, $class, $len) !== 0) { |
|
27 | + // does the class use the namespace prefix? |
|
28 | + $len = strlen($prefix); |
|
29 | + if (strncmp($prefix, $class, $len) !== 0) { |
|
30 | 30 | // no, move to the next registered autoloader |
31 | 31 | return; |
32 | - } |
|
32 | + } |
|
33 | 33 | |
34 | - // get the relative class name |
|
35 | - $relative_class = substr($class, $len); |
|
34 | + // get the relative class name |
|
35 | + $relative_class = substr($class, $len); |
|
36 | 36 | |
37 | - // replace the namespace prefix with the base directory, replace namespace |
|
38 | - // separators with directory separators in the relative class name, append |
|
39 | - // with .php |
|
40 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
37 | + // replace the namespace prefix with the base directory, replace namespace |
|
38 | + // separators with directory separators in the relative class name, append |
|
39 | + // with .php |
|
40 | + $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
41 | 41 | |
42 | - // if the file exists, require it |
|
43 | - if (file_exists($file)) { |
|
42 | + // if the file exists, require it |
|
43 | + if (file_exists($file)) { |
|
44 | 44 | require $file; |
45 | - } |
|
45 | + } |
|
46 | 46 | }); |
47 | 47 | \ No newline at end of file |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | * @param string $class The fully-qualified class name. |
17 | 17 | * @return void |
18 | 18 | */ |
19 | -spl_autoload_register(function ($class) |
|
19 | +spl_autoload_register(function($class) |
|
20 | 20 | { |
21 | 21 | // project-specific namespace prefix |
22 | 22 | $prefix = 'TopMcFrance\\\Api\\'; |
23 | 23 | |
24 | 24 | // base directory for the namespace prefix |
25 | - $base_dir = __DIR__ . '/src/'; |
|
25 | + $base_dir = __DIR__.'/src/'; |
|
26 | 26 | |
27 | 27 | // does the class use the namespace prefix? |
28 | 28 | $len = strlen($prefix); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | // replace the namespace prefix with the base directory, replace namespace |
38 | 38 | // separators with directory separators in the relative class name, append |
39 | 39 | // with .php |
40 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
40 | + $file = $base_dir.str_replace('\\', '/', $relative_class).'.php'; |
|
41 | 41 | |
42 | 42 | // if the file exists, require it |
43 | 43 | if (file_exists($file)) { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param mixed $response |
49 | 49 | * @return \self |
50 | 50 | */ |
51 | - public static function alreadyUsed($code, $response){ |
|
51 | + public static function alreadyUsed($code, $response) { |
|
52 | 52 | $exception = new self(sprintf('Code %s has already used at %s.', |
53 | 53 | $code, |
54 | 54 | $response->use_date |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param mixed $response |
67 | 67 | * @return \self |
68 | 68 | */ |
69 | - public static function invalidCode($code, $response){ |
|
69 | + public static function invalidCode($code, $response) { |
|
70 | 70 | $exception = new self(sprintf('Code %s isn\'t valid.', |
71 | 71 | $code |
72 | 72 | )); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @param mixed $response |
82 | 82 | * @return \self |
83 | 83 | */ |
84 | - public static function unknowException($message, $response){ |
|
84 | + public static function unknowException($message, $response) { |
|
85 | 85 | $exception = new self(sprintf('Unknow code error : %s.', |
86 | 86 | $message |
87 | 87 | )); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | return $exception; |
92 | 92 | } |
93 | 93 | |
94 | - private function baseException($response){ |
|
94 | + private function baseException($response) { |
|
95 | 95 | $this->apiCodeError = $response->erreur; |
96 | 96 | $this->apiMessage = $response->detail; |
97 | 97 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $vote->checkCode('alreadyused'); |
28 | 28 | } |
29 | 29 | |
30 | - public function testCheckCodeInvalidUsedThrowException() |
|
30 | + public function testCheckCodeInvalidUsedThrowException() |
|
31 | 31 | { |
32 | 32 | $this->expectException(ApiException::class); |
33 | 33 | $this->expectExceptionMessage('Code invalidcode isn\'t valid.'); |
@@ -57,7 +57,7 @@ |
||
57 | 57 | * @return string |
58 | 58 | */ |
59 | 59 | protected function buildURI($code) { |
60 | - return self::HOST_API . '?id_serv=' . $this->serverId . '&code=' . $code; |
|
60 | + return self::HOST_API.'?id_serv='.$this->serverId.'&code='.$code; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |