{$name}(...$arguments); } // Getters if (empty($arguments)) { // Apparently Doctrine first tries the method with the same // name as the property if (property_exists($this, $name)) { return $this->{$name}; } if (str_starts_with($name, 'get')) { $var = lcfirst(substr($name, 3)); if (property_exists($this, $var)) { return $this->{$var}; } } if (str_starts_with($name, 'is')) { $var = lcfirst(substr($name, 2)); if (property_exists($this, $var)) { return $this->{$var}; } } } // Setters if (str_starts_with($name, 'set')) { $var = lcfirst(substr($name, 3)); if (property_exists($this, $var)) { $this->{$name} = $arguments[0]; } return $this; } throw new InvalidArgumentException("Undefined method: {$name}"); } }