diff --git a/phpbb/phpbb/mention/source/friend.php b/phpbb/phpbb/mention/source/friend.php index c0cbc261ce..8f78159b6c 100644 --- a/phpbb/phpbb/mention/source/friend.php +++ b/phpbb/phpbb/mention/source/friend.php @@ -32,6 +32,9 @@ class friend extends user parent::__construct($db); } + /** + * {@inheritdoc} + */ protected function query($keyword, $topic_id) { $query = $this->db->sql_build_query('SELECT', [ diff --git a/phpbb/phpbb/mention/source/source_interface.php b/phpbb/phpbb/mention/source/source_interface.php new file mode 100644 index 0000000000..ace5cc9149 --- /dev/null +++ b/phpbb/phpbb/mention/source/source_interface.php @@ -0,0 +1,27 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\mention\source; + +interface source_interface +{ + /** + * Searches database for names to mention + * and returns and array of found items + * + * @param string $keyword Search string + * @param int $topic_id Current topic ID + * @return array Array of names + */ + public function get($keyword, $topic_id); +} diff --git a/phpbb/phpbb/mention/source/topic.php b/phpbb/phpbb/mention/source/topic.php index 553abb07b6..1d72df711c 100644 --- a/phpbb/phpbb/mention/source/topic.php +++ b/phpbb/phpbb/mention/source/topic.php @@ -15,6 +15,9 @@ namespace phpbb\mention\source; class topic extends user { + /** + * {@inheritdoc} + */ protected function query($keyword, $topic_id) { $query = $this->db->sql_build_query('SELECT', [ diff --git a/phpbb/phpbb/mention/source/user.php b/phpbb/phpbb/mention/source/user.php index 216fafa36d..be0d39f3af 100644 --- a/phpbb/phpbb/mention/source/user.php +++ b/phpbb/phpbb/mention/source/user.php @@ -13,7 +13,7 @@ namespace phpbb\mention\source; -abstract class user +abstract class user implements source_interface { /** @var \phpbb\db\driver\driver_interface */ protected $db; @@ -26,8 +26,18 @@ abstract class user $this->db = $db; } + /** + * Builds a query based on user input + * + * @param string $keyword Search string + * @param int $topic_id Current topic ID + * @return string Query ready for execution + */ abstract protected function query($keyword, $topic_id); + /** + * {@inheritdoc} + */ public function get($keyword, $topic_id) { $keyword = utf8_clean_string($keyword);