@@ -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 *
0 commit comments