Added phpDoc comments

This commit is contained in:
Tobias Reich 2016-02-13 23:35:13 +01:00
parent fcb80c9f32
commit 3c45bbf4d1
2 changed files with 42 additions and 2 deletions

View File

@ -4,6 +4,13 @@ namespace Lychee\Modules;
final class Config {
/**
* Creates the configuration file.
* @return true|string Returns true when successful.
* Warning: Connection failed!
* Warning: Creation failed!
* Warning: Could not create file!
*/
public static function create($host, $user, $password, $name = 'lychee', $prefix = '') {
// Open a new connection to the MySQL server
@ -25,8 +32,6 @@ final class Config {
// Save config.php
$config = "<?php
if(!defined('LYCHEE')) Response::error('Direct access is not allowed!');
// Database configuration
\$dbHost = '$host'; // Host of the database
\$dbUser = '$user'; // Username of the database

View File

@ -16,6 +16,9 @@ final class Database {
'030003' // 3.0.3
);
/**
* @return object Returns a new or cached connection.
*/
public static function get() {
if (!self::$instance) {
@ -36,6 +39,10 @@ final class Database {
}
/**
* Exits on error.
* @return boolean Returns true when successful.
*/
private function __construct($host, $user, $password, $name = 'lychee', $dbTablePrefix) {
// Check dependencies
@ -63,8 +70,13 @@ final class Database {
$this->connection = $connection;
return true;
}
/**
* @return object|false Returns the connection when successful.
*/
public static function connect($host = 'localhost', $user, $password) {
// Open a new connection to the MySQL server
@ -77,6 +89,9 @@ final class Database {
}
/**
* @return boolean Returns true when successful.
*/
private static function setCharset($connection) {
// Check dependencies
@ -95,6 +110,9 @@ final class Database {
}
/**
* @return boolean Returns true when successful.
*/
public static function createDatabase($connection, $name = 'lychee') {
// Check dependencies
@ -113,6 +131,9 @@ final class Database {
}
/**
* @return boolean Returns true when successful.
*/
private static function createTables($connection) {
// Check dependencies
@ -238,6 +259,10 @@ final class Database {
}
/**
* Exits when an update fails.
* @return boolean Returns true when successful.
*/
private static function update($connection, $dbName) {
// Check dependencies
@ -267,6 +292,9 @@ final class Database {
}
/**
* @return boolean Returns true when successful.
*/
public static function setVersion($connection, $version) {
// Check dependencies
@ -276,9 +304,13 @@ final class Database {
$result = self::execute($connection, $query, __METHOD__, __LINE__);
if ($result===false) return false;
return true;
}
/**
* @return string Returns a escaped query.
*/
public static function prepare($connection, $query, array $data) {
// Check dependencies
@ -345,6 +377,9 @@ final class Database {
}
/**
* @return object|false Returns the results on success.
*/
public static function execute($connection, $query, $function, $line) {
// Check dependencies