示例#1
0
 /**
  * This method creates a string of "n" length with every item set to the given object.
  *
  * @access public
  * @static
  * @param IChar\Type $x                                     the object to be replicated
  * @param IInt32\Type $n                                    the number of times to replicate
  * @return IString\Type                                     the string
  */
 public static function replicate(IChar\Type $x, IInt32\Type $n) : IString\Type
 {
     $buffer = '';
     $length = $n->unbox();
     for ($i = 0; $i < $length; $i++) {
         $buffer .= $x->__toString();
     }
     return IString\Type::box($buffer);
 }