Here is a small script that can generate the code for your interface.
I haven't tested it, so watch out for typos.
You can make it look a bit nicer if you have the time.
$attributes = [
'first_attribute_code' => [
'label'=>'Label 1',
'type' => 'string'
],
'second_attribute_code' => [
'label'=>'Label 2',
'type' => 'int'
],
];
$interfaceName = '\Interface\Name\Here';
$tab = ' '; //4 spaces
$eol = "\n"; //end of line
$content = '';
//generate constants
foreach ($attributes as $code=>$label) {
$content .= $tab.'const '.strtoupper($code).' = '.$code.';'.$eol;
}
$content .= $eol;
//generate getters and setters for interface
foreach ($attributes as $code=>$settings) {
$camelCaseCode = str_replace(' ', '', ucwords(str_replace('_', ' ', $code)));
$lowerCamelCaseCode = lcfirst($camelCaseCode);
$content .= $tab.'/**'.$eol;
$content .= $tab.' * Getter for '.$settings['label'].$eol;
$content .= $tab.' * '.$eol;
$content .= $tab.' * @return '.$settings['type'].$eol;
$content .= $tab.' */'.$eol;
$content .= $tab.'public function get'.$camelCaseCode.'();'.$eol;
$content .= $tab.'/**'.$eol;
$content .= $tab.' * setter for '.$settings['label'].$eol;
$content .= $tab.' * '.$eol;
$content .= $tab.' * @param '.$settings['type'].' $'.$lowerCamelCaseCode.$eol;
$content .= $tab.' * @return '.$interfaceName.$eol;
$content .= $tab.' */'.$eol;
$content .= $tab.'public function set'.$camelCaseCode.'($'.$lowerCamelCaseCode.');'.$eol;
}
//generate the implementation methods
foreach ($attributes as $code=>$settings) {
$camelCaseCode = str_replace(' ', '', ucwords(str_replace('_', ' ', $code)));
$lowerCamelCaseCode = lcfirst($camelCaseCode);
$content .= $tab.'/**'.$eol;
$content .= $tab.' * Getter for '.$settings['label'].$eol;
$content .= $tab.' * '.$eol;
$content .= $tab.' * @return '.$settings['type'].$eol;
$content .= $tab.' */'.$eol;
$content .= $tab.'public function get'.$camelCaseCode.'()'.$eol;
$content .= $tab.'{'.$eol;
$content .= $tab.$tab.'return $this->getData('.$interfaceName.'::'.strtoupper($code).')'.$eol;
$content .= $tab.'}'.$eol;
$content .= $tab.'/**'.$eol;
$content .= $tab.' * setter for '.$settings['label'].$eol;
$content .= $tab.' * '.$eol;
$content .= $tab.' * @param '.$settings['type'].' $'.$lowerCamelCaseCode.$eol;
$content .= $tab.' * @return '.$interfaceName.$eol;
$content .= $tab.' */'.$eol;
$content .= $tab.'public function set'.$camelCaseCode.'($'.$lowerCamelCaseCode.')'.$eol;
$content .= $tab.'{'.$eol;
$content .= $tab.$tab.'return $this->setData('.$interfaceName.'::'.strtoupper($code).', '.$lowerCamelCaseCode.')'.$eol;
$content .= $tab.'}'.$eol;
}
//do something with $content