Some PHPCS fixes

This commit is contained in:
Vincent BRIDIER 2022-08-11 10:26:29 +02:00
parent 4846a6b888
commit 683a6824bc
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
20 changed files with 111 additions and 14 deletions

View file

@ -6,6 +6,10 @@ use App\Models\Settings;
class EndPageController extends Controller
{
/**
* index
* @return \Illuminate\View\View|Illuminate\Http\RedirectResponse
*/
public function index()
{
$settings = app(Settings::class)

View file

@ -102,7 +102,8 @@ class EnterCodeController extends Controller
} catch (\ErrorException $e) {
// Unbind instant gagnant.
$participation->instantWin()->delete();
// TODO: si erreur il faut envoyer un mail à equipe.web@ldc.fr
// phpcs:ignore
// TODO: si erreur il faut envoyer un mail à equipe.web@ldc.fr.
} //end try
}
return $this->serveCouponWin($settings, $participation);

View file

@ -7,6 +7,10 @@ use App\Models\FaqTheme;
class FAQController extends Controller
{
/**
* index
* @return \Illuminate\View\View
*/
public function index()
{
$questions = FaqQuestion::all();

View file

@ -4,6 +4,10 @@ namespace App\Http\Controllers;
class GainsController extends Controller
{
/**
* index
* @return \Illuminate\View\View
*/
public function index()
{
if (view()->exists('front.basic.gains')) {

View file

@ -4,6 +4,10 @@ namespace App\Http\Controllers;
class HomeController extends Controller
{
/**
* home
* @return \Illuminate\View\View
*/
public function home()
{
return view('front.basic.home');

View file

@ -4,6 +4,10 @@ namespace App\Http\Controllers;
class HowToPlayController extends Controller
{
/**
* index
* @return \Illuminate\View\View|Illuminate\Http\RedirectResponse
*/
public function index()
{
if (view()->exists('front.basic.how-to-play')) {

View file

@ -22,6 +22,10 @@ class LoginController extends Controller
$this->apiCrm = new \LDCCRM\ApiV1(config('crm.endpoint'), config('crm.token'));
}
/**
* index
* @return \Illuminate\View\View
*/
public function index()
{
return view('front.basic.login');
@ -114,6 +118,7 @@ class LoginController extends Controller
} //end if
}//end if
// phpcs:ignore
// TODO : Modifier avec separation guard.
$tmpPwd = "MOTDEPASSE";
if ($userLocal->role <= 2) {
@ -130,13 +135,21 @@ class LoginController extends Controller
}
}
/**
* logout
* @return Illuminate\Http\RedirectResponse
*/
public function logout()
{
Auth::logout();
return redirect()->route('home');
}
public function confirmEmail($verifyToken)
/**
* confirm email
* @param string $verifyToken
* @return \Illuminate\View\View|Illuminate\Http\RedirectResponse
*/
public function confirmEmail(string $verifyToken)
{
$result = false;
$user = User::where('email_verify_token', $verifyToken)->first();

View file

@ -6,6 +6,10 @@ use App\Models\Range;
class ProduitsController extends Controller
{
/**
* index
* @return \Illuminate\View\View|Illuminate\Http\RedirectResponse
*/
public function index()
{
$ranges = Range::with('products')->orderBy('id')->get();

View file

@ -7,11 +7,19 @@ use App\Models\Reduction;
class re7Controller extends Controller
{
/**
* index
* @return \Illuminate\View\View
*/
public function index()
{
return view('re7');
}
/**
* teaser
* @return \Illuminate\View\View
*/
public function teaser()
{
$settings = app(Settings::class)
@ -19,16 +27,28 @@ class re7Controller extends Controller
return view('front.basic.teaser', compact('settings'));
}
/**
* prizeMail
* @return \Illuminate\View\View
*/
public function prizeMail()
{
return view('front.basic.prize-mail');
}
/**
* reductionMail
* @return \Illuminate\View\View
*/
public function reductionMail()
{
return view('front.basic.reduction-mail');
}
/**
* br
* @return \Illuminate\View\View
*/
public function br()
{
$settings = app(Settings::class);
@ -37,18 +57,29 @@ class re7Controller extends Controller
return view('front.basic.reduction', compact('coupon', 'crmCoupon'));
}
/**
* gain 1
* @return \Illuminate\View\View
*/
public function gain1()
{
return view('front.basic.gain1');
}
/**
* gain 2
* @return \Illuminate\View\View
*/
public function gain2()
{
return view('front.basic.gain2');
}
private function getRandomCoupon($settings)
/**
* getRandomCoupon
* @param App\Models\Settings $settings
* @return string
*/
private function getRandomCoupon(Settings $settings)
{
$webCoupons = json_decode($settings->web_coupons);
if (count($webCoupons) > 1) {

View file

@ -20,6 +20,10 @@ class CodeEan extends Model
*/
public $timestamps = false;
/**
* Participations relation
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function participations()
{
return $this->hasMany(Participation::class);

View file

@ -16,16 +16,26 @@ class FaqQuestion extends Model
'negative_vote', 'theme_id'
];
/**
* Theme relation
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function theme()
{
return $this->belongsTo(FaqTheme::class, 'theme_id');
}
/**
* get Utility
* @return float|integer
*/
public function getUtilityAttribute()
{
$pourcent = 0;
if ($this->positive_vote !== null && $this->negative_vote !== null && $this->positive_vote >= $this->negative_vote && $this->positive_vote > 0 && $this->negative_vote > 0) {
if (
$this->positive_vote !== null && $this->negative_vote !== null && $this->positive_vote >= $this->negative_vote && $this->positive_vote > 0 && $this->negative_vote > 0
) {
$ratio = $this->negative_vote / $this->positive_vote;
$pourcent = ceil((1 - $ratio) * 100);
}

View file

@ -20,6 +20,10 @@ class FaqTheme extends Model
*/
protected $with = ['questions'];
/**
* Question relation
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function questions()
{
return $this->hasMany(FaqQuestion::class, 'theme_id');

View file

@ -13,6 +13,10 @@ class GainView extends Model
*/
protected $fillable = ['name', 'file_name'];
/**
* Prize relation
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function prizes()
{
return $this->hasMany(Prize::class, 'gain_view_id');

View file

@ -6,6 +6,10 @@ use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
/**
* Range relation
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function range()
{
return $this->belongsTo(Range::class);

View file

@ -13,6 +13,10 @@ class Range extends Model
*/
protected $fillable = ['name'];
/**
* Product relation
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function products()
{
return $this->hasMany(Product::class);

View file

@ -139,6 +139,7 @@ return [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
@ -168,6 +169,7 @@ return [
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
App\Providers\EventServiceProvider::class,

View file

@ -61,6 +61,7 @@ return [
env('MEMCACHED_PASSWORD'),
],
'options' => [
// phpcs:ignore
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [

View file

@ -15,7 +15,7 @@ return [
'default' => env('MAIL_MAILER', 'smtp'),
// Mail admin pour l'envoi de mail comme la fin de la génération des codes uniques
// Mail admin pour l'envoi de mail comme la fin de la génération des codes uniques.
'MAIL_ADMIN' => env('MAIL_ADMIN'),
'contactsList' => [

View file

@ -76,10 +76,4 @@ Route::prefix('bo')
->withoutMiddleware('is-super-admin');
Route::resource('ranges', RangeController::class)
->withoutMiddleware('is-super-admin');
// Route::get('/products', 'ProductsController@index')->name('products');
// Route::get('/products/{id}', 'ProductsController@edit')->name('products.edit');
// Route::post('/products/{id}', 'ProductsController@update')->name('products.update');
// Route::post('/ajax/delete-prize', 'PrizesController@destroy');
// Route::post('/ajax/save-prizes', 'PrizesController@saveDatas');
});

View file

@ -11,6 +11,7 @@ Route::prefix('re7')
Route::get('/mail-gain', [re7Controller::class, 'prizeMail']);
Route::get('/mail-reduction', [re7Controller::class, 'reductionMail']);
Route::get('/br', [re7Controller::class, 'br']);
// phpcs:ignore
// TODO : Rendre dynamique la partie gain par rapport au BO.
Route::get('/gain1', [re7Controller::class, 'gain1']);
Route::get('/gain2', [re7Controller::class, 'gain2']);