M1\Vars\Resource\AbstractResource::internalGet PHP Method

internalGet() private method

The internal get function for getting values by their key
private internalGet ( array $array, mixed $key, boolean $exists = false ) : array | boolean | null
$array array The array to use -- will always be $this->content
$key mixed The key to find the value for
$exists boolean Whether to return null or false dependant on the calling function
return array | boolean | null The resource key value
    private function internalGet(array $array, $key, $exists = false)
    {
        if (isset($array[$key])) {
            return !$exists ? $array[$key] : true;
        }
        $parts = explode('.', $key);
        foreach ($parts as $part) {
            if (!is_array($array) || !isset($array[$part])) {
                return !$exists ? null : false;
            }
            $array = $array[$part];
        }
        return !$exists ? $array : true;
    }