Merge branch 'trunk'

This commit is contained in:
Jérémy Munsch 2021-09-21 10:19:43 +02:00
commit 298873f5da
No known key found for this signature in database
GPG key ID: 55196BEE445F6049
14 changed files with 354 additions and 103 deletions

View file

@ -2,7 +2,7 @@
namespace App\Enums;
use Kwaadpepper\Enum\BaseEnum;
use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self collectionNeeds()
@ -13,7 +13,7 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self feedback()
*/
class FileCategory extends BaseEnum
class FileCategory extends BaseEnumRoutable
{
protected static function values(): array
{

View file

@ -2,14 +2,14 @@
namespace App\Enums;
use Kwaadpepper\Enum\BaseEnum;
use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self stringlink()
* @method static self binfile()
*/
class FileType extends BaseEnum
class FileType extends BaseEnumRoutable
{
protected static function values(): array
{

View file

@ -2,7 +2,7 @@
namespace App\Enums;
use Kwaadpepper\Enum\BaseEnum;
use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self weak()
@ -11,7 +11,7 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self overload()
*/
class LoadLevel extends BaseEnum
class LoadLevel extends BaseEnumRoutable
{
protected static function values(): array
{

View file

@ -2,7 +2,7 @@
namespace App\Enums;
use Kwaadpepper\Enum\BaseEnum;
use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self developper()
@ -10,7 +10,7 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self client()
*/
class Role extends BaseEnum
class Role extends BaseEnumRoutable
{
protected static function values(): array
{

View file

@ -2,7 +2,7 @@
namespace App\Enums;
use Kwaadpepper\Enum\BaseEnum;
use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self new()
@ -17,7 +17,7 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self production()
* @method static self archived()
*/
class TicketStatus extends BaseEnum
class TicketStatus extends BaseEnumRoutable
{
protected static function values(): array
{

View file

@ -2,13 +2,13 @@
namespace App\Enums;
use Kwaadpepper\Enum\BaseEnum;
use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self bug()
* @method static self evolution()
*/
class TicketType extends BaseEnum
class TicketType extends BaseEnumRoutable
{
protected static function values(): array
{

View file

@ -2,10 +2,7 @@
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Support\Facades\Mail;
use RuntimeException;
use Throwable;
use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler;
class Handler extends ExceptionHandler
{
@ -29,45 +26,6 @@ class Handler extends ExceptionHandler
'password_confirmation',
];
/**
* Report or log an exception.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $e)
{
if (get_class($e) == RedirectTo::class) {
abort(redirect($e->url));
}
try {
if (config('app.debug') === false) {
if ($this->shouldntReport($e)) {
return;
}
Mail::send([
'html' => 'emails.exception',
'text' => 'emails.exception-plain'
], [
'exception' => $e,
'appName' => config('app.name')
], function ($m) {
$m->to(
config('mail.contactsList.serviceweb'),
sprintf('%s Exception Handler', config('app.name'))
)->subject('Need help !, an error occured in your application, please check Logs ASAP');
});
}
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
} catch (RuntimeException $e) {
// do nothing, mail send error, let laravel only handle this
} finally {
parent::report($e);
}
}
/**
* Register the exception handling callbacks for the application.
*

View file

@ -15,8 +15,9 @@
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"kwaadpepper/crud-policies": "^0.1.9",
"kwaadpepper/enum": "^0.1.4",
"kwaadpepper/crud-policies": "^0.1.18",
"kwaadpepper/enum": "^2.1",
"kwaadpepper/exception-handler": "^0.0.3",
"laravel-lang/lang": "~8.0",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5",
@ -27,7 +28,8 @@
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
"phpunit/phpunit": "^9.3.3",
"slevomat/coding-standard": "^7.0"
},
"config": {
"optimize-autoloader": true,

333
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "0da9cba25dcff87fac2343ef3effa795",
"content-hash": "c32404ecdf12c6d1eca2e714cb65bbb6",
"packages": [
{
"name": "asm89/stack-cors",
@ -1449,27 +1449,28 @@
},
{
"name": "kwaadpepper/crud-policies",
"version": "0.1.9",
"version": "0.1.18",
"source": {
"type": "git",
"url": "https://github.com/Kwaadpepper/crud-policies.git",
"reference": "cb0c3848fe252a4211891f907df387f746bd9750"
"reference": "a8ad75e1ef6e2aac00a45426bebb0b61fac03ba0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Kwaadpepper/crud-policies/zipball/cb0c3848fe252a4211891f907df387f746bd9750",
"reference": "cb0c3848fe252a4211891f907df387f746bd9750",
"url": "https://api.github.com/repos/Kwaadpepper/crud-policies/zipball/a8ad75e1ef6e2aac00a45426bebb0b61fac03ba0",
"reference": "a8ad75e1ef6e2aac00a45426bebb0b61fac03ba0",
"shasum": ""
},
"require": {
"facade/flare-client-php": "^1.8",
"illuminate/support": "~7|~8",
"kwaadpepper/enum": "^0.1.4",
"kwaadpepper/enum": "^2.0",
"laravel/framework": "~7|~8"
},
"require-dev": {
"orchestra/testbench": "^6.13",
"phpunit/phpunit": "~9.0",
"slevomat/coding-standard": "^7.0",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
@ -1506,31 +1507,32 @@
],
"support": {
"issues": "https://github.com/Kwaadpepper/crud-policies/issues",
"source": "https://github.com/Kwaadpepper/crud-policies/tree/0.1.9"
"source": "https://github.com/Kwaadpepper/crud-policies/tree/0.1.18"
},
"time": "2021-07-27T08:58:38+00:00"
"time": "2021-09-15T08:55:36+00:00"
},
{
"name": "kwaadpepper/enum",
"version": "0.1.4",
"version": "2.1.1",
"source": {
"type": "git",
"url": "https://github.com/Kwaadpepper/enum.git",
"reference": "f9e2b960d86ceea45c905f11c0c5699529e32848"
"reference": "1c342113b63d15c8b30e5d8a0af5d4d750392037"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Kwaadpepper/enum/zipball/f9e2b960d86ceea45c905f11c0c5699529e32848",
"reference": "f9e2b960d86ceea45c905f11c0c5699529e32848",
"url": "https://api.github.com/repos/Kwaadpepper/enum/zipball/1c342113b63d15c8b30e5d8a0af5d4d750392037",
"reference": "1c342113b63d15c8b30e5d8a0af5d4d750392037",
"shasum": ""
},
"require": {
"illuminate/support": "~7|~8",
"laravel/framework": "~7|~8"
"php": "^7.3"
},
"require-dev": {
"orchestra/testbench": "^6.13",
"orchestra/testbench": "^5",
"phpunit/php-code-coverage": "^9.2",
"phpunit/phpunit": "~9.0",
"slevomat/coding-standard": "^7.0",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
@ -1565,9 +1567,70 @@
],
"support": {
"issues": "https://github.com/Kwaadpepper/enum/issues",
"source": "https://github.com/Kwaadpepper/enum/tree/0.1.4"
"source": "https://github.com/Kwaadpepper/enum/tree/2.1.1"
},
"time": "2021-04-06T14:35:59+00:00"
"time": "2021-09-20T20:37:21+00:00"
},
{
"name": "kwaadpepper/exception-handler",
"version": "0.0.3",
"source": {
"type": "git",
"url": "https://github.com/Kwaadpepper/exception-handler.git",
"reference": "979e8add45fea601b221e95595366fb446e8c6b7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Kwaadpepper/exception-handler/zipball/979e8add45fea601b221e95595366fb446e8c6b7",
"reference": "979e8add45fea601b221e95595366fb446e8c6b7",
"shasum": ""
},
"require": {
"illuminate/support": "~7|~8",
"laravel/framework": "~7|~8"
},
"require-dev": {
"orchestra/testbench": "^6.13",
"phpunit/phpunit": "~9.0",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Kwaadpepper\\ExceptionHandler\\ExceptionHandlerServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Kwaadpepper\\ExceptionHandler\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jérémy Munsch",
"email": "github@jeremydev.ovh",
"homepage": "https://jeremydev.ovh"
}
],
"description": "Send emails when exceptions occurs",
"homepage": "https://github.com/kwaadpepper/exception-handler",
"keywords": [
"email",
"exception",
"laravel",
"policies"
],
"support": {
"issues": "https://github.com/Kwaadpepper/exception-handler/issues",
"source": "https://github.com/Kwaadpepper/exception-handler/tree/0.0.3"
},
"time": "2021-09-15T17:06:33+00:00"
},
{
"name": "laravel-lang/lang",
@ -5712,6 +5775,76 @@
}
],
"packages-dev": [
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "v0.7.1",
"source": {
"type": "git",
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
"reference": "fe390591e0241955f22eb9ba327d137e501c771c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c",
"reference": "fe390591e0241955f22eb9ba327d137e501c771c",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0",
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0"
},
"require-dev": {
"composer/composer": "*",
"phpcompatibility/php-compatibility": "^9.0",
"sensiolabs/security-checker": "^4.1.0"
},
"type": "composer-plugin",
"extra": {
"class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
},
"autoload": {
"psr-4": {
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Franck Nijhof",
"email": "franck.nijhof@dealerdirect.com",
"homepage": "http://www.frenck.nl",
"role": "Developer / IT Manager"
}
],
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
"homepage": "http://www.dealerdirect.com",
"keywords": [
"PHPCodeSniffer",
"PHP_CodeSniffer",
"code quality",
"codesniffer",
"composer",
"installer",
"phpcs",
"plugin",
"qa",
"quality",
"standard",
"standards",
"style guide",
"stylecheck",
"tests"
],
"support": {
"issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
"source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
},
"time": "2020-12-07T18:04:37+00:00"
},
{
"name": "doctrine/instantiator",
"version": "1.4.0",
@ -6598,6 +6731,55 @@
},
"time": "2021-03-17T13:42:18+00:00"
},
{
"name": "phpstan/phpdoc-parser",
"version": "0.5.5",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "ea0b17460ec38e20d7eb64e7ec49b5d44af5d28c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/ea0b17460ec38e20d7eb64e7ec49b5d44af5d28c",
"reference": "ea0b17460ec38e20d7eb64e7ec49b5d44af5d28c",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.87",
"phpstan/phpstan-strict-rules": "^0.12.5",
"phpunit/phpunit": "^9.5",
"symfony/process": "^5.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.5-dev"
}
},
"autoload": {
"psr-4": {
"PHPStan\\PhpDocParser\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/0.5.5"
},
"time": "2021-06-11T13:24:46+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.6",
@ -7984,6 +8166,123 @@
],
"time": "2020-09-28T06:39:44+00:00"
},
{
"name": "slevomat/coding-standard",
"version": "7.0.13",
"source": {
"type": "git",
"url": "https://github.com/slevomat/coding-standard.git",
"reference": "122a9bf9a4a2195f74100f47dfb8375982f43cc9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slevomat/coding-standard/zipball/122a9bf9a4a2195f74100f47dfb8375982f43cc9",
"reference": "122a9bf9a4a2195f74100f47dfb8375982f43cc9",
"shasum": ""
},
"require": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7",
"php": "^7.1 || ^8.0",
"phpstan/phpdoc-parser": "0.5.1 - 0.5.5",
"squizlabs/php_codesniffer": "^3.6.0"
},
"require-dev": {
"phing/phing": "2.16.4",
"php-parallel-lint/php-parallel-lint": "1.3.0",
"phpstan/phpstan": "0.12.93",
"phpstan/phpstan-deprecation-rules": "0.12.6",
"phpstan/phpstan-phpunit": "0.12.21",
"phpstan/phpstan-strict-rules": "0.12.10",
"phpunit/phpunit": "7.5.20|8.5.5|9.5.7"
},
"type": "phpcodesniffer-standard",
"extra": {
"branch-alias": {
"dev-master": "7.x-dev"
}
},
"autoload": {
"psr-4": {
"SlevomatCodingStandard\\": "SlevomatCodingStandard"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.",
"support": {
"issues": "https://github.com/slevomat/coding-standard/issues",
"source": "https://github.com/slevomat/coding-standard/tree/7.0.13"
},
"funding": [
{
"url": "https://github.com/kukulich",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard",
"type": "tidelift"
}
],
"time": "2021-07-29T14:30:22+00:00"
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.6.0",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625",
"reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625",
"shasum": ""
},
"require": {
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"bin": [
"bin/phpcs",
"bin/phpcbf"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Greg Sherwood",
"role": "lead"
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
"keywords": [
"phpcs",
"standards"
],
"support": {
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
},
"time": "2021-04-09T00:54:41+00:00"
},
{
"name": "theseer/tokenizer",
"version": "1.2.1",

View file

@ -0,0 +1,17 @@
<?php
return [
/**
* Send mail when app debug is turn off
* so you can be warned if an unhandled exception occurs
*/
'enableMaiLog' => !config('app.debug'),
/**
* Put a developper secured mailbox in here
* so you can receive email if things go mad
*/
'contactsList' => [
env('MAIL_LIST_SERVICEWEB', 'equipe.web@ldc.fr')
]
];

View file

@ -80,6 +80,7 @@
</rule>
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing" />
<rule ref="Squiz.WhiteSpace.SemicolonSpacing" />
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses" />
<!-- For Laravel migrations -->

View file

@ -1,10 +0,0 @@
{{ $appName }} Exception Handler
Une erreur est survenue sur le site {{ $appName }}
{{ $exception->getMessage() }}
date : {{ date('Y-m-d H:i:s') }}
code : {{$exception->getCode() }}
file : {{$exception->getFile() }}
line : {{$exception->getLine() }}
Veuillez vérifier les logs pour en voir la trace.

View file

@ -1,16 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{{ $appName }} Exception Handler</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>Une erreur est survenue sur le site {{ $appName }}</h1>
<h2>{{ $exception->getMessage() }}</h2>
<p>date : {{ date('Y-m-d H:i:s') }}</p>
<p>code : {{$exception->getCode() }}</p>
<p>file : {{$exception->getFile() }}</p>
<p>line : {{$exception->getLine() }}</p>
<p>Veuillez vérifier les logs pour en voir la trace.</p>
</body>
</html>

View file

@ -105,7 +105,7 @@
@if ($message->file !== null)
<br><a data-fslightbox="gallery" href="{{ asset($message->file) }}" target="_blank">Ouvrir la pièce jointe</a><br>
@endif<br><br>
<small class="text-muted fw-bold">Le {{ \Carbon\Carbon::parse($message->created_at)->format('d/m/Y à H:i')}} par {{ $message->user->name }}</small>
<small class="text-muted fw-bold">Le {{ \Carbon\Carbon::parse($message->created_at)->format('d/m/Y à H:i')}} par <b>{{ $ticket->user ? $ticket->user->name : __('Utilisateur supprimé') }}</b></small>
</div>
@endif
@endforeach
@ -114,7 +114,7 @@
<div>
<h4>Description</h4>
<p>{!! Utils::plainToHtml($ticket->text) !!}</p>
<small class="text-muted">Créé le {{ \Carbon\Carbon::parse($ticket->created_at)->format('d/m/Y à H:i') }} par <b>{{ $ticket->user->name }}</b></small>
<small class="text-muted">Créé le {{ \Carbon\Carbon::parse($ticket->created_at)->format('d/m/Y à H:i') }} par <b>{{ $ticket->user ? $ticket->user->name : __('Utilisateur supprimé') }}</b></small>
</div>
@if ($ticket->file !== null || $ticket->file2 !== null)
<hr>