Skip to content

Commit

Permalink
set php version
Browse files Browse the repository at this point in the history
  • Loading branch information
ANKUR DWIVEDI authored and ANKUR DWIVEDI committed Feb 20, 2024
1 parent 090b933 commit d76df8d
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 50 deletions.
6 changes: 4 additions & 2 deletions src/ImageKit/Manage/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public static function purgeFileCache($urlParam, $resource)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -80,7 +81,8 @@ public static function purgeFileCacheStatus($requestId, GuzzleHttpWrapper $resou
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down
18 changes: 12 additions & 6 deletions src/ImageKit/Manage/CustomMetadataFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public static function get($fileId, $resource)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -82,7 +83,8 @@ public static function getFileMetadataFromRemoteURL($url, $resource)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -123,7 +125,8 @@ public static function createCustomMetadataField($name, $label, $schema, $resour
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -160,7 +163,8 @@ public static function getCustomMetadataField($includeDeleted, $resource)
return Response::respond(false, $content);
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -198,7 +202,8 @@ public static function updateCustomMetadataField($label, $schema, $resource)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -230,7 +235,8 @@ public static function deleteCustomMetadataField($resource)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}
}
45 changes: 30 additions & 15 deletions src/ImageKit/Manage/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public static function listFile(GuzzleHttpWrapper $resource,$parameters=null)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}


Expand Down Expand Up @@ -83,7 +84,8 @@ public static function getDetails($fileId, GuzzleHttpWrapper $resource)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -117,7 +119,8 @@ public static function getVersionDetails($fileId, $versionId, GuzzleHttpWrapper
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -151,7 +154,8 @@ public static function getFileVersions($fileId, GuzzleHttpWrapper $resource)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -188,7 +192,8 @@ public static function delete($fileId, GuzzleHttpWrapper $resource)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -225,7 +230,8 @@ public static function deleteVersion($fileId, $versionId, GuzzleHttpWrapper $res
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -261,7 +267,8 @@ public static function bulkDeleteByFileIds($fileIds, GuzzleHttpWrapper $resource
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -299,7 +306,8 @@ public static function copy($sourceFilePath, $destinationPath, $includeFileVersi
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -335,7 +343,8 @@ public static function move($sourceFilePath, $destinationPath, GuzzleHttpWrapper
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -373,7 +382,8 @@ public static function rename($filePath, $newFileName, $purgeCache, GuzzleHttpWr
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -407,7 +417,8 @@ public static function restoreVersion(GuzzleHttpWrapper $resource)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -445,7 +456,8 @@ public static function bulkAddTags($fileIds, $tags, GuzzleHttpWrapper $resource)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -487,7 +499,8 @@ public static function bulkRemoveTags(array $fileIds, array $tags, GuzzleHttpWra
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -524,7 +537,8 @@ public static function bulkRemoveAITags(array $fileIds, array $AITags, GuzzleHtt
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -571,7 +585,8 @@ public static function updateDetails($fileId, $updateData, GuzzleHttpWrapper $re
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}
}
12 changes: 8 additions & 4 deletions src/ImageKit/Manage/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public static function create($folderName, $parentFolderPath, GuzzleHttpWrapper
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -78,7 +79,8 @@ public static function delete($folderPath, GuzzleHttpWrapper $httpClient)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -113,7 +115,8 @@ public static function copy($sourceFolderPath, $destinationPath, $includeFileVer
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}

Expand Down Expand Up @@ -147,7 +150,8 @@ public static function move($sourceFolderPath, $destinationPath, GuzzleHttpWrapp
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}
}
}
3 changes: 2 additions & 1 deletion src/ImageKit/Upload/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public static function upload(array $uploadOptions, GuzzleHttpWrapper $resource)
return Response::respond(false, ($content));
}
else{
return Response::respond(true, ((object)ErrorMessages::$INVALID_REQUEST)->message);
$message = ErrorMessages::$INVALID_REQUEST->message;
return Response::respond(true, $message);
}


Expand Down
18 changes: 9 additions & 9 deletions tests/ImageKit/Upload/UploadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private function checkFormData($requestBody, $boundary, $fieldName, $fieldValue)
$string = '--'.$boundary.' Content-Disposition: form-data; name="'.$fieldName.'" Content-Length: '.strlen($fieldValue).' '.$fieldValue;
$string = substr(json_encode($string),1,-1);

UploadTest::assertStringContainsString($string,$requestBody);
UploadTest::assertContains($string,$requestBody);
}

/**
Expand Down Expand Up @@ -384,7 +384,7 @@ public function testFileUploadMissingUseUniqueFileName()
$this->checkFormData($stream,$boundary,"file",$fileOptions['file']);
$this->checkFormData($stream,$boundary,"fileName",$fileOptions['fileName']);
$this->checkFormData($stream,$boundary,"isPrivateFile","true");
UploadTest::assertStringNotContainsString("useUniqueFileName",$stream);
UploadTest::assertNotContains("useUniqueFileName",$stream);

// Assert Method
$requestMethod = $container[0]['request']->getMethod();
Expand Down Expand Up @@ -432,8 +432,8 @@ public function testFileUploadMissingIsPrivateFileUseUniqueFileName()
$this->checkFormData($stream,$boundary,"file",$fileOptions['file']);
$this->checkFormData($stream,$boundary,"fileName",$fileOptions['fileName']);
$this->checkFormData($stream,$boundary,"tags","abd,def");
UploadTest::assertStringNotContainsString("isPrivateFile",$stream);
UploadTest::assertStringNotContainsString("useUniqueFileName",$stream);
UploadTest::assertNotContains("isPrivateFile",$stream);
UploadTest::assertNotContains("useUniqueFileName",$stream);

// Assert Method
$requestMethod = $container[0]['request']->getMethod();
Expand Down Expand Up @@ -621,11 +621,11 @@ public function testFileUploadBareMinimumRequest()

$this->checkFormData($stream,$boundary,"file",$fileOptions['file']);
$this->checkFormData($stream,$boundary,"fileName",$fileOptions['fileName']);
UploadTest::assertStringNotContainsString("tags",$stream);
UploadTest::assertStringNotContainsString("isPrivateFile",$stream);
UploadTest::assertStringNotContainsString("useUniqueFileName",$stream);
UploadTest::assertStringNotContainsString("customCoordinates",$stream);
UploadTest::assertStringNotContainsString("responseFields",$stream);
UploadTest::assertNotContains("tags",$stream);
UploadTest::assertNotContains("isPrivateFile",$stream);
UploadTest::assertNotContains("useUniqueFileName",$stream);
UploadTest::assertNotContains("customCoordinates",$stream);
UploadTest::assertNotContains("responseFields",$stream);

// Assert Method
$requestMethod = $container[0]['request']->getMethod();
Expand Down
Loading

0 comments on commit d76df8d

Please sign in to comment.