mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/16935] Refactor sphinx to use new clases and remove unused parts
PHPBB3-16935
This commit is contained in:
@@ -14,12 +14,11 @@
|
||||
namespace phpbb\search\backend\sphinx;
|
||||
|
||||
/**
|
||||
* \phpbb\search\sphinx\config_variable
|
||||
* \phpbb\search\backend\sphinx\config_variable
|
||||
* Represents a single variable inside the sphinx configuration
|
||||
*/
|
||||
class config_variable
|
||||
class config_variable extends config_item
|
||||
{
|
||||
private $name;
|
||||
private $value;
|
||||
private $comment;
|
||||
|
||||
@@ -30,49 +29,29 @@ class config_variable
|
||||
* @param string $value Value of the variable
|
||||
* @param string $comment Optional comment after the variable in the
|
||||
* config file
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function __construct($name, $value, $comment)
|
||||
public function __construct(string $name, string $value, string $comment = '')
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->value = $value;
|
||||
$this->comment = $comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for the variable's name
|
||||
*
|
||||
* @return string The variable object's name
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function get_name()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows changing the variable's value
|
||||
*
|
||||
* @param string $value New value for this variable
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function set_value($value)
|
||||
public function set_value(string $value): void
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns this object into a string readable by sphinx
|
||||
*
|
||||
* @return string Config data in textual form
|
||||
*
|
||||
* @access public
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
function to_string()
|
||||
public function to_string(): string
|
||||
{
|
||||
return "\t" . $this->name . ' = ' . str_replace("\n", " \\\n", $this->value) . ' ' . $this->comment . "\n";
|
||||
return "\t" . $this->name . ' = ' . str_replace("\n", " \\\n", $this->value) . ($this->comment ? ' ' . $this->comment : '') . "\n";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user