public static function getValueAtIndex($array, $index)
    {
        $value = null;

        if (abs((int) $index) == self::LAST_INDEX) {
            $index == self::LAST_INDEX ? end($array) : reset($array);
            $value = current($array);
        } elseif (isset($array[$index])) {
            $value = $array[$index];
        }

        return $value;
    }