Skip to content

Commit 4da21af

Browse files
committed
feat: added method to check for # (#2632)
1 parent 957488e commit 4da21af

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

phpmyfaq/src/phpMyFAQ/Faq.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2553,4 +2553,9 @@ public function getInactiveFaqsData(): array
25532553

25542554
return $inactive;
25552555
}
2556+
2557+
public function hasTitleAHash(string $title): bool
2558+
{
2559+
return strpos($title, '#');
2560+
}
25562561
}

phpmyfaq/src/phpMyFAQ/Faq/FaqMetaData.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
22

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

3435
private ?string $faqLanguage = null;
3536

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

3840
/**

tests/phpMyFAQ/FaqTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,10 @@ public function testSetUser(): void
4747
{
4848
$this->assertInstanceOf(Faq::class, $this->faq->setUser(-1));
4949
}
50+
51+
public function testHasTitleAHash(): void
52+
{
53+
$this->assertTrue($this->faq->hasTitleAHash('H#llo World!'));
54+
$this->assertFalse($this->faq->hasTitleAHash('Hallo World!'));
55+
}
5056
}

0 commit comments

Comments
 (0)