Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module5 task1 #13

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Glorferiel39
Copy link
Contributor

No description provided.

* @param array $config Настройки подключения
* @return mysqli|bool Возваращемый тип данных
*/
function dbConnect(array $config):mysqli|bool

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Передать в нее $config['db']
и тогда внутри можно будет использовать ключи
$config['host'], $config['user'], ...

functions/db.php Outdated
echo "Подключения к базе данных установлено";
}

mysqli_set_charset($con, "utf8");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 пробела отступ

functions/db.php Outdated
}

mysqli_set_charset($con, "utf8");
return $con;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

аналогично

functions/db.php Outdated
return $con;
}
// Запрос на получение новых лотов
function getNewLotsFromDb(mysqli $con)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpdoc и прописать тип возвращаемого значения в сигнатуре


if (!$result) {
$error = mysqli_error($con);
print("SQL Error: $error");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exit();

functions/db.php Outdated
}

// Запрос на получения всех категорий
function getAllCategoriesFromDb(mysqli $con)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpdoc и типа возвращаемого

@@ -0,0 +1,39 @@
<?php
/**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

перенести описание к той функции, для которой оно написано



/**
*Форматирует время лота

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пробелы после *

function is_date_valid(string $date) : bool {
$format_to_check = 'Y-m-d';
$dateTimeObj = date_create_from_format($format_to_check, $date);
function isDateValid(string $date) : bool

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

создать файл
./funtions/validators.php
перенести туда функцию и подключить его через require

@@ -29,7 +30,8 @@ function is_date_valid(string $date) : bool {
*
* @return mysqli_stmt Подготовленное выражение
*/
function db_get_prepare_stmt($link, $sql, $data = []) {
function dbGetPrepareStmt(mysqli $link, $sql, $data = []):mysqli_stmt

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пробел после :

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

перенести в fuctions/db.php

@@ -96,7 +98,7 @@ function db_get_prepare_stmt($link, $sql, $data = []) {
*
* @return string Рассчитанная форма множественнго числа
*/
function get_noun_plural_form (int $number, string $one, string $two, string $many): string
function getNounPluralForm (int $number, string $one, string $two, string $many): string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

перенести в functions/template.php

@@ -126,7 +128,8 @@ function get_noun_plural_form (int $number, string $one, string $two, string $ma
* @param array $data Ассоциативный массив с данными для шаблона
* @return string Итоговый HTML
*/
function include_template($name, array $data = []) {
function includeTemplate($name, array $data = [])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

перенести в functions/template.php

* @param int|float $price
* @return string
*/
function formatAmount(int|float $price): string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

перенести в functions/template.php

*@param string $data
*@return array
*/
function remainingTime(string $date): array

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можно тоже в перенести в functions/template.php

Copy link

@sergeivl sergeivl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants