<?php
/**
 $targets に記載されたメソッド名よりsetter/getterを生成します
 */
$targets = [
    "FooName",
    "BarName"
];
$entityName = "fuga";
foreach ($targets as $target) {
    $methodName = $target;
    $propertyName = lcfirst($target);
    $template = <<<TEMPLATE
    /**
     * Set {$propertyName}
     *
     * @param string \${$propertyName}
     * @return {$entityName}
     */
    public function set{$methodName}(\${$propertyName})
    {
        \$this->{$propertyName} = \${$propertyName};
        return \$this;
    }
    /**
     * Get {$propertyName}
     *
     * @return string
     */
    public function get{$methodName}()
    {
        return \$this->{$propertyName};
    }
TEMPLATE;
    echo $template;
}