Skip to content

Commit

Permalink
PHP: Add listFiles options to IsomorphicLocalPHP and WebPHPEndpoint (#…
Browse files Browse the repository at this point in the history
…490)

The options argument for listFiles was added to BasePHP in #462. This
commit adds it to an interface and a Web PHP Endpoint so that it can be
used across the board in web and node.js applications
  • Loading branch information
adamziel committed Jun 1, 2023
1 parent ca035ca commit e94e919
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/php-wasm/universal/src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type {
PHPOutput,
PHPRunOptions,
UniversalPHP,
ListFilesOptions,
RmDirOptions,
HTTPMethod,
PHPRequest,
Expand Down
3 changes: 2 additions & 1 deletion packages/php-wasm/universal/src/lib/universal-php.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,10 @@ export interface IsomorphicLocalPHP extends RequestHandler {
* Lists the files and directories in the given directory.
*
* @param path - The directory path to list.
* @param options - Options for the listing.
* @returns The list of files and directories in the given directory.
*/
listFiles(path: string): string[];
listFiles(path: string, options?: ListFilesOptions): string[];

/**
* Checks if a directory exists in the PHP filesystem.
Expand Down
5 changes: 3 additions & 2 deletions packages/php-wasm/web/src/lib/web-php-endpoint.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {
BasePHP,
IsomorphicLocalPHP,
ListFilesOptions,
PHPRequest,
PHPResponse,
PHPRunOptions,
Expand Down Expand Up @@ -145,8 +146,8 @@ export class WebPHPEndpoint implements IsomorphicLocalPHP {
}

/** @inheritDoc @php-wasm/web!WebPHP.listFiles */
listFiles(path: string): string[] {
return _private.get(this)!.php.listFiles(path);
listFiles(path: string, options?: ListFilesOptions): string[] {
return _private.get(this)!.php.listFiles(path, options);
}

/** @inheritDoc @php-wasm/web!WebPHP.isDir */
Expand Down

0 comments on commit e94e919

Please sign in to comment.