Return a unique array of $array. This method also handles object as value.

@param array $array An Array

@return array
195324
public static function unique($array)
    {
        $unique = array();
        foreach ($array as $item) {
            if (!in_array($item, $unique, true)) {
                $unique[] = $item;
            }
        }

        return $unique;
    }
1283657
function unique (array) {
    var ret = [];

    array.forEach(function (val) {
        if (ret.indexOf(val) === -1) {
            ret.push(val);
        }
    });

    return ret;
}
866770
private function filterDuplicates($array)
    {
        $result = [];
        foreach ($array as $value) {
            if (!in_array($value, $result)) {
                $result[] = $value;
            }
        }
        return array_filter($result);
    }
179047
public static function ArrayAsObject($Array) {
      if (!is_array($Array))
         return $Array;

      $Return = new stdClass();
      foreach($Array as $Property => $Value) {
         $Return->$Property = $Value;
      }
      return $Return;
   }
1047886
protected function _convertArrayable(array $array)
    {
        $arr = [];

        foreach ($array as $key => $value) {
            if ($value instanceof ArrayableInterface) {
                $arr[$value instanceof NameableInterface ? $value->getName() : $key] = $value->toArray();
            } elseif (\is_array($value)) {
                $arr[$key] = $this->_convertArrayable($value);
            } else {
                $arr[$key] = $value;
            }
        }

        return $arr;
    }
231500
public function copyToArray(array &$array)
    {
        $array['grantType']            = LanguageUtility::toString($this->grantType);
        $array['clientId']             = LanguageUtility::orZero($this->clientId);
        $array['subject']              = $this->subject;
        $array['scopes']               = $this->scopes;
        $array['accessTokenDuration']  = LanguageUtility::orZero($this->accessTokenDuration);
        $array['refreshTokenDuration'] = LanguageUtility::orZero($this->refreshTokenDuration);
        $array['properties']           = LanguageUtility::convertArrayOfArrayCopyableToArray($this->properties);
        $array['clientIdAliasUsed']    = $this->clientIdAliasUsed;
        $array['accessToken']          = $this->accessToken;
        $array['refreshToken']         = $this->refreshToken;
    }
1262398
public static function array_copy($array)
    {
        if (!is_array($array)) {
            return $array;
        }

        $result = array();
        foreach ($array as $key => $val) {
            if (is_array($val)) {
                $result[$key] = self::array_copy($val);
            } elseif (is_object($val)) {
                $result[$key] = clone $val;
            } else {
                $result[$key] = $val;
            }
        }
        return $result;
    }
1040187
public function fromArray($array) {
		$array=parent::fromArray($array);
		foreach ( $array as $key => $value ) {
			$this->setProperty($key, $value);
		}
		return $array;
	}
41643
private function hasArrayDuplicates($array)
    {
        $compare = array();
        foreach ($array as $element) {
            // duplicate element found
            if (in_array($element, $compare, true)) {
                return true;
            } else {
                // add element to temporary array to check for duplicates
                $compare [] = $element;
            }
        }

        return false;
    }
914259
public static function writeArray($array)
    {
        $data = array();
        foreach ($array as $var=>$val) {
            if (is_array($val) && !is_object($val)) {
                $data[$var] = self::writeArray($val);
            } else {
                $data[$var] = self::writeArrayItem($val);
            }
        }
        return serialize($data);
    }
47292
public static function createFromArray(array $array)
    {
        $scoreStrategies = new self();
        $scoreStrategies->scoreMode = $array['score_mode'] ?: self::SUM;
        $scoreStrategies->scoreStrategies = array_map(function (array $scoreStrategy) {
            return ScoreStrategy::createFromArray($scoreStrategy);
        }, $array['score_strategies']);

        return $scoreStrategies;
    }
328788
public static function array_diverse($array)
    {
        $result = array();

        foreach ($array as $key1 => $value1) {
            if (is_array($value1)) {
                foreach ($value1 as $key2 => $value2) {
                    $result[$key2][$key1] = $value2;
                }
            } else {
                $result[0][$key1] = $value1;
            }
        }

        return $result;
    }
894394
public static function sortRecursive($array)
    {
        foreach ($array as &$value) {
            if (is_array($value)) {
                $value = static::sortRecursive($value);
            }
        }

        if (static::isAssociative($array)) {
            ksort($array);
        } else {
            sort($array);
        }

        return $array;
    }
303576
private static function arrayToObject(array $array)
    {
        $is_object = false;

        foreach ($array as $key => &$value) {
            if (is_array($value)) {
                $value = self::arrayToObject($value);
            }

            if (is_string($key)) {
                $is_object = true;
            }
        }

        return $is_object ? (object) $array : $array;
    }
1254829
public static function sortRecursive($array)
    {
        foreach ($array as &$value) {
            if (is_array($value)) {
                $value = static::sortRecursive($value);
            }
        }

        if (static::isAssoc($array)) {
            ksort($array);
        } else {
            sort($array);
        }

        return $array;
    }
326497
protected function arrayToObject(array $array)
    {
        $obj = (object) [];

        foreach ($array as $k => $v) {

            if (strlen($k)) {
                if (is_array($v)) {
                    $obj->{$k} = $this->arrayToObject($v);
                } else {
                    $obj->{$k} = $v;
                }
            }
        }

        return $obj;
    }
1367879
private static function getValueList(array $array): array
    {
        foreach ($array as $i => $attr)
            $array[$i] = (is_array($attr) ? self::getValueList($attr) : self::getValue($attr));

        return $array;
    }