1 | <?php |
||
20 | class UrlStorage |
||
21 | { |
||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $token; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected static $routes = [ |
||
31 | /* --------------------- |
||
32 | * Streams |
||
33 | * --------------------- */ |
||
34 | 'events' => 'https://stream.gitter.im/v1/rooms/{roomId}/events', |
||
35 | 'messages' => 'https://stream.gitter.im/v1/rooms/{roomId}/chatMessages', |
||
36 | |||
37 | /* --------------------- |
||
38 | * Messages |
||
39 | * --------------------- */ |
||
40 | // Additional arguments: limit, afterId, beforeId, skip |
||
41 | 'message.list' => 'https://api.gitter.im/v1/rooms/{roomId}/chatMessages', |
||
42 | // POST: {"text": "message text"} |
||
|
|||
43 | 'message.send' => 'https://api.gitter.im/v1/rooms/{roomId}/chatMessages', |
||
44 | // PUT: {"text": "new text"} |
||
45 | 'message.update' => 'https://api.gitter.im/v1/rooms/{roomId}/chatMessages/{messageId}', |
||
46 | |||
47 | |||
48 | /* --------------------- |
||
49 | * Rooms |
||
50 | * --------------------- */ |
||
51 | 'room.list' => 'https://api.gitter.im/v1/rooms', |
||
52 | 'room.info' => 'https://api.gitter.im/v1/rooms/{roomId}', |
||
53 | 'room.users' => 'https://api.gitter.im/v1/rooms/{roomId}/users', |
||
54 | 'room.channels' => 'https://api.gitter.im/v1/rooms/{roomId}/channels', |
||
55 | // POST: {"uri": "username/repo"} |
||
56 | 'room.join' => 'https://api.gitter.im/v1/rooms/{roomId}', |
||
57 | |||
58 | |||
59 | /* --------------------- |
||
60 | * User |
||
61 | * --------------------- */ |
||
62 | 'user' => 'https://api.gitter.im/v1/user/{userId}', |
||
63 | 'user.current' => 'https://api.gitter.im/v1/user', |
||
64 | 'user.rooms' => 'https://api.gitter.im/v1/user/{userId}/rooms', |
||
65 | 'user.orgs' => 'https://api.gitter.im/v1/user/{userId}/orgs', |
||
66 | 'user.repos' => 'https://api.gitter.im/v1/user/{userId}/repos', |
||
67 | 'user.channels' => 'https://api.gitter.im/v1/user/{userId}/channels', |
||
68 | // POST: {"chat": [chatId, chatId]} |
||
69 | 'message.unread' => 'https://api.gitter.im/v1/user/{userId}/rooms/{roomId}/unreadItems', |
||
70 | ]; |
||
71 | |||
72 | |||
73 | /** |
||
74 | * @param string $token |
||
75 | */ |
||
76 | public function __construct($token) |
||
80 | |||
81 | |||
82 | /** |
||
83 | * @param $name |
||
84 | * @param array $args |
||
85 | * @return mixed|string |
||
86 | * @throws \InvalidArgumentException |
||
87 | */ |
||
88 | public function route($name, array $args = []): string |
||
99 | |||
100 | |||
101 | /** |
||
102 | * @param $url |
||
103 | * @param array $args |
||
104 | * @return mixed|string |
||
105 | */ |
||
106 | public function url($url, array $args = []): string |
||
122 | } |
||
123 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.