Skip to content

Commit

Permalink
PSR2 formating
Browse files Browse the repository at this point in the history
  • Loading branch information
faustfizz committed Sep 11, 2023
1 parent 98c6794 commit a5fde46
Show file tree
Hide file tree
Showing 56 changed files with 1,897 additions and 2,222 deletions.
6 changes: 3 additions & 3 deletions app/Config/Autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Autoload
* ]
*
* @var array
*/
*/
public static $classmap = [];

/**
Expand All @@ -35,7 +35,7 @@ class Autoload
* ]
*
* @var array
*/
public static $psr4 = [ ];
*/
public static $psr4 = [];

}
32 changes: 16 additions & 16 deletions app/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ class Config
* @var array
*/
public $locale = [
"lang" => "fr",
"timezone" => 'Africa/Nairobi'
"lang" => "fr",
"timezone" => 'Africa/Nairobi'
];

/**
* @var array
*/
public $page_error = [
"300s" => BASE_PATH."error/300.html",
"4s" => BASE_PATH."error/400.html",
"404s" => BASE_PATH."error/404.html",
"5s" => BASE_PATH."error/500.html",
"500s" => BASE_PATH."error/500.html",
"300s" => BASE_PATH . "error/300.html",
"4s" => BASE_PATH . "error/400.html",
"404s" => BASE_PATH . "error/404.html",
"5s" => BASE_PATH . "error/500.html",
"500s" => BASE_PATH . "error/500.html",
];

/**
Expand All @@ -44,11 +44,11 @@ class Config
/**
* Dissier uploads pour les fichiers téléversés [relative to public dir]
*/
"store_dir" => BASE_PATH."uploads/",
"store_dir" => BASE_PATH . "uploads/",
/**
* Dissier assets pour les fichiers statics css, js, img [relative to public dir]
*/
"assets_dir" => BASE_PATH."assets/",
"assets_dir" => BASE_PATH . "assets/",
/**
* Extension des vues
*/
Expand All @@ -71,28 +71,28 @@ class Config
/**
* Serveur de base de données
*/
"db_host" => "localhost",
"db_host" => "localhost",
/**
* Utilisateur de la base de données
*/
"db_user" => "root",
"db_user" => "root",
/**
* Mot de passe de la base de données
*/
"db_pass" => "123456",
"db_pass" => "123456",
/**
* Nom de la base de données
*/
"db_name" => "test",
"db_name" => "test",
/**
* Port du serveur de la base de données
*/
"db_port" => "3306",
"db_port" => "3306",
/**
* Nom de la base de données
* 'mysql', 'pgsql', 'sqlite'
*/
"db_type" => "mysql"
"db_type" => "mysql"
];

public function __construct(?array $config = null, ?array $page_error = null, ?array $locale = null)
Expand All @@ -102,4 +102,4 @@ public function __construct(?array $config = null, ?array $page_error = null, ?a
$this->locale = !empty($locale) ? array_merge($this->locale, $locale) : $this->locale;
}

}
}
4 changes: 2 additions & 2 deletions app/Config/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ class Email
*/
public function __construct($config = [])
{
array_walk($config, function($value, $key, $class){
array_walk($config, function ($value, $key, $class) {
$class->{$key} = $value;
}, $this);
}

}
}
23 changes: 11 additions & 12 deletions app/Config/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
class Form
{
public static $config = [
'open' => true,
'close' => true,
'from_db' => true
'open' => true,
'close' => true,
'from_db' => true
];

public static function submitBtn()
Expand All @@ -26,16 +26,16 @@ public static function getHtmlInput(object $field, string $validityClass = '')
return "<div class='form-group mb-3'>
<div class='form-floating'>
<select class='form-select $validityClass' name='{$field->name}' $field->inline_attributes>
".implode('\n', $field->htmlOptions)."
" . implode('\n', $field->htmlOptions) . "
</select>
<label for='{$field->id}'>".($field->label ?? ucfirst($field->name))."</label>
<label for='{$field->id}'>" . ($field->label ?? ucfirst($field->name)) . "</label>
</div>
</div>";
case 'checkbox':
case 'radio':
return "<div class='mb-3'>
<input type='radio' class='btn-check $validityClass' name='{$field->name}' autocomplete='off' $field->inline_attributes>
<label class='btn btn-outline-success' for='{$field->id}'>".($field->label ?? ucfirst($field->name))."</label>
<label class='btn btn-outline-success' for='{$field->id}'>" . ($field->label ?? ucfirst($field->name)) . "</label>
</div>";
case 'file':
return "<div class='mb-3'>
Expand All @@ -48,7 +48,7 @@ public static function getHtmlInput(object $field, string $validityClass = '')
return "<div class='form-group mb-3'>
<div class='form-floating'>
<textarea class='form-control $validityClass' name='{$field->name}' style='height: 100px' $field->inline_attributes>$field->value</textarea>
<label for='{$field->id}'>".($field->label ?? ucfirst($field->name))."</label>
<label for='{$field->id}'>" . ($field->label ?? ucfirst($field->name)) . "</label>
</div>
</div>";
case 'text':
Expand All @@ -62,16 +62,15 @@ public static function getHtmlInput(object $field, string $validityClass = '')
case 'datetime-local':
case 'number':
case 'month':
default:
return "<div class='form-group mb-3'>
default:
return "<div class='form-group mb-3'>
<div class='form-floating'>
<input type='{$field->type}' class='form-control $validityClass' name='{$field->name}' $field->inline_attributes>
<label for='{$field->id}'>".($field->label ?? ucfirst($field->name))."</label>
<label for='{$field->id}'>" . ($field->label ?? ucfirst($field->name)) . "</label>
</div>
</div>";
}
}


}

}
12 changes: 6 additions & 6 deletions app/Config/Fuel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@
*
* I did it also for ease to me to declare all contants related to path
*/
class Fuel{
class Fuel
{
/**
* The app directory
*
* @var string
*/
const appDir = __DIR__."/../";
const appDir = __DIR__ . "/../";

/**
* The directory of the core files
*
* @var string
*/
const sysDir = __DIR__."/../../core/";
const sysDir = __DIR__ . "/../../core/";

/**
* Yo ! Where you hold your view files
*
* @var string
*/
const viewDir = __DIR__."/../View/";
}

const viewDir = __DIR__ . "/../View/";
}
21 changes: 9 additions & 12 deletions app/Config/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,31 @@ class Paginator
public $perPage = 20;

