Check is value exists in the array

@param string $value
@param mixed  $array
@param bool   $returnKey
@return mixed

@SuppressWarnings(PHPMD.ShortMethodName)
161199
public static function in($value, array $array, $returnKey = false)
    {
        $inArray = in_array($value, $array, true);

        if ($returnKey) {
            if ($inArray) {
                return array_search($value, $array, true);
            }

            return null;
        }

        return $inArray;
    }
1079573
public function runGen($returnArray = true)
	{
		$sql = $this->sqlGen();
		/** @var \mysqli_stmt $stmt */
		$stmt = $this->prepare($sql);
		if ($stmt===null) {
			return false;
		}
		$parType = implode('', $this->whereParamType);
		$values = array_values($this->whereParamValue);
		if ($parType) {
			$reval = $stmt->bind_param($parType, ...$values);
			if (!$reval) {
				$this->throwError("Error in bind","","type: ".json_encode($parType)." values:".json_encode($values));
				return false;
			}
		}
		$this->runQuery($stmt);
		$rows = $stmt->get_result();
		if ($this->genSqlFields) {
			$this->lastSqlFields=$this->obtainSqlFields($rows);
		}
		$stmt->close();
		$this->builderReset();
		if ($returnArray) {
			$r = $rows->fetch_all(MYSQLI_ASSOC);
			$rows->free_result();
			return $r;
		} else {
			return $rows;
		}
	}
736608
public static function set($array, $key, $value = null, $useDotSyntax = false)
    {
        // Normalize array
        $array = $array ?: [];

        // Check if key is empty
        if (StringHelper::emptyString($key, true)) {
            throw new InvalidArgumentException(__METHOD__ . ': Key cannot be empty');
        }

        /**
         * Split name using dots.
         *
         * Just checking whether the key doesn't have any dots
         * but $useDotSyntax is true by default.
         */
        $keyParts = explode('.', $key);
        $useDotSyntax = $useDotSyntax && count($keyParts) > 1;

        // Set simple value, without dot syntax
        if (!$useDotSyntax) {
            if (is_null($value) && isset($array[$key])) {
                unset($array[$key]);
            } elseif (!is_null($value)) {
                $array[$key] = $value;
            }
        } else {
            // Recursive call
            $base = $keyParts[0];
            unset($keyParts[0]);

            // Check if the base array exists
            if (!isset($array[$base])) {
                $array[$base] = [];
            }

            // Get key, base array and continue
            $key = implode('.', $keyParts);
            $innerArray = $array[$base];

            $array[$base] = static::set($innerArray, $key, $value, $useDotSyntax);
        }

        return $array;
    }
252279
public static function exists($key, $array)
    {
        if (!is_array($array)) {
            return false;
        }
        if ($key == '') {
            return is_array($array) && array_key_exists((string)$key, $array);
        }
        return self::parseAndValidateKeys($key, $array)['isExists'];
    }
667587
public static function has(array $array, $keyPath)
    {
        self::checkKeyPathIsValidAndNonEmpty($keyPath);
        $keys = self::explodeKeys(strval($keyPath));

        while ($keys !== array()) {
            $key = array_shift($keys);

            if (!array_key_exists($key, $array)) {
                return false;
            }
            $array = $array[$key];
            if (!is_array($array)) {
                break;
            }
        }

        return $keys === array();
    }
314583
public static function popValue($key, array &$array, $defaultValue = null)
    {
        $value = self::getValue($key, $array, $defaultValue);
        unset($array[$key]);
        return $value;
    }
1310999
protected function addEmpty(array &$array, $key, $value, $default = '')
    {
        if (!empty($value)) {
            $array[$key] = $value;
            return true;
        } else {
            $array[$key] = $default;
            return false;
        }
    }
948870
public static function set(array &$array, string $key, $value)
    {
        foreach (\explode('.', $key) as $k) {
            if (!isset($array[$k]) || !\is_array($array[$k])) {
                $array[$k] = [];
            }
            $array = &$array[$k];
        }

        $array = $value;
    }
15261
private boolean arrayKeyValueExists(String key, String value) {
    if (visitedPost.containsKey(key)) {
      for(String s : visitedPost.get(key)) {
        if(s.equals(value)) {
          return true;
        }
      }
    }

    return false;

  }
644029
public static function add(array $array, $key, $value): array
    {
        $target = static::get($array, $key, []);

        if (! is_array($target)) {
            $target = [$target];
        }

        $target[] = $value;
        $array = static::set($array, $key, $target);

        return $array;
    }
292395
public static function array_keys_exists(array $keys,array $array )
    {
        //键不是数组直接返回false
        if (!is_array($keys)) {
            return false;
        }
        foreach ($keys as $k) {
            if (!isset($array[$k])) {
                return false;
            }
        }
        return true;
    }
119724
public static function sGet($array, $key, $default = null)
    {
        $value = self::get($array, $key);
        return !empty($value) ? $value : $default;
    }
1295212
public function getArrayValue(array $array, string $key)
    {
        foreach ($this->getBoth($key) as $loopKey) {
            if (array_key_exists($loopKey, $array)) {
                return $array[$loopKey];
            }
        }
    }
1280760
public static function key_exists($array, $key)
    {
        if (!is_array($array) and !$array instanceof ArrayAccess) {
            throw new InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
        }

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

        if (!is_string($key)) {
            return false;
        }
        if (array_key_exists($key, $array)) {
            return true;
        }
        foreach (explode('.', $key) as $key_part) {
            if (($array instanceof ArrayAccess and isset($array[$key_part])) === false) {
                if (!is_array($array) or ! array_key_exists($key_part, $array)) {
                    return false;
                }
            }
            $array = $array[$key_part];
        }
        return true;
    }
1302295
public static function get(array $array, $key, $fallback = null)
    {
        $keys = explode('.', $key);
        foreach($keys as $key) {
            if(!isset($array[$key])) {
                return $fallback;
            }
            $array = $array[$key];
        }

        return $array;
    }
467646
protected function traverse($key, $returnValue = true)
    {
        $value = $this->values;
        foreach (explode('.', $key) as $part) {
            if (!array_key_exists($part, $value)) {
                return false;
            }
            $value = $value[$part];
        }
        return $returnValue ? $value : true;
    }
531014
protected function setPropertyValue($returnClass, $key, $value)
  {
    $setter = $this->getSetter($key);
    if ($value !== null && method_exists($returnClass, $setter))
    {
      $returnClass->{$setter}($value);

      return true;
    }
    elseif (!$returnClass instanceof \stdClass || $returnClass instanceof \DateTime)
    {
      if (property_exists($returnClass, $key))
      {
        $property = $this->getPublicProperty($returnClass, $key);
        $property->setValue($returnClass, $value);

        return true;
      }
    }
    $returnClass->$key = $value;

    return true;
  }