Skip to content
This repository was archived by the owner on Jun 18, 2020. It is now read-only.

Commit 1fb2d49

Browse files
Merge pull request #36 from sandrokeil/feature/add-phpstorm-stub
Add PHPStorm code completion
2 parents f2be8f1 + 2ab695d commit 1fb2d49

File tree

1 file changed

+223
-0
lines changed

1 file changed

+223
-0
lines changed
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
<?php
2+
/**
3+
* ArangoDb Extension Stub File
4+
* @version 0.1.0
5+
* Documentation taken from https://github.com/sandrokeil/arangodb-php-driver
6+
*
7+
* Add it to PHPStorm via
8+
*
9+
* 1. git clone https://github.com/sandrokeil/arangodb-php-driver
10+
* 2. Open Preferences -> Languages & Frameworks -> PHP
11+
* 3. Click PHP Runtime tab
12+
* 4. Click Advanced Settings at the bottom
13+
* 5. Next to Default stubs path, click the ... and navigate to the root of your arangodb-php-driver/phpstorm-stubs folder
14+
*/
15+
16+
/**
17+
* Unlike the official ArangoDB PHP library, this C++ PHP driver uses fuerte and valocypack.
18+
*
19+
* @link https://github.com/sandrokeil/arangodb-php-driver
20+
*/
21+
22+
namespace ArangoDb {
23+
24+
/**
25+
* Handles connection to ArangoDb
26+
*
27+
* @link https://github.com/sandrokeil/arangodb-php-driver/blob/master/src/connection.h
28+
*/
29+
final class Connection
30+
{
31+
public CONST HOST = 'host';
32+
public CONST USER = 'user';
33+
public CONST PASSWORD = 'password';
34+
public CONST MAX_CHUNK_SIZE = 'max_chunk_size';
35+
public CONST VST_VERSION = 'vst_version';
36+
public CONST VST_VERSION_10 = 0;
37+
public CONST VST_VERSION_11 = 1;
38+
39+
/**
40+
* @param array $options Connection options
41+
* @return Connection
42+
*/
43+
public function __construct(array $options)
44+
{
45+
}
46+
47+
/**
48+
* Sets the thread count for the loop service
49+
*
50+
* @param int $threadCount Number of threads
51+
* @return void
52+
*/
53+
public function setThreadCount(int $threadCount): void
54+
{
55+
}
56+
57+
/**
58+
* Establishes a connection to ArangoDb
59+
*/
60+
public function connect(): void
61+
{
62+
}
63+
64+
/**
65+
* Sends a HTTP DELETE request
66+
*
67+
* @param string $path URI path of ArangoDB Rest API
68+
* @param Vpack $vpack Request data
69+
* @param array $queryParams Map of query params, added to URI path
70+
*/
71+
public function delete(string $path, Vpack $vpack, array $queryParams = null): Response
72+
{
73+
}
74+
75+
/**
76+
* Sends a HTTP GET request
77+
*
78+
* @param string $path URI path of ArangoDB Rest API
79+
* @param Vpack $vpack Request data
80+
* @param array|null $queryParams Map of query params added to URI path
81+
*/
82+
public function get(string $path, Vpack $vpack, array $queryParams = null): Response
83+
{
84+
}
85+
86+
/**
87+
* Sends a HTTP POST request
88+
*
89+
* @param string $path URI path of ArangoDB Rest API
90+
* @param Vpack $vpack Request data
91+
* @param array|null $queryParams Map of query params added to URI path
92+
*/
93+
public function post(string $path, Vpack $vpack, array $queryParams = null): Response
94+
{
95+
}
96+
97+
/**
98+
* Sends a HTTP PUT request
99+
*
100+
* @param string $path URI path of ArangoDB Rest API
101+
* @param Vpack $vpack Request data
102+
* @param array|null $queryParams Map of query params added to URI path
103+
*/
104+
public function put(string $path, Vpack $vpack, array $queryParams = null): Response
105+
{
106+
}
107+
108+
/**
109+
* Sends a HTTP HEAD request
110+
*
111+
* @param string $path URI path of ArangoDB Rest API
112+
* @param Vpack $vpack Request data
113+
* @param array|null $queryParams Map of query params added to URI path
114+
*/
115+
public function head(string $path, Vpack $vpack, array $queryParams = null): Response
116+
{
117+
}
118+
119+
/**
120+
* Sends a HTTP PATCH request
121+
*
122+
* @param string $path URI path of ArangoDB Rest API
123+
* @param Vpack $vpack Request data
124+
* @param array|null $queryParams Map of query params added to URI path
125+
*/
126+
public function patch(string $path, Vpack $vpack, array $queryParams = null): Response
127+
{
128+
}
129+
130+
/**
131+
* Sends a HTTP OPTIONS request
132+
*
133+
* @param string $path URI path of ArangoDB Rest API
134+
* @param Vpack $vpack Request data
135+
* @param array|null $queryParams Map of query params added to URI path
136+
*/
137+
public function options(string $path, Vpack $vpack, array $queryParams = null): Response
138+
{
139+
}
140+
}
141+
142+
/**
143+
* Handles responses
144+
*
145+
* @link https://github.com/sandrokeil/arangodb-php-driver/blob/master/src/response.h
146+
*/
147+
final class Response
148+
{
149+
/**
150+
* @return int HTTP status code
151+
*/
152+
public function getHttpCode(): int
153+
{
154+
}
155+
156+
/**
157+
* @return string Response body
158+
*/
159+
public function getBody(): string
160+
{
161+
}
162+
}
163+
164+
/**
165+
* Handles requests
166+
*
167+
* @link https://github.com/sandrokeil/arangodb-php-driver/blob/master/src/request.h
168+
*/
169+
final class Request
170+
{
171+
public CONST METHOD_DELETE = 0;
172+
public CONST METHOD_GET = 1;
173+
public CONST METHOD_POST = 2;
174+
public CONST METHOD_PUT = 3;
175+
public CONST METHOD_HEAD = 4;
176+
public CONST METHOD_PATCH = 5;
177+
public CONST METHOD_OPTIONS = 6;
178+
179+
/**
180+
* Create Request
181+
*
182+
* @param string $path URI path of ArangoDB Rest API
183+
* @param Vpack $vpack Request data
184+
* @param array|null $queryParams Map of query params added to URI path
185+
*
186+
* @return Request
187+
*/
188+
public function __construct(string $path, Vpack $vpack, array $queryParams = null)
189+
{
190+
191+
}
192+
}
193+
194+
/**
195+
* Handles velocypack implementation
196+
*
197+
* Super fast and efficient access of JSON data.
198+
*
199+
* @link https://github.com/arangodb/velocypack
200+
*/
201+
final class Vpack
202+
{
203+
/**
204+
* Creates a Vpack instance from array data
205+
*
206+
* @param array $data
207+
* @return Vpack
208+
*/
209+
public static function fromArray(array $data): Vpack
210+
{
211+
}
212+
213+
/**
214+
* Creates a Vpack instance from JSON data
215+
*
216+
* @param string $json JSON data
217+
* @return Vpack
218+
*/
219+
public static function fromJson(string $json): Vpack
220+
{
221+
}
222+
}
223+
}

0 commit comments

Comments
 (0)