Skip to content

Commit

Permalink
chore: apply changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyrisbee committed Dec 12, 2023
1 parent 36729e9 commit 74ba68d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Requests/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function list(): array

return array_map(
fn ($data) => CategoryObject::from($data),
$data
$data,
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Requests/GeneralRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ public function delete(string $path, array $arguments): bool
return $this->request('delete', $path, $arguments);
}

public function getUrl(string $path, string $basePath, bool $pretty): string
public function getUrl(string $path, string $prefix, bool $pretty): string
{
if ($pretty) {
return sprintf(
'%s/%s/%s',
rtrim($this->app->site(), '/'),
$basePath,
ltrim($path, '/')
$prefix,
ltrim($path, '/'),
);
}

return sprintf(
'%s?rest_route=/%s',
rtrim($this->app->site(), '/'),
ltrim($path, '/')
ltrim($path, '/'),
);
}
}
12 changes: 6 additions & 6 deletions src/Requests/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ protected function request(
$this->getUrl(
$path,
$this->app->prefix(),
$this->app->isPrettyUrl()
$this->app->isPrettyUrl(),
),
$options
$options,
);

if (!$response->successful()) {
Expand All @@ -74,23 +74,23 @@ protected function request(
return $data;
}

public function getUrl(string $path, string $basePath, bool $pretty): string
public function getUrl(string $path, string $prefix, bool $pretty): string
{
if ($pretty) {
return sprintf(
'%s/%s/wp/%s/%s',
rtrim($this->app->site(), '/'),
$basePath,
$prefix,
self::VERSION,
ltrim($path, '/')
ltrim($path, '/'),
);
}

return sprintf(
'%s?rest_route=/wp/%s/%s',
rtrim($this->app->site(), '/'),
self::VERSION,
ltrim($path, '/')
ltrim($path, '/'),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Requests/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function list(): array

return array_map(
fn ($data) => TagObject::from($data),
$data
$data,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Requests/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function list(): array

return array_map(
fn ($data) => UserObject::from($data),
$data
$data,
);
}

Expand Down

0 comments on commit 74ba68d

Please sign in to comment.