$stmt->bind_result($hash, $name, $target);
        if ($stmt->fetch()) {
            $arr = array('url' => $target, 'hex' => $hash, 'str' => $name);
        }
        $stmt->close();
        return $arr;
    }
    /**
      This is the entry point method of ShortLink.
      It is called at the bottom of this file,
      but will exit asap if ShortLink required POST parameters are missing.
    */
    public static function handlePost()
    {
        if (!array_key_exists('createShortLink', $_POST)) {
            return;
        }
        //Creating ShortLink:
        $arr = self::insert($_POST['createShortLink']);
        //Making sure $arr is an array:
        if ($arr instanceof Exception) {
            $arr = array('error' => $arr->getMessage());
        }
        //Producing output:
        Config::setResponseJSON();
        echo Config::toJSON($arr);
    }
}
//Calling handlePost:
ShortLink::handlePost();