Skip to content

Commit

Permalink
chore: Code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
annalinneajohansson committed Jan 19, 2024
1 parent d0dc429 commit 16ce467
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
30 changes: 30 additions & 0 deletions library/Controller/ContentType/ContentTypeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,54 @@ class ContentTypeFactory implements ContentTypeComponentInterface
protected string $key;
protected string $label;

/**
* ContentTypeFactory constructor.
*
* @param string $key The key of the content type.
* @param string $label The label of the content type.
*/
public function __construct(string $key, string $label)
{
$this->key = $key;
$this->label = $label;
}

/**
* Get the label of the content type.
*
* @return string The label of the content type.
*/
public function getLabel(): string
{
return $this->label;
}

/**
* Get the key of the content type.
*
* @return string The key of the content type.
*/
public function getKey(): string
{
return $this->key;
}

/**
* Get the view for the content type.
*
* @return string The view for the content type.
*/
public function getView(): string
{
return "content-type-{$this->getKey()}";
}

/**
* Get the structured data for a post.
*
* @param int $postId The ID of the post.
* @return array|null The structured data for the post.
*/
public function getStructuredData(int $postId): ?array
{
return [];
Expand Down
13 changes: 13 additions & 0 deletions library/Controller/ContentType/School.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class School extends ContentTypeFactory implements ContentTypeComplexInterface
public $secondaryContentType = [];
protected object $postMeta;

/**
* Class constructor.
*/
public function __construct()
{
$this->key = 'school';
Expand All @@ -26,6 +29,11 @@ public function __construct()
$this->addSecondaryContentType(new Person());
}

/**
* Add hooks for the School content type.
*
* @return void
*/
public function addHooks(): void
{
$dataPreparer = new SchoolDataPreparer();
Expand All @@ -44,6 +52,11 @@ public function addSecondaryContentType(ContentTypeComponentInterface $contentTy
$this->secondaryContentType[] = $contentType;
}

/**
* Get the secondary content types associated with the school.
*
* @return array The array of secondary content types.
*/
public function getSecondaryContentType(): array
{
return $this->secondaryContentType;
Expand Down

0 comments on commit 16ce467

Please sign in to comment.