How to replace this :
if( $this->getInfo() ){ $value = $this->getInfo(); }else{ $value = $this->getAnotherInfo(); } This would be nicer solution :
$value = $this->getInfo() ? $this->getInfo() : $this->getAnotherInfo(); But we repeat $this->getInfo().
$this->getInfo()to the variable, then work with this variable. Otherwise you can't escape double calling of this method.$var = fn() ? : 1;fn() called once. Tested.