update de l'application pour le dev de la documentation

This commit is contained in:
Emmanuel ROY 2020-12-18 17:44:09 +01:00
commit 6efdffc05c
31 changed files with 329 additions and 253 deletions

View file

@ -2,20 +2,21 @@
namespace MVC\Classe;
class Modele{
public $page;
public function __construct($base_param){
if(file_exists(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model')){
$fichier = file(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model');
foreach ($fichier as $ligne_num => $ligne) {
class Modele
{
public $page;
public function __construct($base_param)
{
if (file_exists(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model')) {
$fichier = file(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model');
foreach ($fichier as $ligne_num => $ligne) {
//on recherche le pattern des parametres
if (preg_match("#[ ]*([a-zA-Z_+]*)[ ]*[:][ ]*([a-zA-Z0-9-_+'\{\,\ \}\(\)]*[ ]*)#", $ligne, $matches)) {
if (preg_match("#[ ]*([a-zA-Z_+]*)[ ]*[:][ ]*([a-zA-Z0-9ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ_+\-'\{\,\ \}\(\)]*[ ]*)#", $ligne, $matches)) {
//on recherche le pattern des tableau dans la valeur du paramètre
// dans le cas ou la déclaration se fait sur une seule ligne
if (preg_match("#{.*}#", $matches[2])) {
if (preg_match_all("#(?<capture>[0-9a-zA-Z-_+]*)#", $matches[2], $arrayMatches)) {
if (preg_match_all("#(?<capture>[0-9a-zA-ZÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ_+\-]*)#", $matches[2], $arrayMatches)) {
$array = array();
foreach ($arrayMatches['capture'] as $val) {
if ($val != '') {
@ -28,14 +29,12 @@ class Modele{
}
$this->page[$matches[1]] = $matches[2];
}
}
$this->page['url_params'] = $base_param['params'];
}else{
$this->page['name'] = $base_param['name'];
$this->page['description'] = $base_param['description'];
$this->page['params'] = $base_param['params'];
}
}
} else {
$this->page['name'] = $base_param['name'];
$this->page['description'] = $base_param['description'];
$this->page['params'] = $base_param['params'];
}
}
}