psr
This commit is contained in:
parent
a74feab37e
commit
64cbb94829
|
@ -3,7 +3,7 @@
|
||||||
/**
|
/**
|
||||||
* @return PDO Une instance PDO
|
* @return PDO Une instance PDO
|
||||||
*/
|
*/
|
||||||
function getDatabaseConnection()
|
function getDatabaseConnection()
|
||||||
{
|
{
|
||||||
static $pdo;
|
static $pdo;
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,9 @@ function getCommentsByProject($id)
|
||||||
* @param string $website Site web de l'auteur
|
* @param string $website Site web de l'auteur
|
||||||
* @param string $content Contenu du commentaire
|
* @param string $content Contenu du commentaire
|
||||||
* @param DateTime $date Date du commentaire
|
* @param DateTime $date Date du commentaire
|
||||||
* @param int $projectId L'id du projet associé
|
* @param int $projectId L'id du projet associé
|
||||||
*/
|
*/
|
||||||
function createComment($name, $email, $website, $content, DateTime $date, $projectId)
|
function createComment($name, $email, $website, $content, DateTime $date, $projectId)
|
||||||
{
|
{
|
||||||
$pdo = getDatabaseConnection();
|
$pdo = getDatabaseConnection();
|
||||||
|
|
||||||
|
@ -122,12 +122,12 @@ function createComment($name, $email, $website, $content, DateTime $date, $proje
|
||||||
* @param int $numberOfPages Le nombre de pages
|
* @param int $numberOfPages Le nombre de pages
|
||||||
* @return array Les pages
|
* @return array Les pages
|
||||||
*/
|
*/
|
||||||
function getProjectsPager($page, $numberOfPages)
|
function getProjectsPager($page, $numberOfPages)
|
||||||
{
|
{
|
||||||
if (!is_integer($page)) {
|
if (!is_integer($page)) {
|
||||||
throw new InvalidArgumentException('The argument "page" must be an integer.');
|
throw new InvalidArgumentException('The argument "page" must be an integer.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_integer($numberOfPages)) {
|
if (!is_integer($numberOfPages)) {
|
||||||
throw new InvalidArgumentException('The argument "numberOfPages" must be an integer.');
|
throw new InvalidArgumentException('The argument "numberOfPages" must be an integer.');
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ function getProjectsPager($page, $numberOfPages)
|
||||||
'current' => $page === 1,
|
'current' => $page === 1,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($page > 1) {
|
if ($page > 1) {
|
||||||
$pages[] = array(
|
$pages[] = array(
|
||||||
'title' => 'Précédent',
|
'title' => 'Précédent',
|
||||||
|
@ -159,7 +159,7 @@ function getProjectsPager($page, $numberOfPages)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($page < $numberOfPages) {
|
if ($page < $numberOfPages) {
|
||||||
$pages[] = array(
|
$pages[] = array(
|
||||||
'title' => 'Suivant',
|
'title' => 'Suivant',
|
||||||
|
@ -178,7 +178,3 @@ function getProjectsPager($page, $numberOfPages)
|
||||||
|
|
||||||
return $pages;
|
return $pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue