Skip to content

Commit a0a91a9

Browse files
author
Benjamin Wilson Friedman
authored
Corrects and updates phpdoc references/errors (#329)
* Corrects and updates phpdoc references/errors * Lint fixes
1 parent 6fab212 commit a0a91a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+603
-62
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ phpunit-test-results
1212
*.log
1313

1414
coverage.xml
15+
16+
# ignore phpdoc
17+
output/

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"require-dev": {
2020
"phpunit/phpunit": "~4.0",
2121
"squizlabs/php_codesniffer": "^3.0.1",
22-
"phpdocumentor/phpdocumentor": "~2.5"
22+
"phpdocumentor/phpdocumentor": "~2.9"
2323
},
2424
"autoload": {
2525
"psr-4": {

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"lint": "./vendor/bin/phpcs --standard=./phpcs.xml.dist ./src/Parse ./tests/Parse",
77
"lint:fix": "./vendor/bin/phpcbf --standard=./phpcs.xml.dist ./src/Parse ./tests/Parse",
88
"start" : "./node_modules/parse-server-test/run-server",
9-
"stop" : "./node_modules/parse-server-test/stop-server"
9+
"stop" : "./node_modules/parse-server-test/stop-server",
10+
"document" : "./vendor/bin/phpdoc -d ./src/ --title 'Parse PHP SDK API Reference' --template='responsive-twig'"
1011
},
1112
"repository": {
1213
"type": "git",

src/Parse/HttpClients/ParseCurl.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
<?php
22
/**
3-
* ParseCurl - Wrapper for abstracted curl usage
4-
*
5-
* @author Ben Friedman <[email protected]>
3+
* Class ParseCurl | Parse/HttpClients/ParseCurl.php
64
*/
75

86
namespace Parse\HttpClients;
97

108
use Parse\ParseException;
119

1210
/**
13-
* Class ParseCurl
11+
* Class ParseCurl - Wrapper for abstracted curl usage
12+
*
13+
* @author Ben Friedman <[email protected]>
1414
* @package Parse\HttpClients
1515
*/
1616
class ParseCurl
1717
{
1818
/**
1919
* Curl handle
20+
*
2021
* @var resource
2122
*/
2223
private $curl;

src/Parse/HttpClients/ParseCurlHttpClient.php

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,65 @@
11
<?php
22
/**
3-
* ParseCurlHttpClient - Curl http client
4-
*
5-
* @author Ben Friedman <[email protected]>
3+
* Class ParseCurlHttpClient | Parse/HttpClients/ParseCurlHttpClient.php
64
*/
75

86
namespace Parse\HttpClients;
97

108
use Parse\ParseException;
119

1210
/**
13-
* Class ParseCurlHttpClient
11+
* Class ParseCurlHttpClient - Curl http client
12+
*
13+
* @author Ben Friedman <[email protected]>
1414
* @package Parse\HttpClients
1515
*/
1616
class ParseCurlHttpClient implements ParseHttpable
1717
{
1818
/**
1919
* Curl handle
20+
*
2021
* @var ParseCurl
2122
*/
2223
private $parseCurl;
2324

2425
/**
2526
* Request Headers
27+
*
2628
* @var array
2729
*/
2830
private $headers = array();
2931

3032
/**
3133
* Response headers
34+
*
3235
* @var array
3336
*/
3437
private $responseHeaders = array();
3538

3639
/**
3740
* Response code
41+
*
3842
* @var int
3943
*/
4044
private $responseCode = 0;
4145

4246
/**
4347
* Content type of our response
48+
*
4449
* @var string|null
4550
*/
4651
private $responseContentType;
4752

4853
/**
4954
* cURL error code
55+
*
5056
* @var int
5157
*/
5258
private $curlErrorCode;
5359

5460
/**
5561
* cURL error message
62+
*
5663
* @var string
5764
*/
5865
private $curlErrorMessage;
@@ -69,11 +76,14 @@ class ParseCurlHttpClient implements ParseHttpable
6976

7077
/**
7178
* Response from our request
79+
*
7280
* @var string
7381
*/
7482
private $response;
7583

76-
84+
/**
85+
* ParseCurlHttpClient constructor.
86+
*/
7787
public function __construct()
7888
{
7989
if (!isset($this->parseCurl)) {

src/Parse/HttpClients/ParseHttpable.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
<?php
22
/**
3-
* ParseHttpable - Interface for an HTTPable client
4-
*
5-
* @author Ben Friedman <[email protected]>
3+
* Class ParseHttpable | Parse/HttpClients/ParseHttpable.php
64
*/
75

86
namespace Parse\HttpClients;
97

8+
/**
9+
* Class ParseHttpable - Interface for an HTTPable client
10+
*
11+
* @author Ben Friedman <[email protected]>
12+
* @package Parse\HttpClients
13+
*/
1014
interface ParseHttpable
1115
{
1216
/**

src/Parse/HttpClients/ParseStream.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
11
<?php
22
/**
3-
* ParseStream - Wrapper for abstracted stream usage
4-
*
5-
* @author Ben Friedman <[email protected]>
3+
* Class ParseStream | Parse/HttpClients/ParseStream.php
64
*/
75

86
namespace Parse\HttpClients;
97

108
/**
11-
* Class ParseStream
9+
* Class ParseStream - Wrapper for abstracted stream usage
10+
*
11+
* @author Ben Friedman <[email protected]>
1212
* @package Parse\HttpClients
1313
*/
1414
class ParseStream
1515
{
1616
/**
17+
* Stream context
1718
*
1819
* @var resource
1920
*/
2021
private $stream;
2122

2223
/**
2324
* Response headers
25+
*
2426
* @var array|null
2527
*/
2628
private $responseHeaders;
2729

2830
/**
2931
* Error message
32+
*
3033
* @var string
3134
*/
3235
private $errorMessage;
3336

3437
/**
3538
* Error code
39+
*
3640
* @var int
3741
*/
3842
private $errorCode;

src/Parse/HttpClients/ParseStreamHttpClient.php

+37-3
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,93 @@
11
<?php
22
/**
3-
* ParseStreamHttpClient - Stream http client
4-
*
5-
* @author Ben Friedman <[email protected]>
3+
* Class ParseStreamHttpClient | Parse/HttpClients/ParseStreamHttpClient.php
64
*/
75

86
namespace Parse\HttpClients;
97

108
use Parse\ParseException;
119

10+
/**
11+
* Class ParseStreamHttpClient - Stream http client
12+
*
13+
* @author Ben Friedman <[email protected]>
14+
* @package Parse\HttpClients
15+
*/
1216
class ParseStreamHttpClient implements ParseHttpable
1317
{
1418
/**
1519
* Stream handle
20+
*
1621
* @var ParseStream
1722
*/
1823
private $parseStream;
1924

2025
/**
2126
* Request Headers
27+
*
2228
* @var array
2329
*/
2430
private $headers = array();
2531

2632
/**
2733
* Response headers
34+
*
2835
* @var array
2936
*/
3037
private $responseHeaders = array();
3138

3239
/**
3340
* Response code
41+
*
3442
* @var int
3543
*/
3644
private $responseCode = 0;
3745

3846
/**
3947
* Content type of our response
48+
*
4049
* @var string|null
4150
*/
4251
private $responseContentType;
4352

4453
/**
4554
* Stream error code
55+
*
4656
* @var int
4757
*/
4858
private $streamErrorCode;
4959

5060
/**
5161
* Stream error message
62+
*
5263
* @var string
5364
*/
5465
private $streamErrorMessage;
5566

5667
/**
5768
* Options to pass to our stream
69+
*
5870
* @var array
5971
*/
6072
private $options = array();
6173

6274
/**
6375
* Optional CA file to verify our peers with
76+
*
6477
* @var string
6578
*/
6679
private $caFile;
6780

6881
/**
6982
* Response from our request
83+
*
7084
* @var string
7185
*/
7286
private $response;
7387

88+
/**
89+
* ParseStreamHttpClient constructor.
90+
*/
7491
public function __construct()
7592
{
7693
if (!isset($this->parseStream)) {
@@ -143,6 +160,9 @@ private function buildRequestHeaders()
143160
return implode("\r\n", $headers);
144161
}
145162

163+
/**
164+
* Sets up ssl related options for the stream context
165+
*/
146166
public function setup()
147167
{
148168
// setup ssl options
@@ -154,6 +174,15 @@ public function setup()
154174
);
155175
}
156176

177+
/**
178+
* Sends an HTTP request
179+
*
180+
* @param string $url Url to send this request to
181+
* @param string $method Method to send this request via
182+
* @param array $data Data to send in this request
183+
* @return string
184+
* @throws ParseException
185+
*/
157186
public function send($url, $method = 'GET', $data = array())
158187
{
159188

@@ -287,6 +316,11 @@ public function getErrorMessage()
287316
return $this->streamErrorMessage;
288317
}
289318

319+
/**
320+
* Sets a connection timeout. UNUSED in the stream client.
321+
*
322+
* @param int $timeout Timeout to set
323+
*/
290324
public function setConnectionTimeout($timeout)
291325
{
292326
// do nothing

src/Parse/Internal/AddOperation.php

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
/**
3+
* Class AddOperation | Parse/Internal/AddOperation.php
4+
*/
25

36
namespace Parse\Internal;
47

@@ -9,6 +12,7 @@
912
* Class AddOperation - FieldOperation for adding object(s) to array fields.
1013
*
1114
* @author Fosco Marotto <[email protected]>
15+
* @package Parse\Internal
1216
*/
1317
class AddOperation implements FieldOperation
1418
{

src/Parse/Internal/AddUniqueOperation.php

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
/**
3+
* Class AddUniqueOperation | Parse/Internal/AddUniqueOperation.php
4+
*/
25

36
namespace Parse\Internal;
47

@@ -10,6 +13,7 @@
1013
* Class AddUniqueOperation - Operation to add unique objects to an array key.
1114
*
1215
* @author Fosco Marotto <[email protected]>
16+
* @package Parse\Internal
1317
*/
1418
class AddUniqueOperation implements FieldOperation
1519
{
@@ -126,6 +130,13 @@ public function _apply($oldValue, $obj, $key)
126130
return $oldValue;
127131
}
128132

133+
/**
134+
* Checks if a parse object is contained in a given array of values
135+
*
136+
* @param ParseObject $parseObject ParseObject to check for existence of
137+
* @param array $oldValue Array to check if ParseObject is present in
138+
* @return bool
139+
*/
129140
private function isParseObjectInArray($parseObject, $oldValue)
130141
{
131142
foreach ($oldValue as $object) {

0 commit comments

Comments
 (0)