Skip to content

Commit b2b3d0e

Browse files
committed
code cleanup
1 parent 1573674 commit b2b3d0e

4 files changed

Lines changed: 11 additions & 66 deletions

File tree

app/helpers/MetaFormats/FormatDefinitions/GroupFormat.php

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
use App\Helpers\MetaFormats\Attributes\FPost;
88
use App\Helpers\MetaFormats\Validators\VArray;
99
use App\Helpers\MetaFormats\Validators\VBool;
10-
use App\Helpers\MetaFormats\Validators\VEmail;
11-
use App\Helpers\MetaFormats\Validators\VMixed;
1210
use App\Helpers\MetaFormats\Validators\VObject;
1311
use App\Helpers\MetaFormats\Validators\VString;
1412
use App\Helpers\MetaFormats\Validators\VUuid;
15-
use ArrayAccess;
1613

14+
/**
15+
* Format definition used by the GroupsPresenter.
16+
*/
1717
#[Format(GroupFormat::class)]
18-
class GroupFormat extends MetaFormat// implements ArrayAccess
18+
class GroupFormat extends MetaFormat
1919
{
2020
#[FPost(new VUuid(), "An identifier of the group")]
2121
public string $id;
@@ -71,39 +71,4 @@ class GroupFormat extends MetaFormat// implements ArrayAccess
7171

7272
#[FPost(new VArray())]
7373
public ?array $permissionHints;
74-
75-
76-
// public function offsetExists(mixed $offset): bool
77-
// {
78-
// return isset($this->$offset);
79-
// }
80-
81-
// /**
82-
// * Offset to retrieve
83-
// * @param mixed $offset The offset to retrieve.
84-
// * @return mixed Can return all value types.
85-
// */
86-
// public function offsetGet(mixed $offset): mixed
87-
// {
88-
// return $this->$offset ?? null;
89-
// }
90-
91-
// /**
92-
// * Offset to set
93-
// * @param mixed $offset The offset to assign the value to.
94-
// * @param mixed $value The value to set.
95-
// */
96-
// public function offsetSet(mixed $offset, mixed $value): void
97-
// {
98-
// $this->$offset = $value;
99-
// }
100-
101-
// /**
102-
// * Offset to unset
103-
// * @param mixed $offset The offset to unset.
104-
// */
105-
// public function offsetUnset(mixed $offset): void
106-
// {
107-
// $this->$offset = null;
108-
// }
10974
}

app/helpers/MetaFormats/FormatDefinitions/GroupPrivateDataFormat.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
use App\Helpers\MetaFormats\Validators\VArray;
99
use App\Helpers\MetaFormats\Validators\VBool;
1010
use App\Helpers\MetaFormats\Validators\VDouble;
11-
use App\Helpers\MetaFormats\Validators\VEmail;
1211
use App\Helpers\MetaFormats\Validators\VInt;
13-
use App\Helpers\MetaFormats\Validators\VMixed;
14-
use App\Helpers\MetaFormats\Validators\VString;
1512
use App\Helpers\MetaFormats\Validators\VTimestamp;
1613
use App\Helpers\MetaFormats\Validators\VUuid;
17-
use ArrayAccess;
1814

15+
/**
16+
* Nested Format definition used by the GroupFormat.
17+
*/
1918
#[Format(GroupPrivateDataFormat::class)]
2019
class GroupPrivateDataFormat extends MetaFormat
2120
{

app/helpers/MetaFormats/FormatDefinitions/SuccessResponseFormat.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
use App\Helpers\MetaFormats\Validators\VInt;
1010
use App\Helpers\MetaFormats\Validators\VMixed;
1111

12+
/**
13+
* Wrapper Format definition of the common output schema.
14+
* The ResponseFormat attribute has a flag that can automatically wrap any Format with this one.
15+
*/
1216
#[Format(SuccessResponseFormat::class)]
1317
class SuccessResponseFormat extends MetaFormat
1418
{

app/model/view/GroupViewFactory.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use App\Helpers\EvaluationStatus\EvaluationStatus;
66
use App\Helpers\GroupBindings\GroupBindingAccessor;
7-
use App\Helpers\MetaFormats\FormatDefinitions\GroupFormat;
87
use App\Helpers\PermissionHints;
98
use App\Model\Entity\Assignment;
109
use App\Model\Entity\AssignmentSolution;
@@ -272,28 +271,6 @@ function (Group $group) use ($ignoreArchived) {
272271
}
273272
);
274273

275-
// $groupFormat = new GroupFormat();
276-
// $groupFormat->id = $group->getId();
277-
// $groupFormat->externalId = $group->getExternalId();
278-
// $groupFormat->organizational = $group->isOrganizational();
279-
// $groupFormat->exam = $group->isExam();
280-
// $groupFormat->archived = $group->isArchived();
281-
// $groupFormat->public = $group->isPublic();
282-
// $groupFormat->directlyArchived = $group->isDirectlyArchived();
283-
// $groupFormat->localizedTexts = $group->getLocalizedTexts()->getValues();
284-
// $groupFormat->primaryAdminsIds = $group->getPrimaryAdminsIds();
285-
// $groupFormat->parentGroupId = $group->getParentGroup() ? $group->getParentGroup()->getId() : null;
286-
// $groupFormat->parentGroupsIds = $group->getParentGroupsIds();
287-
// $groupFormat->childGroups = $childGroups->map(
288-
// function (Group $group) {
289-
// return $group->getId();
290-
// }
291-
// )->getValues();
292-
// $groupFormat->privateData = $privateData;
293-
// $groupFormat->permissionHints = PermissionHints::get($this->groupAcl, $group);
294-
295-
// return $groupFormat;
296-
297274
return [
298275
"id" => $group->getId(),
299276
"externalId" => $group->getExternalId(),

0 commit comments

Comments
 (0)