Skip to content

Commit

Permalink
feat: added method to check for # (#2632)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Sep 11, 2023
1 parent 957488e commit 4da21af
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions phpmyfaq/src/phpMyFAQ/Faq.php
Original file line number Diff line number Diff line change
Expand Up @@ -2553,4 +2553,9 @@ public function getInactiveFaqsData(): array

return $inactive;
}

public function hasTitleAHash(string $title): bool
{
return strpos($title, '#');
}
}
4 changes: 3 additions & 1 deletion phpmyfaq/src/phpMyFAQ/Faq/FaqMetaData.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

/**
* FAQ meta data class for phpMyFAQ.
* FAQ meta-data class for phpMyFAQ.
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
Expand Down Expand Up @@ -33,6 +34,7 @@ class FaqMetaData

private ?string $faqLanguage = null;

/** @var int[]|null */
private ?array $categories = null;

/**
Expand Down
6 changes: 6 additions & 0 deletions tests/phpMyFAQ/FaqTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,10 @@ public function testSetUser(): void
{
$this->assertInstanceOf(Faq::class, $this->faq->setUser(-1));
}

public function testHasTitleAHash(): void
{
$this->assertTrue($this->faq->hasTitleAHash('H#llo World!'));
$this->assertFalse($this->faq->hasTitleAHash('Hallo World!'));
}
}

0 comments on commit 4da21af

Please sign in to comment.