9292 * ## Conflicts
9393 *
9494 * Conflicts with SOAP module
95+ *
9596 */
9697class REST extends Module implements DependsOnModule, PartedModule, API , ConflictsWithModule
9798{
@@ -231,8 +232,8 @@ public function haveHttpHeader(string $name, string $value): void
231232 * ```
232233 *
233234 * @param string $name the name of the header to delete.
234- * @part json
235- * @part xml
235+ * @part json
236+ * @part xml
236237 */
237238 public function deleteHeader (string $ name ): void
238239 {
@@ -301,10 +302,10 @@ public function seeHttpHeaderOnce(string $name): void
301302 /**
302303 * Returns the value of the specified header name
303304 *
304- * @param bool $first Whether to return the first value or all header values
305+ * @param bool $first Whether to return the first value or all header values
305306 * @return string|array|null The first header value if $first is true, an array of values otherwise
306- * @part json
307- * @part xml
307+ * @part json
308+ * @part xml
308309 */
309310 public function grabHttpHeader (string $ name , bool $ first = true ): string |array |null
310311 {
@@ -365,8 +366,8 @@ public function amBearerAuthenticated(string $accessToken): void
365366 * ```
366367 *
367368 * @throws ModuleException
368- * @part json
369- * @part xml
369+ * @part json
370+ * @part xml
370371 */
371372 public function amNTLMAuthenticated (string $ username , string $ password ): void
372373 {
@@ -401,7 +402,6 @@ public function amNTLMAuthenticated(string $username, string $password): void
401402 * <?php
402403 * $I->amAWSAuthenticated();
403404 * ```
404- *
405405 * @throws ConfigurationException
406406 */
407407 public function amAWSAuthenticated (array $ additionalAWSConfig = []): void
@@ -461,16 +461,16 @@ public function amAWSAuthenticated(array $additionalAWSConfig = []): void
461461 * keys: name, type, error, size, tmp_name (pointing to the real file path). Each key works
462462 * as the "name" attribute of a file input field.
463463 *
464- * @see https://php.net/manual/en/features.file-upload.post-method.php
465- * @see codecept_data_dir()
464+ * @see https://php.net/manual/en/features.file-upload.post-method.php
465+ * @see codecept_data_dir()
466466 * @part json
467467 * @part xml
468468 */
469469 public function sendPost (
470470 string $ url ,
471471 array |string |ArrayAccess |JsonSerializable $ params = [],
472- array $ files = []
473- ): ? string {
472+ array $ files = []): ? string
473+ {
474474 return $ this ->execute ('POST ' , $ url , $ params , $ files );
475475 }
476476
@@ -530,7 +530,8 @@ public function sendPut(
530530 string $ url ,
531531 array |string |ArrayAccess |JsonSerializable $ params = [],
532532 array $ files = []
533- ): ?string {
533+ ): ?string
534+ {
534535 return $ this ->execute ('PUT ' , $ url , $ params , $ files );
535536 }
536537
@@ -549,7 +550,8 @@ public function sendPatch(
549550 string $ url ,
550551 array |string |ArrayAccess |JsonSerializable $ params = [],
551552 array $ files = []
552- ): ?string {
553+ ): ?string
554+ {
553555 return $ this ->execute ('PATCH ' , $ url , $ params , $ files );
554556 }
555557
@@ -568,7 +570,8 @@ public function sendDelete(
568570 string $ url ,
569571 array |string |ArrayAccess |JsonSerializable $ params = [],
570572 array $ files = []
571- ): ?string {
573+ ): ?string
574+ {
572575 return $ this ->execute ('DELETE ' , $ url , $ params , $ files );
573576 }
574577
@@ -582,8 +585,8 @@ public function send(
582585 string $ method ,
583586 string $ url ,
584587 array |string |ArrayAccess |JsonSerializable $ params = [],
585- array $ files = []
586- ): ? string {
588+ array $ files = []): ? string
589+ {
587590 return $ this ->execute (strtoupper ($ method ), $ url , $ params , $ files );
588591 }
589592
@@ -624,8 +627,8 @@ private function setHeaderLink(array $linkEntries): void
624627 * @link https://tools.ietf.org/html/rfc2068#section-19.6.2.4
625628 *
626629627- * @part json
628- * @part xml
630+ * @part json
631+ * @part xml
629632 */
630633 public function sendLink (string $ url , array $ linkEntries ): void
631634 {
@@ -636,11 +639,11 @@ public function sendLink(string $url, array $linkEntries): void
636639 /**
637640 * Sends UNLINK request to given uri.
638641 *
639- * @param array $linkEntries (entry is array with keys "uri" and "link-param")
640- * @link https://tools.ietf.org/html/rfc2068#section-19.6.2.4
642+ * @param array $linkEntries (entry is array with keys "uri" and "link-param")
643+ * @link https://tools.ietf.org/html/rfc2068#section-19.6.2.4
641644642- * @part json
643- * @part xml
645+ * @part json
646+ * @part xml
644647 */
645648 public function sendUnlink (string $ url , array $ linkEntries ): void
646649 {
@@ -655,8 +658,8 @@ protected function execute(
655658 string $ method ,
656659 string $ url ,
657660 array |string |ArrayAccess |JsonSerializable $ parameters = [],
658- array $ files = []
659- ): ? string {
661+ array $ files = []): ? string
662+ {
660663 // allow full url to be requested
661664 if (!$ url ) {
662665 $ url = $ this ->config ['url ' ];
@@ -693,8 +696,7 @@ protected function execute(
693696 $ this ->debugSection ("Request " , sprintf ('%s %s ' , $ method , $ url ));
694697 $ files = [];
695698 } else {
696- $ this ->debugSection (
697- "Request " ,
699+ $ this ->debugSection ("Request " ,
698700 sprintf ('%s %s ' , $ method , $ url ) . json_encode ($ parameters , JSON_PRESERVE_ZERO_FRACTION | JSON_THROW_ON_ERROR )
699701 );
700702 $ files = $ this ->formatFilesArray ($ files );
@@ -744,7 +746,7 @@ protected function isBinaryData(string $data): bool
744746 /**
745747 * Format a binary string for debug printing
746748 *
747- * @param string $data the binary data string
749+ * @param string $data the binary data string
748750 * @return string the debug string
749751 */
750752 protected function binaryToDebugString (string $ data ): string
@@ -755,11 +757,13 @@ protected function binaryToDebugString(string $data): string
755757 protected function encodeApplicationJson (
756758 string $ method ,
757759 array |string |ArrayAccess |JsonSerializable $ parameters ,
758- ): array |string {
760+ ): array |string
761+ {
759762 if (
760763 array_key_exists ('Content-Type ' , $ this ->connectionModule ->headers )
761764 && ($ this ->connectionModule ->headers ['Content-Type ' ] === 'application/json '
762- || preg_match ('#^application/.+\+json$# ' , $ this ->connectionModule ->headers ['Content-Type ' ]))
765+ || preg_match ('#^application/.+\+json$# ' , $ this ->connectionModule ->headers ['Content-Type ' ])
766+ )
763767 ) {
764768 if ($ parameters instanceof JsonSerializable) {
765769 return json_encode ($ parameters , JSON_PRESERVE_ZERO_FRACTION | JSON_THROW_ON_ERROR );
@@ -821,7 +825,6 @@ private function formatFilesArray(array $files): array
821825 } elseif (is_object ($ value )) {
822826 /**
823827 * do nothing, probably the user knows what he is doing
824- *
825828 * @issue https://github.com/Codeception/Codeception/issues/3298
826829 */
827830 } else {
@@ -858,6 +861,7 @@ private function checkFileBeforeUpload(string $file): void
858861
859862 /**
860863 * Extends the function Module::validateConfig for shorten messages
864+ *
861865 */
862866 protected function validateConfig (): void
863867 {
@@ -991,7 +995,7 @@ public function seeResponseIsValidOnJsonSchemaString(string $schema): void
991995 * Supply schema as relative file path in your project directory or an absolute path
992996 *
993997 * @part json
994- * @see codecept_absolute_path()
998+ * @see codecept_absolute_path()
995999 */
9961000 public function seeResponseIsValidOnJsonSchema (string $ schemaFilename ): void
9971001 {
@@ -1006,7 +1010,7 @@ public function seeResponseIsValidOnJsonSchema(string $schemaFilename): void
10061010 /**
10071011 * Converts string to json and asserts that no error occurred while decoding.
10081012 *
1009- * @param string $jsonString the json encoded string
1013+ * @param string $jsonString the json encoded string
10101014 * @param string $errorFormat optional string for custom sprintf format
10111015 */
10121016 protected function decodeAndValidateJson (string $ jsonString , string $ errorFormat = "Invalid json: %s. System message: %s. " )
@@ -1059,7 +1063,7 @@ public function grabResponse(): string
10591063 *
10601064 * @return array Array of matching items
10611065 * @throws Exception
1062- * @part json
1066+ * @part json
10631067 */
10641068 public function grabDataFromResponseByJsonPath (string $ jsonPath ): array
10651069 {
@@ -1102,7 +1106,6 @@ public function grabDataFromResponseByJsonPath(string $jsonPath): array
11021106 * // at least one item in store has price
11031107 * $I->seeResponseJsonMatchesXpath('/store//price');
11041108 * ```
1105- *
11061109 * @part json
11071110 */
11081111 public function seeResponseJsonMatchesXpath (string $ xPath ): void
@@ -1149,7 +1152,6 @@ public function seeResponseJsonMatchesXpath(string $xPath): void
11491152 * // count the number of books written by given author is 5
11501153 * $I->seeResponseJsonMatchesXpath("//author[text() = 'Nigel Rees']", 1.0);
11511154 * ```
1152- *
11531155 * @part json
11541156 */
11551157 public function seeResponseJsonXpathEvaluatesTo (string $ xPath , $ expected ): void
@@ -1161,7 +1163,7 @@ public function seeResponseJsonXpathEvaluatesTo(string $xPath, $expected): void
11611163 "Received JSON did not evualated XPath ` {$ xPath }` as expected. \nJson Response: \n" . $ response
11621164 );
11631165 }
1164-
1166+
11651167 /**
11661168 * Opposite to seeResponseJsonXpathEvaluatesTo
11671169 *
@@ -1345,7 +1347,7 @@ public function dontSeeResponseContainsJson(array $json = []): void
13451347 * See [JsonType reference](https://codeception.com/docs/reference/JsonType).
13461348 *
13471349 * @part json
1348- * @see JsonType
1350+ * @see JsonType
13491351 */
13501352 public function seeResponseMatchesJsonType (array $ jsonType , string $ jsonPath = null ): void
13511353 {
@@ -1360,9 +1362,9 @@ public function seeResponseMatchesJsonType(array $jsonType, string $jsonPath = n
13601362 /**
13611363 * Opposite to `seeResponseMatchesJsonType`.
13621364 *
1363- * @part json
1365+ * @part json
13641366 * @param array $jsonType JsonType structure
1365- * @see seeResponseMatchesJsonType
1367+ * @see seeResponseMatchesJsonType
13661368 */
13671369 public function dontSeeResponseMatchesJsonType (array $ jsonType , string $ jsonPath = null ): void
13681370 {
@@ -1502,7 +1504,6 @@ public function seeResponseIsXml(): void
15021504 * <?php
15031505 * $I->seeXmlResponseMatchesXpath('//root/user[@id=1]');
15041506 * ```
1505- *
15061507 * @part xml
15071508 */
15081509 public function seeXmlResponseMatchesXpath (string $ xPath ): void
@@ -1518,7 +1519,6 @@ public function seeXmlResponseMatchesXpath(string $xPath): void
15181519 * <?php
15191520 * $I->dontSeeXmlResponseMatchesXpath('//root/user[@id=1]');
15201521 * ```
1521- *
15221522 * @part xml
15231523 */
15241524 public function dontSeeXmlResponseMatchesXpath (string $ xPath ): void
@@ -1572,7 +1572,7 @@ public function seeXmlResponseEquals(DOMDocument|string $xml): void
15721572 * Comparison is done by canonicalizing both xml`s.
15731573 *
15741574 * @param mixed $xml
1575- * @part xml
1575+ * @part xml
15761576 */
15771577 public function dontSeeXmlResponseEquals (DOMDocument |string $ xml ): void
15781578 {
@@ -1650,8 +1650,8 @@ public function dontSeeXmlResponseIncludes(DOMNode|XmlBuilder|array|string $xml)
16501650 *
16511651 * @param string $hash the hashed data response expected
16521652 * @param string $algo the hash algorithm to use. Default sha1.
1653- * @part json
1654- * @part xml
1653+ * @part json
1654+ * @part xml
16551655 */
16561656 public function seeBinaryResponseEquals (string $ hash , string $ algo = 'sha1 ' ): void
16571657 {
@@ -1670,8 +1670,8 @@ public function seeBinaryResponseEquals(string $hash, string $algo = 'sha1'): vo
16701670 *
16711671 * @param string $hash the hashed data response expected
16721672 * @param string $algo the hash algorithm to use. Default md5.
1673- * @part json
1674- * @part xml
1673+ * @part json
1674+ * @part xml
16751675 */
16761676 public function dontSeeBinaryResponseEquals (string $ hash , string $ algo = 'sha1 ' ): void
16771677 {
0 commit comments