These two PHP class methods violates Single Responsibility Principle (SRP) according to the phpmd rule booleanargumentflag.
How should they be written to avoid this?
If the solution is to remove the default value "= true", then how is this improving the code?
/**
* Set verbose mode.
*
* @param boolean $mode true or false to enable and disable verbose mode,
* default is true.
*
* @return $this
*/
public function setVerbose($mode = true)
{
$this->verbose = $mode;
return $this;
}
/**
* Use cache or not.
*
* @param string $use true or false to use cache.
*
* @return $this
*/
public function useCache($use = true)
{
$this->useCache = $use;
return $this;
}