Does anyone know this PHP function syntax and how it works? It's not working with PHP 5.5
public function getProxiesTargetDir() : string
{
return $this->proxiesTargetDir ?: $this->proxiesTargetDir = sys_get_temp_dir();
}
You are using typed returns public function getProxiesTargetDir() : string which only exists starting from PHP 7.
For previous versions just remove : string > public function getProxiesTargetDir() {}
You are using the shorthand if/else syntax of PHP here, but let's use the long way:
public function getProxiesTargetDir()
{
if( $this->proxiesTargetDir == false ){
return ( $this->proxiesTargetDir = sys_get_temp_dir() );
}
else{
return $this->proxiesTargetDir;
}
}
If have also deleted the :string, because it can make errors and it is not really necessary here.
getSomething() { /* Do stuff here */ }