/**
* Default value for query string key to specify the current page.
*
* https://example.com?page=1
* Default value for query string key to specify the current page.
*
* https://example.com?page=1
*
* @var string
*/
public $pageName = "page";

/**
* items on each side
* items on each side
*
* @var integer
*/
public $onEachSide = 1;

public function __construct(array $config = [])
{
if(!empty($config))
{
foreach($config as $key => $val)
{
if(property_exists($this, $key))
{
if (!empty($config)) {
foreach ($config as $key => $val) {
if (property_exists($this, $key)) {
$this->{$key} = $val;
}
}
}
}


}

}
2 changes: 1 addition & 1 deletion app/Controller/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class BaseController extends Controller
* ];
*/
protected $globalMiddles = [];

/**
* Si vous voulez ajouter des middles (middleware) spécifiques pour un controlleur, c'est par ici
*
Expand Down
4 changes: 2 additions & 2 deletions app/Controller/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ public function index()
"titre" => text("Core.classNotFound", ["Home"])
]);
}
}

}
2 changes: 1 addition & 1 deletion app/Middle/Maintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ class Maintenance
*/
public function execute(Request $request, Response $response, $next)
{
return $response->die(503, 'Site Web en Maintenance' ,'Ce site est en maintenance !');
return $response->die(503, 'Site Web en Maintenance', 'Ce site est en maintenance !');
}
}
27 changes: 14 additions & 13 deletions app/Model/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@
use Footup\I18n\Time;
use Footup\Model;

class Article extends Model{
class Article extends Model
{

protected $casts = [
'created_at' => Time::class,
protected $casts = [
'created_at' => Time::class,
];
protected $exclude = ['created_at'];
protected $beforeInsert = [];
protected $beforeFind = [];
protected $beforeDelete = [];
protected $beforeUpdate = [];
protected $afterInsert = [];
protected $afterFind = [];
protected $afterDelete = [];
protected $afterUpdate = [];
protected $hasOne = [
protected $exclude = ['created_at'];
protected $beforeInsert = [];
protected $beforeFind = [];
protected $beforeDelete = [];
protected $beforeUpdate = [];
protected $afterInsert = [];
protected $afterFind = [];
protected $afterDelete = [];
protected $afterUpdate = [];
protected $hasOne = [
'user' => [
'model' => User::class,
'foreign_key' => 'id_user',
Expand Down
23 changes: 12 additions & 11 deletions app/Model/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@
use Footup\I18n\Time;
use Footup\Model;

class Contact extends Model{
class Contact extends Model
{
/**
* PrimaryKey
*
* @var string
*/
protected $primaryKey = 'idcont';

protected $casts = [
'created_at' => Time::class
protected $casts = [
'created_at' => Time::class
];
protected $beforeInsert = [];
protected $beforeFind = [];
protected $beforeDelete = [];
protected $beforeUpdate = [];
protected $afterInsert = [];
protected $afterFind = [];
protected $afterDelete = [];
protected $afterUpdate = [];
protected $beforeInsert = [];
protected $beforeFind = [];
protected $beforeDelete = [];
protected $beforeUpdate = [];
protected $afterInsert = [];
protected $afterFind = [];
protected $afterDelete = [];
protected $afterUpdate = [];

}
6 changes: 4 additions & 2 deletions app/Model/User.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php
namespace App\Model;

use Footup\Model;

class User extends Model{
protected $belongTo = [
class User extends Model
{
protected $belongTo = [
'article' => [
'model' => Article::class,
'foreign_key' => 'user_id',
Expand Down
Loading

0 comments on commit a5fde46

Please sign in to comment.