Generate array of repeated values

@usage __::repeat('foo', 3);
*       >> ['foo', 'foo', 'foo']

@param string $object The object to repeat.
@param int    $times  ow many times has to be repeated.

@return array Returns a new array of filled values.
498884
public static function repeat($object = '', int $times = null): array
    {
        $times = abs($times);
        if ($times == null) {
            return [];
        }

        return array_fill(0, $times, $object);
    }
1302462
protected function createFormDataArray($object)
    {
        return array(
            "label" => $object->getLabel(),
            "title" => $object->getTitleId(),
            "firstname" => $object->getFirstname(),
            "lastname" => $object->getLastname(),
            "address1" => $object->getAddress1(),
            "address2" => $object->getAddress2(),
            "address3" => $object->getAddress3(),
            "zipcode" => $object->getZipcode(),
            "city" => $object->getCity(),
            "country" => $object->getCountryId(),
            "state" => $object->getStateId(),
            "cellphone" => $object->getCellphone(),
            "phone" => $object->getPhone(),
            "company" => $object->getCompany()
        );
    }
416188
public function times($times = null)
    {
        if (!func_num_args()) {
            return $this->_times;
        }
        $this->_times = $times;
        return $this;
    }
705205
public static function objectToArray($object = false) {

        if ($object && Validate::isObject($object)) {

            return self::objectToArrayRecursive($object);
        }

        return false;
    }
607009
protected function getPersistentValues(PersistentObject $object) {
    $values = [];

    // attribute definitions
    $attributeDescs = $this->getAttributes();
    foreach($attributeDescs as $curAttributeDesc) {
      if ($curAttributeDesc instanceof RDBAttributeDescription) {
        // add only attributes that are defined in the object
        $attribName = $curAttributeDesc->getName();
        //if ($object->hasValue($attribName)) {
          $values[$attribName] = $object->getValue($attribName);
        //}
      }
    }
    return $values;
  }
923924
protected function optimizeObjectContent($object)
	{
		$object = $this->recordObject($object);
		$this->deduplicateConfigValues();

		return $object->getValue();
	}
940548
function repeat(input, n) {

    var times = ~~n;

    return (!isString(input) || !times) ? input : strRepeat(input, n);
}
604970
public function retornaComentariosAtributos($object)
    {
        $arrAttrNames = self::pegaAtributosDoObjeto($object);
        $arrAttrComm  = array();
        
        $iterator = 0;
        $limit    = count($arrAttrNames);
        for ($iterator; $iterator < $limit; $iterator++) {

            $reflectionAttr = new ReflectionProperty($object, $arrAttrNames[$iterator]);

            $arrAttrComm[$arrAttrNames[$iterator]] = $reflectionAttr->getDocComment();
        }

        /**
         * @todo FAZER O FOR PARA PEGAR TODOS ATRIBUTOS, PASSAR NO SEGUNDO PARAMETRO;
         */
        return $arrAttrComm;
    }
1078544
private function serializeObjectRecursively($object): array
    {
        $reflection = new ReflectionClass($object);
        $properties = $reflection->getProperties();

        $data = [];
        foreach ($properties as $property) {
            $name = $property->getName();

            $property->setAccessible(true);
            $value = $property->getValue($object);
            $property->setAccessible(false);

            $data[$name] = $this->serializeValue($value);
        }

        return [
            'class' => get_class($object),
            'payload' => $data,
        ];
    }
1285087
public static function serialize($object) : array
    {
        $serializer = new static();
        $data = $serializer->serializeObject($object);

        if (sizeof($serializer->referencesUsed)) {
            foreach ($serializer->referencesUsed as $index) {
                $data['@references'][$index] = $serializer->references[$index];
            }
        }

        return $data;
    }
559363
private function deserializeObjectRecursively($serializedObject)
    {
        Assert::keyExists($serializedObject, 'class', "Key 'class' should be set.");
        Assert::keyExists($serializedObject, 'payload', "Key 'payload' should be set.");

        $reflection = new ReflectionClass($serializedObject['class']);
        $properties = $reflection->getProperties();
        $object = $reflection->newInstanceWithoutConstructor();

        foreach ($serializedObject['payload'] as $name => $value) {
            $matchedProperty = $this->findProperty($properties, $name);
            if (null === $matchedProperty) {
                throw new SerializationException(sprintf(
                    'Property \'%s\' not found for object \'%s\'',
                    $name,
                    $serializedObject['class']
                ));
            }

            $value = $this->deserializeValue($value);

            $matchedProperty->setAccessible(true);
            $matchedProperty->setValue($object, $value);
            $matchedProperty->setAccessible(false);
        }

        return $object;
    }
246905
public static function serialize($object)
	{
		if (is_array($object)) {
			$result = [];
			foreach ($object as $record) {
				$result[] = $record->toArray();
				$record = null;
			}
			$object = null;
			return $result;
		} else {
			return $object != null ? $object->toArray() : null;
		}
	}
1273314
protected static function convertToObjectRecursive( $node, $object )
	{
		$object->children	= new stdClass();
		$object->attributes	= new stdClass();
		foreach( $node->getChildren() as $childNode )
		{
			$childObject	= new stdClass();
			$nodeName		= $childNode->getNodeName();
			$object->children->$nodeName	= $childObject;
			self::convertToObjectRecursive( $childNode, $childObject );
		}
		if( $node->getAttributes() )
		{
			foreach( $node->getAttributes() as $key => $value )
				$object->attributes->$key	= $value;
		}
		$object->content = $node->getContent();
	}
926018
public function hash($object, $keys)
    {
        $keyValues = array_map(
            function ($k) use ($object) {
                $a = is_array($k);
                return sprintf('%s=%s',$a?$k[1]:$k, $object->{$a?$k[0]:$k});
            },
            $keys
        );

        return sprintf('%s[%s]', $this->_class, implode(',', $keyValues));
    }
1028541
private function _recursiveGetObjectVars($object)
    {
        $vars = $object;
        if ( is_object($object) ) {
            $vars = get_object_vars($object);
            foreach ($vars as $key => $value) {
                $vars[$key] = $this->_recursiveGetObjectVars($value);
            }
        }

        return $vars;
    }
1019377
public function repeat($multiplier)
    {
        $repeated = str_repeat($this->str, $multiplier);

        return static::create($repeated, $this->encoding);
    }
951472
private function serializeObject($object)
    {
        $payload = $this->getPayload($object);

        $curatedPayload = [];
        foreach ($payload as $key => $value) {
            $curatedPayload[$key] = $this->innerSerialize($value);
        }

        return $this->dataFormatter->format($this->classMapper->extractName(get_class($object)), $curatedPayload);
    }