Passed
Push — master ( e0b597...f1cdd9 )
by Anthony
02:43
created

Contenus   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 10
lcom 0
cbo 3
dl 0
loc 66
rs 10
c 1
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 19 3
A getIdPage() 0 3 1
A getTitre() 0 3 1
A getContenu() 0 3 1
A getUrl() 0 3 1
A getMetaDescription() 0 3 1
A getBaliseTitle() 0 3 1
A getParent() 0 3 1
1
<?php
2
	namespace core\contenus;
3
4
	use core\App;
5
	use core\RedirectError;
6
7
8
	class Contenus {
9
		//pour la table page
10
		protected $id_page;
11
		protected $titre;
12
		protected $contenu;
13
		protected $url;
14
		protected $meta_description;
15
		protected $balise_title;
16
		protected $parent;
17
18
19
20
		//-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------//
21
		public function __construct($url) {
22
			$dbc = \core\App::getDb();
23
			
24
			$query = $dbc->select()->from("page")->where("url", "=", $url)->get();
25
			
26
			if (RedirectError::testRedirect404($query, $url) === true) {
27
				foreach ($query as $obj) {
28
					App::setValues(["contenus" => [
29
						"id_page" => $this->id_page = $obj->ID_page,
30
						"meta_description" => $this->meta_description = $obj->meta_description,
31
						"balise_title" => $this->balise_title = $obj->balise_title,
32
						"url" => $this->url = $obj->url,
33
						"titre" => $this->titre = $obj->titre,
34
						"contenu" => $this->contenu = $obj->contenu,
35
						"parent" => $this->parent = $obj->parent,
36
					]]);
37
				}
38
			}
39
		}
40
		//-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------//
41
42
43
44
		//-------------------------- GETTER ----------------------------------------------------------------------------//
45
		//pour la table page
46
		public function getIdPage() {
47
			return $this->id_page;
48
		}
49
		public function getTitre() {
50
			return $this->titre;
51
		}
52
		public function getContenu() {
53
			return $this->contenu;
54
		}
55
		public function getUrl() {
56
			return $this->url;
57
		}
58
		public function getMetaDescription() {
59
			return $this->meta_description;
60
		}
61
		public function getBaliseTitle() {
62
			return $this->balise_title;
63
		}
64
		public function getParent() {
65
			return $this->parent;
66
		}
67
		//-------------------------- FIN GETTER ----------------------------------------------------------------------------//
68
69
70
71
		//-------------------------- SETTER ----------------------------------------------------------------------------//
72
		//-------------------------- FIN SETTER ----------------------------------------------------------------------------//
73
	}