Lint PHP code psr-12, add GH action

This commit is contained in:
Julien Nahum
2024-02-23 11:54:12 +01:00
parent e85e4df7fe
commit 62971a2ef4
226 changed files with 2338 additions and 2144 deletions

View File

@@ -3,10 +3,8 @@
namespace App\Http\Resources;
use App\Http\Middleware\Form\ProtectedForm;
use App\Http\Resources\UserResource;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
class FormResource extends JsonResource
{
@@ -20,7 +18,7 @@ class FormResource extends JsonResource
*/
public function toArray($request)
{
if(!$this->userIsFormOwner() && ProtectedForm::isProtected($request, $this->resource)){
if (! $this->userIsFormOwner() && ProtectedForm::isProtected($request, $this->resource)) {
return $this->getProtectedForm();
}
@@ -69,6 +67,7 @@ class FormResource extends JsonResource
public function setCleanings(array $cleanings)
{
$this->cleanings = $cleanings;
return $this;
}
@@ -96,15 +95,18 @@ class FormResource extends JsonResource
];
}
private function getWorkspace() {
private function getWorkspace()
{
return $this->extra?->loadedWorkspace ?? $this->workspace;
}
private function workspaceIsPro() {
private function workspaceIsPro()
{
return $this->extra?->workspaceIsPro ?? $this->getWorkspace()->is_pro ?? $this->is_pro;
}
private function userIsFormOwner() {
private function userIsFormOwner()
{
return $this->extra?->userIsOwner ??
(
Auth::check() && Auth::user()->ownsForm($this->resource)