Как настроить автокомплит для обращения к автоматически генерируемым методам класса?
Написал класс в кастомном движке который автоматически генерирует setter/getter ('s) для модели. Существует ли возможность, настроить автокомплит для обращения к получившимся в итоге методам?? Код класса, может так будет понятнее о чем я.
class PropertiesDbDataColumns extends DbDataColumns
{
protected function initProperties(array $class_vars)
{
foreach ($class_vars as $var_name => $var_type){
$this->initProperty($var_name, $var_type);
}
}
protected function initProperty($property_name, $type)
{
$method_name = $this->convertPropertyNameToMethodName($property_name);
$method_set = 'set'.$method_name;
$method_get = 'get'.$method_name;
$this->$method_set();
$this->$method_get()->setName($property_name);
$this->$method_get()->setType($type);
}
public function __call($name, $arguments)
{
$pattern = '/(get|set)([a-z0-9_]+)/i';
if(!preg_match($pattern, $name, $matches)) {
throw new Exception('Call to undefined method: '.$name);
}
$type_method = $matches[1];
$property_name = $this->convertMethodNameToPropertyName($matches[2]);
if(!property_exists($this, $property_name)) {
throw new Exception('Call to undefined property: '.$property_name);
}
if($type_method == 'get') {
return $this->$property_name;
} else {
$this->$property_name = new DbColumn();
}
}
private function convertMethodNameToPropertyName($method_name)
{
$pattern = '/[A-Z][^A-Z]*/';
if(!preg_match_all($pattern, $method_name, $matches)) {
return $method_name;
}
$property_name = '';
foreach($matches[0] as $str) {
if($property_name) {
$property_name .= '_';
}
$property_name .= strtolower($str);
}
return $property_name;
}
protected function convertPropertyNameToMethodName($property_name)
{
$arr = explode('_', $property_name);
$method_name = '';
foreach($arr as $str) {
$method_name .= ucfirst($str);
}
return $method_name;
}
}