Skip to content

Corrects and updates phpdoc references/errors #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ phpunit-test-results
*.log

coverage.xml

# ignore phpdoc
output/
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"require-dev": {
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "^3.0.1",
"phpdocumentor/phpdocumentor": "~2.5"
"phpdocumentor/phpdocumentor": "~2.9"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"lint": "./vendor/bin/phpcs --standard=./phpcs.xml.dist ./src/Parse ./tests/Parse",
"lint:fix": "./vendor/bin/phpcbf --standard=./phpcs.xml.dist ./src/Parse ./tests/Parse",
"start" : "./node_modules/parse-server-test/run-server",
"stop" : "./node_modules/parse-server-test/stop-server"
"stop" : "./node_modules/parse-server-test/stop-server",
"document" : "./vendor/bin/phpdoc -d ./src/ --title 'Parse PHP SDK API Reference' --template='responsive-twig'"
},
"repository": {
"type": "git",
Expand Down
9 changes: 5 additions & 4 deletions src/Parse/HttpClients/ParseCurl.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<?php
/**
* ParseCurl - Wrapper for abstracted curl usage
*
* @author Ben Friedman <[email protected]>
* Class ParseCurl | Parse/HttpClients/ParseCurl.php
*/

namespace Parse\HttpClients;

use Parse\ParseException;

/**
* Class ParseCurl
* Class ParseCurl - Wrapper for abstracted curl usage
*
* @author Ben Friedman <[email protected]>
* @package Parse\HttpClients
*/
class ParseCurl
{
/**
* Curl handle
*
* @var resource
*/
private $curl;
Expand Down
20 changes: 15 additions & 5 deletions src/Parse/HttpClients/ParseCurlHttpClient.php
Original file line number Diff line number Diff line change
@@ -1,58 +1,65 @@
<?php
/**
* ParseCurlHttpClient - Curl http client
*
* @author Ben Friedman <[email protected]>
* Class ParseCurlHttpClient | Parse/HttpClients/ParseCurlHttpClient.php
*/

namespace Parse\HttpClients;

use Parse\ParseException;

/**
* Class ParseCurlHttpClient
* Class ParseCurlHttpClient - Curl http client
*
* @author Ben Friedman <[email protected]>
* @package Parse\HttpClients
*/
class ParseCurlHttpClient implements ParseHttpable
{
/**
* Curl handle
*
* @var ParseCurl
*/
private $parseCurl;

/**
* Request Headers
*
* @var array
*/
private $headers = array();

/**
* Response headers
*
* @var array
*/
private $responseHeaders = array();

/**
* Response code
*
* @var int
*/
private $responseCode = 0;

/**
* Content type of our response
*
* @var string|null
*/
private $responseContentType;

/**
* cURL error code
*
* @var int
*/
private $curlErrorCode;

/**
* cURL error message
*
* @var string
*/
private $curlErrorMessage;
Expand All @@ -69,11 +76,14 @@ class ParseCurlHttpClient implements ParseHttpable

/**
* Response from our request
*
* @var string
*/
private $response;


/**
* ParseCurlHttpClient constructor.
*/
public function __construct()
{
if (!isset($this->parseCurl)) {
Expand Down
10 changes: 7 additions & 3 deletions src/Parse/HttpClients/ParseHttpable.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<?php
/**
* ParseHttpable - Interface for an HTTPable client
*
* @author Ben Friedman <[email protected]>
* Class ParseHttpable | Parse/HttpClients/ParseHttpable.php
*/

namespace Parse\HttpClients;

/**
* Class ParseHttpable - Interface for an HTTPable client
*
* @author Ben Friedman <[email protected]>
* @package Parse\HttpClients
*/
interface ParseHttpable
{
/**
Expand Down
12 changes: 8 additions & 4 deletions src/Parse/HttpClients/ParseStream.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
<?php
/**
* ParseStream - Wrapper for abstracted stream usage
*
* @author Ben Friedman <[email protected]>
* Class ParseStream | Parse/HttpClients/ParseStream.php
*/

namespace Parse\HttpClients;

/**
* Class ParseStream
* Class ParseStream - Wrapper for abstracted stream usage
*
* @author Ben Friedman <[email protected]>
* @package Parse\HttpClients
*/
class ParseStream
{
/**
* Stream context
*
* @var resource
*/
private $stream;

/**
* Response headers
*
* @var array|null
*/
private $responseHeaders;

/**
* Error message
*
* @var string
*/
private $errorMessage;

/**
* Error code
*
* @var int
*/
private $errorCode;
Expand Down
40 changes: 37 additions & 3 deletions src/Parse/HttpClients/ParseStreamHttpClient.php
Original file line number Diff line number Diff line change
@@ -1,76 +1,93 @@
<?php
/**
* ParseStreamHttpClient - Stream http client
*
* @author Ben Friedman <[email protected]>
* Class ParseStreamHttpClient | Parse/HttpClients/ParseStreamHttpClient.php
*/

namespace Parse\HttpClients;

use Parse\ParseException;

/**
* Class ParseStreamHttpClient - Stream http client
*
* @author Ben Friedman <[email protected]>
* @package Parse\HttpClients
*/
class ParseStreamHttpClient implements ParseHttpable
{
/**
* Stream handle
*
* @var ParseStream
*/
private $parseStream;

/**
* Request Headers
*
* @var array
*/
private $headers = array();

/**
* Response headers
*
* @var array
*/
private $responseHeaders = array();

/**
* Response code
*
* @var int
*/
private $responseCode = 0;

/**
* Content type of our response
*
* @var string|null
*/
private $responseContentType;

/**
* Stream error code
*
* @var int
*/
private $streamErrorCode;

/**
* Stream error message
*
* @var string
*/
private $streamErrorMessage;

/**
* Options to pass to our stream
*
* @var array
*/
private $options = array();

/**
* Optional CA file to verify our peers with
*
* @var string
*/
private $caFile;

/**
* Response from our request
*
* @var string
*/
private $response;

/**
* ParseStreamHttpClient constructor.
*/
public function __construct()
{
if (!isset($this->parseStream)) {
Expand Down Expand Up @@ -143,6 +160,9 @@ private function buildRequestHeaders()
return implode("\r\n", $headers);
}

/**
* Sets up ssl related options for the stream context
*/
public function setup()
{
// setup ssl options
Expand All @@ -154,6 +174,15 @@ public function setup()
);
}

/**
* Sends an HTTP request
*
* @param string $url Url to send this request to
* @param string $method Method to send this request via
* @param array $data Data to send in this request
* @return string
* @throws ParseException
*/
public function send($url, $method = 'GET', $data = array())
{

Expand Down Expand Up @@ -287,6 +316,11 @@ public function getErrorMessage()
return $this->streamErrorMessage;
}

/**
* Sets a connection timeout. UNUSED in the stream client.
*
* @param int $timeout Timeout to set
*/
public function setConnectionTimeout($timeout)
{
// do nothing
Expand Down
4 changes: 4 additions & 0 deletions src/Parse/Internal/AddOperation.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php
/**
* Class AddOperation | Parse/Internal/AddOperation.php
*/

namespace Parse\Internal;

Expand All @@ -9,6 +12,7 @@
* Class AddOperation - FieldOperation for adding object(s) to array fields.
*
* @author Fosco Marotto <[email protected]>
* @package Parse\Internal
*/
class AddOperation implements FieldOperation
{
Expand Down
11 changes: 11 additions & 0 deletions src/Parse/Internal/AddUniqueOperation.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php
/**
* Class AddUniqueOperation | Parse/Internal/AddUniqueOperation.php
*/

namespace Parse\Internal;

Expand All @@ -10,6 +13,7 @@
* Class AddUniqueOperation - Operation to add unique objects to an array key.
*
* @author Fosco Marotto <[email protected]>
* @package Parse\Internal
*/
class AddUniqueOperation implements FieldOperation
{
Expand Down Expand Up @@ -126,6 +130,13 @@ public function _apply($oldValue, $obj, $key)
return $oldValue;
}

/**
* Checks if a parse object is contained in a given array of values
*
* @param ParseObject $parseObject ParseObject to check for existence of
* @param array $oldValue Array to check if ParseObject is present in
* @return bool
*/
private function isParseObjectInArray($parseObject, $oldValue)
{
foreach ($oldValue as $object) {
Expand Down
Loading