Skip to content

Commit ffc724c

Browse files
authored
Merge branch 'master' into adding-loginas-with-tests
2 parents 260f62a + 1eb1c3c commit ffc724c

15 files changed

+32
-383
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ ParseClient::setCAFile(__DIR__ . '/certs/cacert.pem');
221221

222222
We highly recommend you read through the [guide](http://docs.parseplatform.org/php/guide/) first. This will walk you through the basics of working with this sdk, as well as provide insight into how to best develop your project.
223223

224-
If want to know more about what makes the php sdk tick you can read our [API Reference](http://parseplatform.org/parse-php-sdk/namespaces/Parse.html) and flip through the code on [github](https://github.com/parse-community/parse-php-sdk/).
224+
If want to know more about what makes the php sdk tick you can read our [API Reference](http://parseplatform.org/parse-php-sdk/namespaces/parse.html) and flip through the code on [github](https://github.com/parse-community/parse-php-sdk/).
225225

226226
Check out the [Parse PHP Guide] for the full documentation.
227227

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
"prestart": "MONGODB_VERSION=4.0.4 MONGODB_TOPOLOGY=replicaset MONGODB_STORAGE_ENGINE=wiredTiger mongodb-runner start",
1010
"start": "TESTING=1 node ./tests/server.js &",
1111
"server-only": "TESTING=1 node ./tests/server.js",
12-
"document-check": "./vendor/bin/phpdoc -d ./src/ --template='responsive-twig'",
13-
"document": "./vendor/bin/phpdoc -d ./src/ --title 'Parse PHP SDK API Reference' --template='responsive-twig'"
12+
"document-check": "./vendor/bin/phpdoc -d ./src/ --template='default'",
13+
"document": "./vendor/bin/phpdoc -d ./src/ --title 'Parse PHP SDK API Reference' --template='default'"
1414
},
1515
"type": "module",
1616
"repository": {
1717
"type": "git",
1818
"url": "git+https://github.com/parse-community/parse-php-sdk"
1919
},
2020
"license": "BSD-3-Clause",
21-
"homepage": "https://github.com/montymxb/parse-server-test#readme",
21+
"homepage": "https://parseplatform.org",
2222
"devDependencies": {
2323
"@semantic-release/changelog": "6.0.3",
2424
"@semantic-release/commit-analyzer": "9.0.2",

src/Parse/ParseApp.php

Lines changed: 0 additions & 142 deletions
This file was deleted.

src/Parse/ParseBytes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static function createFromBase64Data($base64Data)
5555
/**
5656
* Decodes and unpacks a given base64 encoded array of data
5757
*
58-
* @param $base64Data
58+
* @param string $base64Data
5959
*/
6060
private function setBase64Data($base64Data)
6161
{

src/Parse/ParseClient.php

Lines changed: 19 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,6 @@ final class ParseClient
6161
*/
6262
private static $enableCurlExceptions;
6363

64-
/**
65-
* The account key.
66-
*
67-
* @var string
68-
*/
69-
private static $accountKey;
70-
7164
/**
7265
* The object for managing persistence.
7366
*
@@ -132,8 +125,7 @@ public static function initialize(
132125
$app_id,
133126
$rest_key,
134127
$master_key,
135-
$enableCurlExceptions = true,
136-
$account_key = null
128+
$enableCurlExceptions = true
137129
) {
138130
if (!ParseObject::hasRegisteredSubclass('_User')) {
139131
ParseUser::registerSubclass();
@@ -160,7 +152,6 @@ public static function initialize(
160152
self::$restKey = $rest_key;
161153
self::$masterKey = $master_key;
162154
self::$enableCurlExceptions = $enableCurlExceptions;
163-
self::$accountKey = $account_key;
164155
if (!static::$storage) {
165156
if (session_status() === PHP_SESSION_ACTIVE) {
166157
self::setStorage(new ParseSessionStorage());
@@ -484,7 +475,6 @@ private static function createRequestUrl($relativeUrl)
484475
* @param null $sessionToken Session Token.
485476
* @param null $data Data to provide with the request.
486477
* @param bool $useMasterKey Whether to use the Master Key.
487-
* @param bool $appRequest App request to create or modify a application
488478
* @param string $contentType The content type for this request, default is application/json
489479
* @param bool $returnHeaders Allow to return response headers
490480
*
@@ -498,7 +488,6 @@ public static function _request(
498488
$sessionToken = null,
499489
$data = null,
500490
$useMasterKey = false,
501-
$appRequest = false,
502491
$contentType = 'application/json',
503492
$returnHeaders = false
504493
) {
@@ -511,37 +500,29 @@ public static function _request(
511500

512501
// verify the server url and mount path have been set
513502
self::assertServerInitialized();
503+
self::assertParseInitialized();
514504

515-
if ($appRequest) {
516-
// ** 'app' requests are not available in open source parse-server
517-
self::assertAppInitialized();
518-
519-
$httpClient->addRequestHeader('X-Parse-Account-Key', self::$accountKey);
520-
} else {
521-
self::assertParseInitialized();
522-
523-
// add appId & client version
524-
$httpClient->addRequestHeader('X-Parse-Application-Id', self::$applicationId);
525-
$httpClient->addRequestHeader('X-Parse-Client-Version', 'php' . self::VERSION_STRING);
505+
// add appId & client version
506+
$httpClient->addRequestHeader('X-Parse-Application-Id', self::$applicationId);
507+
$httpClient->addRequestHeader('X-Parse-Client-Version', 'php' . self::VERSION_STRING);
526508

527509

528-
if ($sessionToken) {
529-
// add our current session token
530-
$httpClient->addRequestHeader('X-Parse-Session-Token', $sessionToken);
531-
}
510+
if ($sessionToken) {
511+
// add our current session token
512+
$httpClient->addRequestHeader('X-Parse-Session-Token', $sessionToken);
513+
}
532514

533-
if ($useMasterKey) {
534-
// pass master key
535-
$httpClient->addRequestHeader('X-Parse-Master-Key', self::$masterKey);
536-
} elseif (isset(self::$restKey)) {
537-
// pass REST key
538-
$httpClient->addRequestHeader('X-Parse-REST-API-Key', self::$restKey);
539-
}
515+
if ($useMasterKey) {
516+
// pass master key
517+
$httpClient->addRequestHeader('X-Parse-Master-Key', self::$masterKey);
518+
} elseif (isset(self::$restKey)) {
519+
// pass REST key
520+
$httpClient->addRequestHeader('X-Parse-REST-API-Key', self::$restKey);
521+
}
540522

541-
if (self::$forceRevocableSession) {
542-
// indicate we are using revocable sessions
543-
$httpClient->addRequestHeader('X-Parse-Revocable-Session', '1');
544-
}
523+
if (self::$forceRevocableSession) {
524+
// indicate we are using revocable sessions
525+
$httpClient->addRequestHeader('X-Parse-Revocable-Session', '1');
545526
}
546527

547528
/*
@@ -713,22 +694,6 @@ private static function assertParseInitialized()
713694
}
714695
}
715696

716-
/**
717-
* Asserts that the sdk has been initialized with a valid account key
718-
*
719-
* @throws Exception
720-
*/
721-
private static function assertAppInitialized()
722-
{
723-
if (self::$accountKey === null || empty(self::$accountKey)) {
724-
throw new Exception(
725-
'You must call ParseClient::initialize(..., $accountKey) before making any app requests. '.
726-
'Your account key must not be null or empty.',
727-
109
728-
);
729-
}
730-
}
731-
732697
/**
733698
* Get remote Parse API url.
734699
*

src/Parse/ParseCloud.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public static function startJob($jobName, $data = [])
7272
null,
7373
json_encode(ParseClient::_encode($data, false)),
7474
true,
75-
false,
7675
'application/json',
7776
true
7877
);

src/Parse/ParseFile.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ public static function createFromFile($path, $name, $mimeType = null)
164164
/**
165165
* Internal method used when constructing a Parse File from Parse.
166166
*
167-
* @param $name
168-
* @param $url
167+
* @param string $name
168+
* @param string $url
169169
*
170170
* @return ParseFile
171171
*/
@@ -229,7 +229,6 @@ private function upload($useMasterKey = false)
229229
null,
230230
$this->getData(),
231231
$useMasterKey,
232-
false,
233232
$mimeType
234233
);
235234
}

src/Parse/ParseGeoPoint.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function getLatitude()
5454
/**
5555
* Set the Latitude value for this GeoPoint.
5656
*
57-
* @param $lat
57+
* @param float $lat
5858
*
5959
* @throws ParseException
6060
*/
@@ -82,7 +82,7 @@ public function getLongitude()
8282
/**
8383
* Set the Longitude value for this GeoPoint.
8484
*
85-
* @param $lon
85+
* @param float $lon
8686
*
8787
* @throws ParseException
8888
*/

src/Parse/ParseObject.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ public static function _unregisterSubclass()
15481548
/**
15491549
* Check whether there is a subclass registered for a given parse class.
15501550
*
1551-
* @param $parseClassName
1551+
* @param string $parseClassName
15521552
*
15531553
* @return bool
15541554
*/
@@ -1561,7 +1561,7 @@ public static function hasRegisteredSubclass($parseClassName)
15611561
* Get the registered subclass for a Parse class, or a generic ParseObject
15621562
* if no subclass is registered.
15631563
*
1564-
* @param $parseClassName
1564+
* @param string $parseClassName
15651565
*
15661566
* @return ParseObject
15671567
*/

src/Parse/ParsePush.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public static function send($data, $useMasterKey = false)
7878
null,
7979
json_encode(ParseClient::_encode($data, true)),
8080
$useMasterKey,
81-
false,
8281
'application/json',
8382
true
8483
);

src/Parse/ParseRelation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function getTargetClass()
9595
/**
9696
* Set the target classname for the relation.
9797
*
98-
* @param $className
98+
* @param string $className
9999
*/
100100
public function setTargetClass($className)
101101
{
@@ -105,7 +105,7 @@ public function setTargetClass($className)
105105
/**
106106
* Set the parent object for the relation.
107107
*
108-
* @param $parent
108+
* @param ParseObject $parent
109109
*/
110110
public function setParent($parent)
111111
{

0 commit comments

Comments
 (0)