Skip to content

Commit

Permalink
refactor: remove unused PostObject::getTermIcon() (#1240)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorbrink authored Jan 13, 2025
1 parent 095ec28 commit b0bf957
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 398 deletions.
2 changes: 1 addition & 1 deletion library/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function __construct(
$this->wpService->addFilter('Municipio/Helper/Post/postObject', function (WP_Post $post) {

// Place
$decorator = new \Municipio\PostDecorators\ApplyBookingLinkToPlace($this->acfService, $decorator);
$decorator = new \Municipio\PostDecorators\ApplyBookingLinkToPlace($this->acfService);
$decorator = new \Municipio\PostDecorators\ApplyInfoListToPlace(
$this->acfService,
new Listing(),
Expand Down
3 changes: 0 additions & 3 deletions library/Helper/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
use Municipio\Integrations\Component\ImageResolver;
use ComponentLibrary\Integrations\Image\Image as ImageComponentContract;
use Municipio\Helper\Term\Term;
use Municipio\PostObject\TermIcon\TryGetTermIcon;
use Municipio\PostObject\Decorators\BackwardsCompatiblePostObject;
use Municipio\PostObject\Decorators\IconResolvingPostObject;
use Municipio\PostObject\Decorators\PostObjectFromWpPost;
use Municipio\PostObject\Decorators\PostObjectWithTermIcons;
use Municipio\PostObject\Icon\Resolvers\CachedIconResolver;
use Municipio\PostObject\Icon\Resolvers\NullIconResolver;
use Municipio\PostObject\Icon\Resolvers\TermIconResolver;
Expand Down Expand Up @@ -155,7 +153,6 @@ private static function convertWpPostToPostObject(WP_Post $post, string $cacheGr
$wpService = \Municipio\Helper\WpService::get();

$postObject = new PostObjectFromWpPost(new PostObject(), $post, $wpService);
$postObject = new PostObjectWithTermIcons($postObject, $wpService, new TryGetTermIcon());

$iconResolver = new CachedIconResolver($postObject, new TermIconResolver($postObject, $wpService, new Term($wpService, AcfService::get()), new NullIconResolver()));
$postObject = new IconResolvingPostObject($postObject, new TermIconResolver($postObject, $wpService, new Term($wpService, AcfService::get()), $iconResolver));
Expand Down
16 changes: 0 additions & 16 deletions library/PostObject/Decorators/AbstractPostObjectDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ public function getCommentCount(): int
return $this->postObject->getCommentCount();
}

/**
* @inheritDoc
*/
public function getTermIcons(): array
{
return $this->postObject->getTermIcons();
}

/**
* @inheritDoc
*/
Expand All @@ -61,14 +53,6 @@ public function getPostType(): string
return $this->postObject->getPostType();
}

/**
* @inheritDoc
*/
public function getTermIcon(?string $taxonomy = null): ?TermIconInterface
{
return $this->postObject->getTermIcon($taxonomy);
}

/**
* @inheritDoc
*/
Expand Down
92 changes: 0 additions & 92 deletions library/PostObject/Decorators/PostObjectWithTermIcons.php

This file was deleted.

127 changes: 0 additions & 127 deletions library/PostObject/Decorators/PostObjectWithTermIcons.test.php

This file was deleted.

16 changes: 0 additions & 16 deletions library/PostObject/PostObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ public function getCommentCount(): int
return 0;
}

/**
* @inheritDoc
*/
public function getTermIcons(): array
{
return [];
}

/**
* @inheritDoc
*/
Expand All @@ -59,14 +51,6 @@ public function getPostType(): string
return '';
}

/**
* @inheritDoc
*/
public function getTermIcon(?string $taxonomy = null): ?TermIconInterface
{
return null;
}

/**
* @inheritDoc
*/
Expand Down
16 changes: 0 additions & 16 deletions library/PostObject/PostObject.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ public function testGetCommentCountReturns0()
$this->assertEquals(0, $this->instance->getCommentCount());
}

/**
* @testdox getTermIcons() returns an empty array
*/
public function testGetTermIconsReturnsAnEmptyArray()
{
$this->assertEquals([], $this->instance->getTermIcons());
}

/**
* @testdox getPostType() returns an empty string
*/
Expand All @@ -64,14 +56,6 @@ public function testGetPostTypeReturnsAnEmptyString()
$this->assertEquals('', $this->instance->getPostType());
}

/**
* @testdox getTermIcon() returns null
*/
public function testGetTermIconReturnsNull()
{
$this->assertNull($this->instance->getTermIcon());
}

/**
* @testdox getIcon() returns null
*/
Expand Down
16 changes: 0 additions & 16 deletions library/PostObject/PostObjectInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,6 @@ public function getPermalink(): string;
*/
public function getCommentCount(): int;

/**
* Get the term icons.
*
* @return \Municipio\PostObject\TermIcon\TermIconInterface[]
*/
public function getTermIcons(): array;

/**
* Get the term icon.
* The first term icon found.
*
* @param string|null $taxonomy Optional taxonomy to get the term icon from. If null, the first term icon found will be returned regardless of taxonomy.
* @return \Municipio\PostObject\TermIcon\TermIconInterface|null The first term icon found or null if none is found.
*/
public function getTermIcon(?string $taxonomy = null): ?TermIconInterface;

/**
* Get the post type.
*/
Expand Down
21 changes: 0 additions & 21 deletions library/PostObject/TermIcon/TermIconInterface.php

This file was deleted.

Loading

0 comments on commit b0bf957

Please sign in to comment.