str = $str; $this->char($char)->repeat($repeat); } /** * Set the character(s) to repeat on either side * * @param string $char * * @return Flank */ public function char($char) { $this->set('char', $char); return $this; } /** * Set the repeat of the flank character(s) * * @param integer $repeat * * @return Flank */ public function repeat($repeat) { $this->set('repeat', $repeat); return $this; } /** * Return the flanked string * * @return string */ public function result() { $flank = str_repeat($this->char, $this->repeat); return "{$flank} {$this->str} {$flank}"; } }