Message convertions which returns attributes as an array

@param  array ['name' => '', 'parameters' => []]
@param  array
@param  array type of input
@return  array
18445
protected function _convertMessageIp($parsedRule, $attribute, $type) 
	{
		$message = Lang::get('validation.'.$parsedRule['name'], ['attribute' => $attribute]);
		return ['data-msg-ipv4' => $message];
	}
213987
public function formatAttributes(array $attributes) {
        foreach ($attributes as $key => $attr) {
            if ($attr instanceof Closure) {
                $attributes[$key] = call_user_func($attr, $this);

            } else if ($this->hasKeyword($attr)) {
                $attributes[$key] = $this->getKeyword($attr);

            } else if ($attr === true) {
                $attributes[$key] = $this->getKeyword($key);

            } else {
                $attributes[$key] = (string) $attr;
            }
        }

        return $attributes;
    }
491927
@Override
    protected Object[] convertParameters(Object[] params) {
        Iterator<Object> parameterIterator = Iterators.forArray(params);
        List<Object> converted = parameterConverters.stream().map(parameterBinding -> parameterBinding.convertParameter(parameterIterator)).collect(Collectors.toList());
        return converted.toArray(new Object[converted.size()]);
    }
737136
public static function RenderAttrs (array $attributes = []) {
		$result = [];
		foreach ($attributes as $attrName => $attrValue) {
			//if (gettype($attrValue) == 'array') $stop();
			$result[] = $attrName.'="'.$attrValue.'"';
		}
		return implode(' ', $result);
	}
693955
static function htmlAttributes(array $attributes = array()) {
    foreach ($attributes as $attribute => &$data) {
      $data = implode(' ', (array) $data);
      $data = $attribute . '="' . self::checkPlain($data) . '"';
    }
    return $attributes ? ' ' . implode(' ', $attributes) : '';
  }
914408
public static <T, J extends Convertable<T>> ArrayList<T> convert(J[] array) {
        return convert(array == null ? null : Arrays.asList(array));
    }
410189
private static List<String> toIdentifiers( JsonArray array)
    {
    return
      IntStream.range( 0, array.size())
      .mapToObj( i -> validIdentifier( array.getString( i)))
      .collect( toList());
    }
639566
public function attributesToArray()
    {
        // If an attribute is a date, we will cast it to a string after converting it
        // to a DateTime / Carbon instance. This is so we will get some consistent
        // formatting while accessing attributes vs. arraying / JSONing a model.
        $attributes = $this->addDateAttributesToArray(
            $attributes = $this->getArrayableAttributes()
        );

        $attributes = $this->addMutatedAttributesToArray(
            $attributes, $mutatedAttributes = $this->getMutatedAttributes()
        );

        // Next we will handle any casts that have been setup for this model and cast
        // the values to their appropriate type. If the attribute has a mutator we
        // will not perform the cast on those attributes to avoid any confusion.
        $attributes = $this->addCastAttributesToArray(
            $attributes, $mutatedAttributes
        );

        // Here we will grab all of the appended, calculated attributes to this model
        // as these attributes are not really in the attributes array, but are run
        // when we need to array or JSON the model for convenience to the coder.
        foreach ($this->getArrayableAppends() as $key) {
            $attributes[$key] = $this->mutateAttributeForArray($key, null);
        }

        return $attributes;
    }
896205
public static function convertArrayToFlatTextArray(array $array) {
    $rows = [];
    $max_line_length = 60;
    foreach ($array as $key => $value) {
      if (is_array($value)) {
        $flattened_array = self::flattenToDotNotatedKeys($value);
        foreach ($flattened_array as $sub_key => $sub_value) {
          if ($sub_value === TRUE) {
            $sub_value = 'true';
          }
          elseif ($sub_value === FALSE) {
            $sub_value = 'false';
          }
          $rows[] = [
            "$key.$sub_key",
            wordwrap($sub_value, $max_line_length, "\n", TRUE),
          ];
        }
      }
      else {
        if ($value === TRUE) {
          $contents = 'true';
        }
        elseif ($value === FALSE) {
          $contents = 'false';
        }
        else {
          $contents = wordwrap($value, $max_line_length, "\n", TRUE);
        }
        $rows[] = [$key, $contents];
      }
    }

    return $rows;
  }
1086330
public function getColumnNamesFromAttributes($array)
    {
        if (!empty($this->mappings)) {
            $newArray = [];
            $flipped = array_flip($this->mappings);
            foreach ($array as $key => $value) {
                $attributeName = isset($flipped[$key]) ? $flipped[$key] : $key;
                $newArray[$attributeName] = $value;
            }

            return $newArray;
        }
        if ($this->camelCaseHydratation) {
            $newArray = [];
            foreach ($array as $key => $value) {
                $attributeName = snake_case($key);
                $newArray[$attributeName] = $value;
            }

            return $newArray;
        }

        return $array;
    }
346092
public function attributesToArray()
    {
        // unset date values that are 0, so they don't cause problems with serializeDate()
        foreach ($this->getDates() as $key) {
            if ( ! isset($this->attributes[$key])) continue;

            // 0 should be considered 'unset' aswell
            if (0 === $this->attributes[$key]) {
                $this->attributes[$key] = null;
            }
        }

        return parent::attributesToArray();
    }
1348631
public function getAttributeNamesFromColumns($array)
    {
        if (!empty($this->mappings)) {
            $newArray = [];
            foreach ($array as $key => $value) {
                $attributeName = isset($this->mappings[$key]) ? $this->mappings[$key] : $key;
                $newArray[$attributeName] = $value;
            }

            return $newArray;
        }

        return $array;
    }
1245448
private function convertIssuers($array)
    {
        $return = array();
        foreach ($array as $value) {
            array_push($return, array(
                'IssuerKeyword' => $value->IssuerKeyword,
                'Description' => $value->Description,
                'Countries' => $this->convertCountries($this->forceArray($value->Countries->Country))
                    )
            );
        }
        return $return;
    }
104047
void convertWrapperArraysToPrimitiveArrays(final ClassInfo annotationClassInfo, final String paramName) {
        if (annotationInfo != null) {
            // Recursively convert primitive arrays in nested annotations
            annotationInfo.convertWrapperArraysToPrimitiveArrays();
        } else if (objectArrayValue != null) {
            for (final ObjectTypedValueWrapper elt : objectArrayValue) {
                if (elt.annotationInfo != null) {
                    // Recurse
                    elt.annotationInfo.convertWrapperArraysToPrimitiveArrays();
                }
            }

            if (objectArrayValue.getClass().getComponentType().isArray()) {
                // More than one array dimension -- not possible for annotation parameter values => skip
                return;
            }

            // Find the method in the annotation class with the same name as the annotation parameter.
            final String targetElementTypeName = (String) getArrayValueClassOrName(annotationClassInfo, paramName,
                    /* getClass = */ false);

            // Get array element type for 1D non-primitive arrays, and convert to a primitive array
            switch (targetElementTypeName) {
            case "java.lang.String":
                // Convert Object[] array containing String objects to String[] array
                stringArrayValue = new String[objectArrayValue.length];
                for (int j = 0; j < objectArrayValue.length; j++) {
                    stringArrayValue[j] = objectArrayValue[j].stringValue;
                }
                objectArrayValue = null;
                break;
            case "int":
                intArrayValue = new int[objectArrayValue.length];
                for (int j = 0; j < objectArrayValue.length; j++) {
                    final ObjectTypedValueWrapper elt = objectArrayValue[j];
                    if (elt == null) {
                        throw new IllegalArgumentException("Illegal null value for array of element type "
                                + targetElementTypeName + " in parameter " + paramName + " of annotation class "
                                + annotationClassInfo.getName());
                    }
                    intArrayValue[j] = objectArrayValue[j].integerValue;
                }
                objectArrayValue = null;
                break;
            case "long":
                longArrayValue = new long[objectArrayValue.length];
                for (int j = 0; j < objectArrayValue.length; j++) {
                    final ObjectTypedValueWrapper elt = objectArrayValue[j];
                    if (elt == null) {
                        throw new IllegalArgumentException("Illegal null value for array of element type "
                                + targetElementTypeName + " in parameter " + paramName + " of annotation class "
                                + annotationClassInfo.getName());
                    }
                    longArrayValue[j] = objectArrayValue[j].longValue;
                }
                objectArrayValue = null;
                break;
            case "short":
                shortArrayValue = new short[objectArrayValue.length];
                for (int j = 0; j < objectArrayValue.length; j++) {
                    final ObjectTypedValueWrapper elt = objectArrayValue[j];
                    if (elt == null) {
                        throw new IllegalArgumentException("Illegal null value for array of element type "
                                + targetElementTypeName + " in parameter " + paramName + " of annotation class "
                                + annotationClassInfo.getName());
                    }
                    shortArrayValue[j] = objectArrayValue[j].shortValue;
                }
                objectArrayValue = null;
                break;
            case "char":
                charArrayValue = new char[objectArrayValue.length];
                for (int j = 0; j < objectArrayValue.length; j++) {
                    final ObjectTypedValueWrapper elt = objectArrayValue[j];
                    if (elt == null) {
                        throw new IllegalArgumentException("Illegal null value for array of element type "
                                + targetElementTypeName + " in parameter " + paramName + " of annotation class "
                                + annotationClassInfo.getName());
                    }
                    charArrayValue[j] = objectArrayValue[j].characterValue;
                }
                objectArrayValue = null;
                break;
            case "float":
                floatArrayValue = new float[objectArrayValue.length];
                for (int j = 0; j < objectArrayValue.length; j++) {
                    final ObjectTypedValueWrapper elt = objectArrayValue[j];
                    if (elt == null) {
                        throw new IllegalArgumentException("Illegal null value for array of element type "
                                + targetElementTypeName + " in parameter " + paramName + " of annotation class "
                                + annotationClassInfo.getName());
                    }
                    floatArrayValue[j] = objectArrayValue[j].floatValue;
                }
                objectArrayValue = null;
                break;
            case "double":
                doubleArrayValue = new double[objectArrayValue.length];
                for (int j = 0; j < objectArrayValue.length; j++) {
                    final ObjectTypedValueWrapper elt = objectArrayValue[j];
                    if (elt == null) {
                        throw new IllegalArgumentException("Illegal null value for array of element type "
                                + targetElementTypeName + " in parameter " + paramName + " of annotation class "
                                + annotationClassInfo.getName());
                    }
                    doubleArrayValue[j] = objectArrayValue[j].doubleValue;
                }
                objectArrayValue = null;
                break;
            case "boolean":
                booleanArrayValue = new boolean[objectArrayValue.length];
                for (int j = 0; j < objectArrayValue.length; j++) {
                    final ObjectTypedValueWrapper elt = objectArrayValue[j];
                    if (elt == null) {
                        throw new IllegalArgumentException("Illegal null value for array of element type "
                                + targetElementTypeName + " in parameter " + paramName + " of annotation class "
                                + annotationClassInfo.getName());
                    }
                    booleanArrayValue[j] = objectArrayValue[j].booleanValue;
                }
                objectArrayValue = null;
                break;
            case "byte":
                byteArrayValue = new byte[objectArrayValue.length];
                for (int j = 0; j < objectArrayValue.length; j++) {
                    final ObjectTypedValueWrapper elt = objectArrayValue[j];
                    if (elt == null) {
                        throw new IllegalArgumentException("Illegal null value for array of element type "
                                + targetElementTypeName + " in parameter " + paramName + " of annotation class "
                                + annotationClassInfo.getName());
                    }
                    byteArrayValue[j] = objectArrayValue[j].byteValue;
                }
                objectArrayValue = null;
                break;
            default:
                // Leave objectArrayValue as-is
                break;
            }
        }
    }
1082781
protected function prepareAttributes(array $attributes)
    {
        foreach ($attributes as $key => $attribute) {
            if (in_array($key, $this->getDates()) && ! is_null($attribute)) {
                $attribute = $this->asDateTime($attribute);
            }
            if ($attribute instanceof DateTime) {
                $attribute = $this->fromDateTime($attribute);
            }
            $attributes[$key] = (string) $attribute;
        }
        return $attributes;
    }
388151
private Object convertArrayToArray(Object array) {
		final Class<?> valueComponentType = ArrayUtil.getComponentType(array);

		if (valueComponentType == targetComponentType) {
			return array;
		}

		final int len = ArrayUtil.length(array);
		final Object result = Array.newInstance(targetComponentType, len);

		final ConverterRegistry converter = ConverterRegistry.getInstance();
		for (int i = 0; i < len; i++) {
			Array.set(result, i, converter.convert(targetComponentType, Array.get(array, i)));
		}
		return result;
	}
130310
protected function buildAttributesArray(): array
    {
        $attributesArray = [];
        foreach (func_get_args() as $arg) {
            switch (gettype($arg)) {
                case 'string':
                    $attributesArray[] = $arg;
                    break;
                case 'array':
                    $this->analyseArrayAttributes($arg, $attributesArray);
                    break;
                case 'NULL':
                    break;
                default:
                    throw new Exception('The given attributes arguments should be strings or arrays : '
                                        . gettype($arg) . ' type given for « ' . $arg . ' » argument.');
            }
        }

        return array_map('trim', array_filter($attributesArray));
    }