在允许列表中加入本人: 允许本人操作

@param $array -origen, $key -array key, $id -page use id

@return $array new
424698
public function addSelf($array, $key, $id)
	{
		if($key != 'user' && $key != 'except') die('FooWeChat\Authorize\Auth\addSelf: 错误键名');

		if($this->selfId == $id){
			$self_work_id = Member::find($this->selfId)->work_id;

			if(array_has($array, $key)){
				$array[$key] = $array[$key].'|'.$self_work_id;
			}else{
				$array = array_add($array, $key, strval($self_work_id));
			}
		}
		return $array;
	}
119724
public static function sGet($array, $key, $default = null)
    {
        $value = self::get($array, $key);
        return !empty($value) ? $value : $default;
    }
372229
public static function createFromArray(array $array)
    {
        return new self(
            $array['id'],
            $array['source'],
            isset($array['parent'])
                ? self::createFromArray($array['parent'])
                : null,
            isset($array['children'])
                ? array_map(function (array $child) {
                    return Comment::createFromArray($child);
                }, $array['children'])
                : [],
            (string) $array['author_uuid'],
            $array['author_name'] ?? null,
            $array['author_email'] ?? null,
            $array['author_avatar'] ?? null,
            $array['author_role'] ?? null,
            $array['thumb'] ?? null,
            isset($array['rating'])
                ? (int) $array['rating']
                : null,
            $array['content'] ?? '',
            (int) $array['state'],
            isset($array['created_at'])
                ? DateTime::createFromFormat(DATE_ATOM, $array['created_at'])
                : null
        );
    }
687943
public static function column(array $array, $key, $index = null)
    {
        if (function_exists('array_column')) {
            return array_column($array, $key, $index);
        }

        $out = [];
        array_walk(
            $array,
            function ($item) use ($key, $index, &$out) {
                null !== $index ? $out[$item[$index]] = $item[$key] : $out[] = $item[$key];
            }
        );

        return $out;
    }
408059
public function edit($array)
	{
		$headers = array(
			'Content-Type' => "application/x-www-form-urlencoded"
		);

		$array['action'] = 'edit';
		$array['format'] = 'php';

		$apiResult = $this->session->post($this->api, $headers, $array);

		return unserialize($apiResult->body);
	}
682355
public static function pluck($array, $key)
    {
        return array_map(
            function ($v) use ($key) {
                return is_object($v) ? $v->$key : $v[$key];

            },
            $array
        );
    }
272631
function getKeysForDuplicates(array $array)
    {
        $duplicates = $newArray = [];

        foreach ($array as $key => $value) {

            if ( ! isset($newArray[ $value ])) {
                $newArray[ $value ] = $key;
                continue;
            }

            if (isset($duplicates[ $value ])) {
                $duplicates[ $value ][] = $key;
            } else {
                $duplicates[ $value ] = [
                    $newArray[ $value ],
                    $key
                ];
            }
        }

        return $duplicates;
    }
374384
public static function array_unique($array)
    {
        $keys = array_keys($array);
        $toDrop = array();
        for ($i = count($keys) - 1; $i >=0 ; $i-- ) {
            for ($j = $i - 1; $j >=0 ; $j--) {
                if ($array[$keys[$i]]->__equals($array[$keys[$j]])) {
                    $toDrop[] = $keys[$i];
                    break;
                }
            }
        }
        foreach ($toDrop as $key) {
            unset($array[$key]);
        }
        return $array;
    }
59495
private function array_get($array, $key, $default = null)
	{
		if (is_null($key)) return $array;
		foreach (explode('.', $key) as $segment)
		{
			if ( ! is_array($array) or ! array_key_exists($segment, $array))
			{
				return $default;
			}
			$array = $array[$segment] ?: $default;
		}
		return $array;
	}
696609
public function translateArray(array $array)
    {
        $result = array();

        foreach ($array as $key => $value) {
            // Group translation
            if (is_array($value)) {
                $key = $this->translate($key);

                // If group is not created yet, create it
                if (!isset($result[$key])){
                    $result[$key] = array();
                }

                foreach($value as $index => $inner) {
                    $result[$key][$index] = $this->translate($inner);
                }
                
            } else if (is_scalar($value)) {
                $result[$key] = $this->translate($value);
            } else {
                throw new InvalidArgumentException('Invalid array supplied');
            }
        }

        return $result;
    }
1006725
public static function getNextKey($key, array $array) {
		$keys = array_keys($array);
		$found_index = array_search($key, $keys);
		if($found_index === false || $found_index + 1 === count($keys))
			return false;
		return $keys[$found_index + 1];
	}
897823
public static function makeHashFromArray($array)
        {
            $hash = null;

            if (static::is($array) && count($array) > 1) {
                for ($i = 0; $i <= count($array); $i+= 2) {
                    if (isset($array[$i])) {
                        $key = $array[$i];
                        $value = $array[$i + 1];

                        if (!empty($key) && !empty($value)) {
                           $hash[$key] = $value;
                        }
                    }
                }
            }

            if (true === static::is($hash)) {
                return $hash;
            }
        }
791834
private function arrayClone(array $array) {
        return array_map(function ($element) {
            return ((is_array($element))
                ? $this->arrayClone($element)
                : ((is_object($element))
                    ? clone $element
                    : $element
                )
            );
        }, $array);
    }
423995
public static function array_pick($array) {
    if (!is_array( $array )) {
      return $array;
    }
    $keys = array_slice(func_get_args(), 1);
    $keys = self::array_flatten($keys);
    $pick = array();
    foreach ( $keys as $key ) {
      if (!array_key_exists($key, $array)) {
        continue;
      }
      $pick[$key] = $array[$key];
    }
    return $pick;
  }
521949
public static function get($array, $key, $default = null)
    {
        if (!is_array($array) and !$array instanceof ArrayAccess) {
            throw new InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
        }
        if (is_null($key)) {
            return $array;
        }
        if (is_array($key)) {
            $return = [];
            foreach ($key as $k) {
                $return[$k] = static::get($array, $k, $default);
            }
            return $return;
        }

        is_object($key) and $key = (string) $key;

        if (array_key_exists($key, $array)) {
            return $array[$key];
        }
        foreach (explode('.', $key) as $keyPart) {
            if (($array instanceof ArrayAccess and isset($array[$keyPart])) === false) {
                if (!is_array($array) or !array_key_exists($keyPart, $array)) {
                    return ($default instanceof Closure) ? $default() : $default;
                }
            }
            $array = $array[$keyPart];
        }
        return $array;
    }
406952
public static function createFromAttributeArray(array $array)
	{
		$input = array_change_key_case($array, CASE_LOWER);

		$response = new Response();

		foreach (Response::$attributeMapping as $attribute => $localVariable) {
			$loweredAttribute = strtolower($attribute);

			if (array_key_exists($loweredAttribute, $input)) {
				$response->{$localVariable} = $input[$loweredAttribute];
			}
		}

		return $response;
	}
389028
public static function createFromArray(array $array)
    {
        $sortBy = self::create();
        $sortBy->sortsBy = array_map(function (array $element) {
            if (
                self::RANDOM !== $element &&
                self::SCORE !== $element
            ) {
                $element['type'] = $element['type'] ?? SortBy::TYPE_FIELD;
            }

            if (isset($element['filter'])) {
                $element['filter'] = Filter::createFromArray($element['filter']);
            }

            if (
                isset($element['coordinate']) &&
                is_array($element['coordinate'])
            ) {
                $element['coordinate'] = Coordinate::createFromArray($element['coordinate']);
            }

            return $element;
        }, $array);

        return $sortBy;
    }