@param array|string $data
@param string       $key

@return array
15734
private function fixArray($data, $key = null)
    {
        if (!is_array($data) || ($key && isset($data[$key]))) {
            $data = [$data];
        }

        return $data;
    }
781604
protected function cacheData(string $key, string $data) : string
    {
        $this->cache[$key] = $data;

        return $data;
    }
440018
public static function array_delete(array &$data, $key){
		if(array_key_exists($key, $data)){
			$value = $data[$key];
			unset($data[$key]);
			return $value;
		}
	}
908659
protected function getIfSet($key, stdClass $data = null)
    {
        if (empty($data)) {
            $data = $this->data;
        }

        if (isset($data->$key)) {
            return $data->$key;
        }
    }
497633
private function extractField($key, array $data)
    {
        if (!isset($data[$key])) {
            throw PersisterException::badRequest(sprintf('Unable to extract a field value. The "%s" key was not found.', $key));
        }
        return $data[$key];
    }
1198427
public function toExt($data, $key = null, $array = false)
	{
		return $this->to(self::EXT, $data, $key, $array);
	}
164039
public function getArray($key)
	{
		$this->validateKey($key);
		return $this->has($key) ? $this->params[$key] : [];
	}
1026508
public static function moveKeyToEnd(array $data, $key)
    {
        if (array_key_exists($key, $data)) {
            $data += array_splice($data, array_search($key, array_keys($data)), 1);
        }

        return $data;
    }
1188336
protected function parseData(string $key) : array
    {
        if (file_exists($this->getPath($key))) {
            $rawData = json_decode(file_get_contents($this->getPath($key)), true);
            $parsedData = ['d' => unserialize($rawData['d']), 't' => $rawData['t']];
        } else {
            $parsedData = ['d' => null, 't' => 0];
        }

        if (time() > $parsedData['t']) {
            $this->delete($key);

            return ['d' => null, 't' => 0];
        }

        return $parsedData;
    }
972765
protected function checkKeyExists($data, $key)
    {
        if (!$data->has($key)) {
            $this->output->writeln("<error>The key $key does not exist.");

            return false;
        }

        return true;
    }
773360
protected function getLexemes(string $key, array $data)
    {
        $syntax = $this->tryLoad($key);

        if (empty($this->data[$key]))
        {
            $syntax = $this->syntax($key, $data);
            $this->syntax2Array($key, $syntax);
        }

        return $syntax;
    }
953147
public function getData( $key = NULL ){
		if( is_null( $key ) )
			return $this->data ;
		if( !array_key_exists( $key, $this->data ) )
			return NULL;
		return $this->data[$key];
	}
636254
private function checkIfSet($key, array $data)
    {
        $keyExists = array_key_exists($key, $data);

        return $keyExists && $data[$key] !== null && $data[$key] !== '';
    }
1041503
private function _getSecondaryKeys($data, $key = null)
    {
        if ($key) {
            $data = ArrayHelper::getValue($data, $key, []);
        }

        return ArrayHelper::getColumn($data, $this->relSecondaryKey);
    }
966702
private function parseKey($data, $key)
    {
        if (isset($data[$key])) {
            $value = (int) $data[$key];
            $this->scoreTiers []= new ScoreTier($key, $value);
            return $value;
        }

        throw new InvalidDataException();
    }
399120
private function httpBuildMultiQuery(array $data, $key = null)
    {
            $query = array();

            if (empty($data)) {
                return $key . '=';
            }
            $isArrayAssoc = $this->isArrayAssoc($data);
            // build
            foreach ($data as $k => $value) {
                if (is_string($value) || is_numeric($value)) {
                    $brackets = $isArrayAssoc ? '[' . $k . ']' : '[]';
                    $query[] = urlencode(is_null($key) ? $k : $key . $brackets) . '=' . rawurlencode($value);
                } elseif (is_array($value)) {
                    $nested = is_null($key) ? $k : $key . '[' . $k . ']';
                    $query[] = $this->httpBuildMultiQuery($value, $nested);
                }
            }

            return implode('&', $query);
        }
355381
public static function last(array $data, ?string $key = null)
    {
        if (count($data) === 0) {
            return null;
        }
        $element = end($data);
        if ($key !== null && is_array($element) && isset($element[$key])) {
            return $element[$key];
        }
        return $element;
    }