In CI3 I was able to set private o protected method in controller, for example:
Code:
private function _human_filesize($bytes, $decimals = 2)
{
$factor = floor((strlen($bytes) - 1) / 3);
if ($factor > 0) $sz = 'KMGT';
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor - 1] . 'B';
}
then I could call the private function within the same controller with:
Code:
$this->_human_filesize($size);
Can we do the same in CI4? ...Sorry I'm a bit lost about this point reading the online guide