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

Interview/Lucas-Vialatoux #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions DefaultController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Services\Entree;

class DefaultController extends Controller
{
/**
* @Route("/", name="homepage")
*/
public function indexAction(Entree $data)
{
// replace this example code with whatever you need
$resultat = $data->getTable($this->getParameter('inputData'));
return $this->render('AppBundle:Default:index.html.twig',array('result'=>$resultat));
}
}
1 change: 1 addition & 0 deletions Début
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Début du développement
37 changes: 37 additions & 0 deletions Entree.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace AppBundle\Services;

class Entree{

//Méthode pour récupérer la table : inputData
public function getTable($entree = null){
$table = null;
if ($entree==null){ //test si aucune entrée
return null;
}
else{
$table = $entree;

for ($i=0;$i<sizeof($table);$i++){
if (isset($table[$i][0])==null){ //test si la colonne 0 est vide
$table[$i][0] = 0;
}
if (isset($table[$i][1])==null){ //test si la colonne 1 est vide
$table[$i][1] = 0;
}
}

for ($i=0;$i<sizeof($table);$i++){
$table[$i][2] = $table[$i][0] + $table[$i][1]; //remplir la colonne Item1 + item2
if (($table[$i][2] % 2) == 0){ //calcul si c'est paire
$table[$i][3] = "Paire";
}
else{ //sinon c'est impair
$table[$i][3] = "Impaire";
}
}
return $table; //on retourne la table
}
}
}
Loading