Initiates color object from given array

@param  array $value

@return AbstractColor
779934
public function initFromArray($array)
    {
        $array = array_values($array);

        if (count($array) == 4) {

            // color array with alpha value
            list($r, $g, $b, $a) = $array;
            $this->a = $this->alpha2gd($a);

        } elseif (count($array) == 3) {

            // color array without alpha value
            list($r, $g, $b) = $array;
            $this->a = 0;

        }

        $this->r = $r;
        $this->g = $g;
        $this->b = $b;

        return $this;
    }
775144
public function push($value): AbstractArray
    {
        $value = $this->filterValue($value);
        if (is_null($value)) {
            return $this;
        }

        array_push($this->values, $value);
        $this->atomics['$push']['$each'][] = $value;

        return $this;
    }
1363766
protected function serialize($value)
    {
        if (!is_array($value)) {
            return $value;
        }
        return Serialize::serialize($value, $this->serializer);
    }
544197
public function fromRaw($value)
    {
        $type = $this->getDataType();

        if ($type === 'json') {
            $value = json_decode($value, true);
        } elseif ($type === 'array') {
            $value = (array) $value;
        } elseif ($type === 'list') {
            $value = explode(',', $value);
        } elseif ($type === 'boolean') {
            $value = $value ? '1' : '0';
        } elseif ($type === 'integer') {
            if (strlen($value)) {
                $value = (int) $value;
            } else {
                $value = null;
            }
        } elseif ($type === 'float') {
            if (strlen($value)) {
                $value = (float) $value;
            } else {
                $value = null;
            }
        }

        return $value;
    }
910885
public function initFromString($value)
    {
        if ($color = $this->rgbaFromString($value)) {
            $this->r = $color[0];
            $this->g = $color[1];
            $this->b = $color[2];
            $this->a = $this->alpha2gd($color[3]);
        }

        return $this;
    }
1288423
public function color($name = null, $value = null) 
	{
		Argument::i()
			->test(1, 'string', 'null')
			->test(2, 'string', 'null');
			
		$field = Color::i($name);
		
		if(!is_null($name)) {
			$field->setName($name);
		}
		
		if(!is_null($value)) {
			$field->setValue($value);
		}
		
		return $field;
	}
1108442
public function initFromInteger($value)
    {
        $this->a = ($value >> 24) & 0xFF;
        $this->r = ($value >> 16) & 0xFF;
        $this->g = ($value >> 8) & 0xFF;
        $this->b = $value & 0xFF;

        return $this;
    }
43224
protected function serializeObject(array $value)
    {
        if (null !== $this->mappings) {
            /** @var \NilPortugues\Api\Mapping\Mapping $mapping */
            foreach ($this->mappings as $class => $mapping) {
                RecursiveDeleteHelper::deleteProperties($this->mappings, $value, $class);
                RecursiveRenamerHelper::renameKeyValue($this->mappings, $value, $class);
            }
        }

        $this->setResponseMeta($value);
        $this->setResponseLinks($value);
        self::formatScalarValues($value);
        RecursiveDeleteHelper::deleteKeys($value, [Serializer::CLASS_IDENTIFIER_KEY]);
        self::flattenObjectsWithSingleKeyScalars($value);
        $this->recursiveSetKeysToUnderScore($value);

        return $value;
    }
1120440
protected function __wrap($value)
    {
        if (is_object($value)) {
            return $value;
        }

        return $this->isArrayable($value)
            ? new static($this->wrap($value)->toArray())
            : $value;
    }
370804
protected function formatValue($value)
    {
        if (is_array($value)) {
            return Formatter::formatArray($value);
        }

        return Formatter::formatScalar($value);
    }
344561
private function prepareRow($value)
    {
        if (is_array($value) and count($value) === 1) {
            $value = array_shift($value);
        }

        return $value;
    }
1029919
public static function fromArray(array $value)
    {
        $language = null;
        $culture = null;

        if (!empty($value['language'])) {
            $language = $value['language'];
        } elseif ($value[0]) {
            $language = $value[0];
        }

        if (!empty($value['culture'])) {
            $culture = $value['culture'];
        } elseif ($value[1]) {
            $culture = $value[1];
        }

        return new static($language, $culture);
    }
385325
protected function unserializeObject(array $value)
    {
        $className = $value[self::CLASS_IDENTIFIER_KEY];
        unset($value[self::CLASS_IDENTIFIER_KEY]);

        if (isset($value[self::MAP_TYPE])) {
            unset($value[self::MAP_TYPE]);
            unset($value[self::SCALAR_VALUE]);
        }

        if ($className[0] === '@') {
            return self::$objectMapping[substr($className, 1)];
        }

        if (!class_exists($className)) {
            throw new SerializerException('Unable to find class '.$className);
        }

        return (null === ($obj = $this->unserializeDateTimeFamilyObject($value, $className)))
            ? $this->unserializeUserDefinedObject($value, $className) : $obj;
    }
1043884
protected function serialization(array &$value)
    {
        $data = [
            self::DATA_KEY => \array_merge(
                PropertyHelper::setResponseDataTypeAndId($this->mappings, $value),
                DataAttributesHelper::setResponseDataAttributes($this->mappings, $value),
                DataLinksHelper::setResponseDataLinks($this->mappings, $value),
                DataLinksHelper::setResponseDataRelationship($this->mappings, $value, $value)
            ),
        ];

        DataIncludedHelper::setResponseDataIncluded($this->mappings, $value, $data);

        $this->setResponseLinks($value, $data);
        $this->setResponseMeta($data);
        $this->setResponseVersion($data);

        return $data;
    }
1187723
public function initFromString($value)
    {
        if ($color = $this->rgbaFromString($value)) {
            $this->setPixel($color[0], $color[1], $color[2], $color[3]);
        }
    }
1336394
public function assertColor($value)
    {
        if ($color = $this->coerceColor($value)) {
            return $color;
        }

        $this->throwError('expecting color, %s received', $value[0]);
    }
203365
public function decorate($value)
    {
        if ($value instanceof PresenterInterface) {
            return $value;
        }

        if ($value instanceof PresentableInterface) {
            return $value->presenter();
        }

        $result = $value;
        if (is_array($value)) {
            $result = [];
            foreach ($value as $k => $v) {
                $result[$k] = $this->decorate($v);
            }
        }

        return $result;
    }