Skip to content

Commit

Permalink
style(php): Apply coding style for php
Browse files Browse the repository at this point in the history
Run composer run cs:fix
  • Loading branch information
zak39 committed Oct 15, 2024
1 parent 0fd548b commit 61e283f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
36 changes: 18 additions & 18 deletions lib/Controller/GroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public function __construct(
private GroupsWorkspaceService $groupsWorkspace,
private IGroupManager $groupManager,
private LoggerInterface $logger,
private SpaceManager $spaceManager,
private SpaceManager $spaceManager,
private IUserManager $userManager,
private UserFormatter $userFormatter,
private UserService $userService,
private UserWorkspace $userWorkspace
private UserWorkspace $userWorkspace,
) {
}

Expand All @@ -69,9 +69,9 @@ public function __construct(
* NB: This function could probably be abused by space managers to create arbitrary group. But, do we really care?
*
* @var array $data [
* "gid" => 'Space01',
* "displayName" => 'Space01'
* ]
* "gid" => 'Space01',
* "displayName" => 'Space01'
* ]
* @var string $spaceId for Middleware
*
*/
Expand Down Expand Up @@ -239,7 +239,7 @@ public function addUser(string $spaceId, string $gid, string $user): JSONRespons
public function removeUserFromWorkspace(
array|string $space,
string $gid,
string $user
string $user,
): JSONResponse {
if (gettype($space) === 'string') {
$space = json_decode($space, true);
Expand Down Expand Up @@ -371,18 +371,18 @@ public function removeUser(
]);
}

/**
* @NoAdminRequired
* @GeneralManagerRequired
*/
public function attachGroupToSpace(int $spaceId, string $gid) {
$workspace = $this->spaceManager->get($spaceId);
$this->spaceManager->attachGroup($workspace['groupfolder_id'], $gid);

return new JSONResponse([
'message' => sprintf('The %s group is attached to the %s workspace (i.e groupfolder)', $gid, $workspace['name']),
], Http::STATUS_ACCEPTED);
}
/**
* @NoAdminRequired
* @GeneralManagerRequired
*/
public function attachGroupToSpace(int $spaceId, string $gid) {
$workspace = $this->spaceManager->get($spaceId);
$this->spaceManager->attachGroup($workspace['groupfolder_id'], $gid);

return new JSONResponse([
'message' => sprintf('The %s group is attached to the %s workspace (i.e groupfolder)', $gid, $workspace['name']),
], Http::STATUS_ACCEPTED);
}

/**
* @NoAdminRequired
Expand Down
24 changes: 12 additions & 12 deletions lib/Space/SpaceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function create(string $spacename): array {
}

if ($this->workspaceCheck->containSpecialChar($spacename)) {
throw new BadRequestException('Your Workspace name must not contain the following characters: ' . implode(" ", str_split(WorkspaceCheckService::CHARACTERS_SPECIAL)));
throw new BadRequestException('Your Workspace name must not contain the following characters: ' . implode(' ', str_split(WorkspaceCheckService::CHARACTERS_SPECIAL)));
}

if ($this->workspaceCheck->isExist($spacename)) {
Expand Down Expand Up @@ -122,20 +122,20 @@ public function create(string $spacename): array {
];
}

public function get(int $spaceId): array {
public function get(int $spaceId): array {

$space = $this->spaceMapper->find($spaceId)->jsonSerialize();
$workspace = array_merge(
$this->folderHelper->getFolder($space['groupfolder_id'], $this->rootFolder->getRootFolderStorageId()),
$space
);
$space = $this->spaceMapper->find($spaceId)->jsonSerialize();
$workspace = array_merge(
$this->folderHelper->getFolder($space['groupfolder_id'], $this->rootFolder->getRootFolderStorageId()),
$space
);

return $workspace;
}
return $workspace;
}

public function attachGroup(int $folderId, string $gid): void {
$this->folderHelper->addApplicableGroup($folderId, $gid);
}
public function attachGroup(int $folderId, string $gid): void {
$this->folderHelper->addApplicableGroup($folderId, $gid);
}

/**
* @param string $spaceName it's the space name
Expand Down

0 comments on commit 61e283f

Please sign in to comment.