From 5b3fa2d05c4a62d5b23d112b4315bbe46a19879a Mon Sep 17 00:00:00 2001 From: Sven Berg Ryen <svenryen@gmail.com> Date: Wed, 29 Jan 2025 10:26:27 +0100 Subject: [PATCH] WP142 #1377 Refactor ScimRecord methods and adjust position title logic. Reorder methods for better structure, clarify doc comments, and refine title formatting by reordering operations and improving string handling. --- src/ScimRecord.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ScimRecord.php b/src/ScimRecord.php index 000d4fe..bba5433 100644 --- a/src/ScimRecord.php +++ b/src/ScimRecord.php @@ -358,15 +358,6 @@ class ScimRecord { return $this->orgUnitSymbol; } - /** - * Sets organizational unit symbol. - */ - private function setOrgUnitSymbol(): void { - if (isset($this->data['no:edu:scim:user']['primaryOrgUnit']['symbol'])) { - $this->orgUnitSymbol = $this->data['no:edu:scim:user']['primaryOrgUnit']['symbol']; - } - } - /** * Returns title. * @@ -408,10 +399,10 @@ class ScimRecord { } /** - * Returns roles. + * Returns schemas. * * @return array - * Roles. + * Schemas. */ public function getSchemas(): array { return $this->schemas; @@ -512,6 +503,15 @@ class ScimRecord { } } + /** + * Sets organizational unit symbol. + */ + private function setOrgUnitSymbol(): void { + if (isset($this->data['no:edu:scim:user']['primaryOrgUnit']['symbol'])) { + $this->orgUnitSymbol = $this->data['no:edu:scim:user']['primaryOrgUnit']['symbol']; + } + } + /** * Sets username. * @@ -545,11 +545,11 @@ class ScimRecord { private function setPositionTitleToScimValue() :void { $title = ''; if (!empty($this->data['title']) && $this->data['title']) { + // This call is a bit mysterious, but it was done in W3. + $title = ltrim($this->data['title'], '0..9'); // Copying some logic from W3. - $title = ucfirst($this->data['title']); + $title = ucfirst($title); $title = str_replace('ii', 'II', $title); - // This call is a bit mysterious, but it was done in W3. - $title = ltrim($title, '0..9'); } $this->position = $title ?: ''; $this->positionEnglish = NULL; -- GitLab