Passed
Push — master ( 200816...5d47f4 )
by Anthony
02:59
created

AdminInscription::getAccesAdministration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
	namespace core\admin\inscription;
3
	use core\App;
4
	use core\auth\Encrypt;
5
	use core\auth\Inscription;
6
7
	class AdminInscription extends Inscription {
8
		protected $acces_administration;
9
		protected $id_liste_droit_acces;
10
		
11
		
12
		//-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------//
13
		//-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------//
14
		
15
		
16
		//-------------------------- GETTER ----------------------------------------------------------------------------//
17
		public function getAccesAdministration() {
18
			return $this->acces_administration;
19
		}
20
		public function getidListeDroitAcces() {
21
			return $this->id_liste_droit_acces;
22
		}
23
		//-------------------------- FIN GETTER ----------------------------------------------------------------------------//
24
		
25
26
		//-------------------------- SETTER ----------------------------------------------------------------------------//
27
		/**
28
		 * vient de la partie admin n du site pages gestion-comptes/creer-utilisateur
29
		 * @param $value
30
		 * @param null $required
0 ignored issues
show
Bug introduced by
There is no parameter named $required. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
31
		 * @return bool
32
		 */
33 View Code Duplication
		protected function setVerifAccesAdministration($value) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
34
			//on verifie que la valeur est bien un int
35
			//test avec le required, si le champe est vide et que le required est != null on return fa	lse sinon on va tester
36
			if ($this->getTestInt($value) === true) {
37
				$this->acces_administration = $value;
38
				return true;
39
			}
40
			else if ($this->getTestInt($value) === false) {
41
				$this->erreur .= "<li>Le champs accès administration n'est pas au bon format</li>";
42
				return false;
43
			}
44
			else {
45
				return true;
46
			}
47
48
		}
49
50
		/**
51
		 * vient de la partie admin du site pages gestion-comptes/creer-utilisateur
52
		 * @param $value
53
		 * @param null $required
0 ignored issues
show
Bug introduced by
There is no parameter named $required. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
54
		 * @return bool
55
		 */
56 View Code Duplication
		protected function setVerifListeDroitAcces($value) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
57
			//on verifie que la valeur est bien un int
58
			//test avec le required, si le champe est vide et que le required est != null on return fa	lse sinon on va tester
59
			if ($this->getTestInt($value) === true) {
60
				$this->id_liste_droit_acces = $value;
61
				return true;
62
			}
63
			else if ($this->getTestInt($value) === false) {
64
				$this->erreur .= "<li>Le champs accès administration n'est pas au bon format</li>";
65
				return false;
66
			}
67
			else {
68
				return true;
69
			}
70
71
		}
72
73
		/**
74
		 * si tous les test concernant le formulaire sont passés on inscrit le user
75
		 */
76
		public function setInscrireUtilisateur() {
77
			$dbc = App::getDb();
78
79
			$value = array(
80
				"pseudo" => $this->pseudo,
81
				"nom" => $this->nom,
82
				"prenom" => $this->prenom,
83
				"mail" => $this->mail,
84
				"mdp" => Encrypt::setEncryptMdp($this->mdp),
85
				"mdp_params" => Encrypt::getParams(),
86
				"last_change_mdp" => date("Y-m-d"),
87
				"img_profil" => "profil/defaut.png",
88
				"img_profil_blog" => "profil/defaut_blog.png",
89
				"valide" => 1,
90
				"acces_admin" => $this->acces_administration,
91
				"liste_droit" => $this->id_liste_droit_acces
92
			);
93
94
95
			$dbc->prepare("INSERT INTO identite (pseudo, nom, prenom, mail, mdp, mdp_params, last_change_mdp, img_profil, img_profil_blog, valide, acces_admin, liste_droit) VALUES (:pseudo, :nom, :prenom, :mail, :mdp, :mdp_params, :last_change_mdp, :img_profil, :img_profil_blog, :valide, :acces_admin, :liste_droit)", $value);
96
		}
97
		//-------------------------- FIN SETTER ----------------------------------------------------------------------------//
98
	}