Passed
Push — feature/code-analysis ( a2ce2d...28b704 )
by Jonathan
04:31
created
app/Contracts/GeoDispersion/ModuleGeoAnalysisProviderInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
  */
20 20
 interface ModuleGeoAnalysisProviderInterface
21 21
 {
22
-    /**
23
-     * List geographical analyses provided by the module as an array.
24
-     *
25
-     * @return string[] List of geographical analyses
26
-     */
27
-    public function listGeoAnalyses(): array;
22
+	/**
23
+	 * List geographical analyses provided by the module as an array.
24
+	 *
25
+	 * @return string[] List of geographical analyses
26
+	 */
27
+	public function listGeoAnalyses(): array;
28 28
 }
Please login to merge, or discard this patch.
app/Contracts/GeoDispersion/ModuleMapDefinitionProviderInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
  */
20 20
 interface ModuleMapDefinitionProviderInterface
21 21
 {
22
-    /**
23
-     * List map definitions provided by the module as an array.
24
-     *
25
-     * @return array<int, MapDefinitionInterface> List of map definitions
26
-     */
27
-    public function listMapDefinition(): array;
22
+	/**
23
+	 * List map definitions provided by the module as an array.
24
+	 *
25
+	 * @return array<int, MapDefinitionInterface> List of map definitions
26
+	 */
27
+	public function listMapDefinition(): array;
28 28
 }
Please login to merge, or discard this patch.
app/Contracts/Tasks/ConfigurableTaskInterface.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,20 +22,20 @@
 block discarded – undo
22 22
  */
23 23
 interface ConfigurableTaskInterface
24 24
 {
25
-    /**
26
-     * Returns the HTML code to display the specific task configuration.
27
-     *
28
-     * @param ServerRequestInterface $request
29
-     * @return string HTML code
30
-     */
31
-    public function configView(ServerRequestInterface $request): string;
25
+	/**
26
+	 * Returns the HTML code to display the specific task configuration.
27
+	 *
28
+	 * @param ServerRequestInterface $request
29
+	 * @return string HTML code
30
+	 */
31
+	public function configView(ServerRequestInterface $request): string;
32 32
 
33
-    /**
34
-     * Update the specific configuration of the task.
35
-     *
36
-     * @param ServerRequestInterface $request
37
-     * @param TaskSchedule $task_schedule
38
-     * @return bool Result of the update
39
-     */
40
-    public function updateConfig(ServerRequestInterface $request, TaskSchedule $task_schedule): bool;
33
+	/**
34
+	 * Update the specific configuration of the task.
35
+	 *
36
+	 * @param ServerRequestInterface $request
37
+	 * @param TaskSchedule $task_schedule
38
+	 * @return bool Result of the update
39
+	 */
40
+	public function updateConfig(ServerRequestInterface $request, TaskSchedule $task_schedule): bool;
41 41
 }
Please login to merge, or discard this patch.
app/Contracts/Tasks/ModuleTasksProviderInterface.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@
 block discarded – undo
19 19
  */
20 20
 interface ModuleTasksProviderInterface
21 21
 {
22
-    /**
23
-     * List tasks provided by the module as an associative array.
24
-     * They keys are used as task IDs for storage and reference.
25
-     *
26
-     * @return array<string, string> List of tasks
27
-     */
28
-    public function listTasks(): array;
22
+	/**
23
+	 * List tasks provided by the module as an associative array.
24
+	 * They keys are used as task IDs for storage and reference.
25
+	 *
26
+	 * @return array<string, string> List of tasks
27
+	 */
28
+	public function listTasks(): array;
29 29
 }
Please login to merge, or discard this patch.
app/Http/Middleware/AuthTreePreference.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -31,37 +31,37 @@
 block discarded – undo
31 31
  */
32 32
 class AuthTreePreference implements MiddlewareInterface
33 33
 {
34
-    /**
35
-     * {@inheritDoc}
36
-     * @see \Psr\Http\Server\MiddlewareInterface::process()
37
-     */
38
-    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
39
-    {
40
-        $tree = Validator::attributes($request)->tree();
41
-        $route = Validator::attributes($request)->route();
42
-        $user = Validator::attributes($request)->user();
34
+	/**
35
+	 * {@inheritDoc}
36
+	 * @see \Psr\Http\Server\MiddlewareInterface::process()
37
+	 */
38
+	public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
39
+	{
40
+		$tree = Validator::attributes($request)->tree();
41
+		$route = Validator::attributes($request)->route();
42
+		$user = Validator::attributes($request)->user();
43 43
 
44
-        $permission_preference = $route->extras['permission_preference'] ?? '';
45
-        $permission_level = $permission_preference === '' ? '' : $tree->getPreference($permission_preference);
44
+		$permission_preference = $route->extras['permission_preference'] ?? '';
45
+		$permission_level = $permission_preference === '' ? '' : $tree->getPreference($permission_preference);
46 46
 
47
-        // Permissions are configured
48
-        if (is_numeric($permission_level)) {
49
-            // Logged in with the correct role?
50
-            if (Auth::accessLevel($tree, $user) <= (int) $permission_level) {
51
-                    return $handler->handle($request);
52
-            }
47
+		// Permissions are configured
48
+		if (is_numeric($permission_level)) {
49
+			// Logged in with the correct role?
50
+			if (Auth::accessLevel($tree, $user) <= (int) $permission_level) {
51
+					return $handler->handle($request);
52
+			}
53 53
 
54
-            // Logged in, but without the correct role?
55
-            if ($user instanceof User) {
56
-                throw new HttpAccessDeniedException();
57
-            }
58
-        }
54
+			// Logged in, but without the correct role?
55
+			if ($user instanceof User) {
56
+				throw new HttpAccessDeniedException();
57
+			}
58
+		}
59 59
 
60
-        // Permissions no configured, or not logged in
61
-        if ($request->getMethod() === RequestMethodInterface::METHOD_POST) {
62
-            throw new HttpAccessDeniedException();
63
-        }
60
+		// Permissions no configured, or not logged in
61
+		if ($request->getMethod() === RequestMethodInterface::METHOD_POST) {
62
+			throw new HttpAccessDeniedException();
63
+		}
64 64
 
65
-        return redirect(route(LoginPage::class, ['tree' => $tree->name(), 'url' => (string) $request->getUri()]));
66
-    }
65
+		return redirect(route(LoginPage::class, ['tree' => $tree->name(), 'url' => (string) $request->getUri()]));
66
+	}
67 67
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         // Permissions are configured
48 48
         if (is_numeric($permission_level)) {
49 49
             // Logged in with the correct role?
50
-            if (Auth::accessLevel($tree, $user) <= (int) $permission_level) {
50
+            if (Auth::accessLevel($tree, $user) <= (int)$permission_level) {
51 51
                     return $handler->handle($request);
52 52
             }
53 53
 
@@ -62,6 +62,6 @@  discard block
 block discarded – undo
62 62
             throw new HttpAccessDeniedException();
63 63
         }
64 64
 
65
-        return redirect(route(LoginPage::class, ['tree' => $tree->name(), 'url' => (string) $request->getUri()]));
65
+        return redirect(route(LoginPage::class, ['tree' => $tree->name(), 'url' => (string)$request->getUri()]));
66 66
     }
67 67
 }
Please login to merge, or discard this patch.
app/Module/Sosa/Schema/Migration0.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
  */
22 22
 class Migration0 implements MigrationInterface
23 23
 {
24
-    /**
25
-     * {@inheritDoc}
26
-     * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
27
-     */
28
-    public function upgrade(): void
29
-    {
30
-        // These migrations have been merged into migration 2.
31
-    }
24
+	/**
25
+	 * {@inheritDoc}
26
+	 * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
27
+	 */
28
+	public function upgrade(): void
29
+	{
30
+		// These migrations have been merged into migration 2.
31
+	}
32 32
 }
Please login to merge, or discard this patch.
app/Module/Sosa/Schema/Migration1.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
  */
22 22
 class Migration1 implements MigrationInterface
23 23
 {
24
-    /**
25
-     * {@inheritDoc}
26
-     * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
27
-     */
28
-    public function upgrade(): void
29
-    {
30
-        // These migrations have been merged into migration 2.
31
-    }
24
+	/**
25
+	 * {@inheritDoc}
26
+	 * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
27
+	 */
28
+	public function upgrade(): void
29
+	{
30
+		// These migrations have been merged into migration 2.
31
+	}
32 32
 }
Please login to merge, or discard this patch.
app/Module/Sosa/Http/RequestHandlers/AncestorsListFamily.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -36,70 +36,70 @@
 block discarded – undo
36 36
  */
37 37
 class AncestorsListFamily implements RequestHandlerInterface
38 38
 {
39
-    use ViewResponseTrait;
40
-
41
-    /**
42
-     * @var SosaModule|null $module
43
-     */
44
-    private $module;
45
-
46
-    /**
47
-     * @var SosaRecordsService $sosa_record_service
48
-     */
49
-    private $sosa_record_service;
50
-
51
-    /**
52
-     * Constructor for AncestorsListFamily Request Handler
53
-     *
54
-     * @param ModuleService $module_service
55
-     * @param SosaRecordsService $sosa_record_service
56
-     */
57
-    public function __construct(
58
-        ModuleService $module_service,
59
-        SosaRecordsService $sosa_record_service
60
-    ) {
61
-        $this->module = $module_service->findByInterface(SosaModule::class)->first();
62
-        $this->sosa_record_service = $sosa_record_service;
63
-    }
64
-
65
-    /**
66
-     * {@inheritDoc}
67
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
68
-     */
69
-    public function handle(ServerRequestInterface $request): ResponseInterface
70
-    {
71
-        $this->layout = 'layouts/ajax';
72
-
73
-        if ($this->module === null) {
74
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
75
-        }
76
-
77
-        $tree = Validator::attributes($request)->tree();
78
-        $user = Auth::check() ? Validator::attributes($request)->user() : new DefaultUser();
79
-        $current_gen = Validator::attributes($request)->integer('gen', 0);
80
-
81
-        if ($current_gen <= 0) {
82
-            return response('Invalid generation', StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY);
83
-        }
84
-
85
-        $list_families = $this->sosa_record_service->listAncestorFamiliesAtGeneration($tree, $user, $current_gen);
86
-        $nb_families_all = $list_families->count();
87
-
88
-        /** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Family> $list_families */
89
-        $list_families = $list_families->mapWithKeys(function (stdClass $value) use ($tree): ?array {
90
-                $fam = Registry::familyFactory()->make($value->f_id, $tree);
91
-                return ($fam !== null && $fam->canShow()) ? [(int) $value->majs_sosa => $fam] : null;
92
-        })->filter();
93
-
94
-        $nb_families_shown = $list_families->count();
95
-
96
-        return $this->viewResponse($this->module->name() . '::list-ancestors-fam-tab', [
97
-            'module_name'       =>  $this->module->name(),
98
-            'title'             =>  I18N::translate('Sosa Ancestors'),
99
-            'tree'              =>  $tree,
100
-            'list_families'     =>  $list_families,
101
-            'nb_families_all'   =>  $nb_families_all,
102
-            'nb_families_shown' =>  $nb_families_shown
103
-        ]);
104
-    }
39
+	use ViewResponseTrait;
40
+
41
+	/**
42
+	 * @var SosaModule|null $module
43
+	 */
44
+	private $module;
45
+
46
+	/**
47
+	 * @var SosaRecordsService $sosa_record_service
48
+	 */
49
+	private $sosa_record_service;
50
+
51
+	/**
52
+	 * Constructor for AncestorsListFamily Request Handler
53
+	 *
54
+	 * @param ModuleService $module_service
55
+	 * @param SosaRecordsService $sosa_record_service
56
+	 */
57
+	public function __construct(
58
+		ModuleService $module_service,
59
+		SosaRecordsService $sosa_record_service
60
+	) {
61
+		$this->module = $module_service->findByInterface(SosaModule::class)->first();
62
+		$this->sosa_record_service = $sosa_record_service;
63
+	}
64
+
65
+	/**
66
+	 * {@inheritDoc}
67
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
68
+	 */
69
+	public function handle(ServerRequestInterface $request): ResponseInterface
70
+	{
71
+		$this->layout = 'layouts/ajax';
72
+
73
+		if ($this->module === null) {
74
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
75
+		}
76
+
77
+		$tree = Validator::attributes($request)->tree();
78
+		$user = Auth::check() ? Validator::attributes($request)->user() : new DefaultUser();
79
+		$current_gen = Validator::attributes($request)->integer('gen', 0);
80
+
81
+		if ($current_gen <= 0) {
82
+			return response('Invalid generation', StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY);
83
+		}
84
+
85
+		$list_families = $this->sosa_record_service->listAncestorFamiliesAtGeneration($tree, $user, $current_gen);
86
+		$nb_families_all = $list_families->count();
87
+
88
+		/** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Family> $list_families */
89
+		$list_families = $list_families->mapWithKeys(function (stdClass $value) use ($tree): ?array {
90
+				$fam = Registry::familyFactory()->make($value->f_id, $tree);
91
+				return ($fam !== null && $fam->canShow()) ? [(int) $value->majs_sosa => $fam] : null;
92
+		})->filter();
93
+
94
+		$nb_families_shown = $list_families->count();
95
+
96
+		return $this->viewResponse($this->module->name() . '::list-ancestors-fam-tab', [
97
+			'module_name'       =>  $this->module->name(),
98
+			'title'             =>  I18N::translate('Sosa Ancestors'),
99
+			'tree'              =>  $tree,
100
+			'list_families'     =>  $list_families,
101
+			'nb_families_all'   =>  $nb_families_all,
102
+			'nb_families_shown' =>  $nb_families_shown
103
+		]);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,14 +86,14 @@
 block discarded – undo
86 86
         $nb_families_all = $list_families->count();
87 87
 
88 88
         /** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Family> $list_families */
89
-        $list_families = $list_families->mapWithKeys(function (stdClass $value) use ($tree): ?array {
89
+        $list_families = $list_families->mapWithKeys(function(stdClass $value) use ($tree): ?array {
90 90
                 $fam = Registry::familyFactory()->make($value->f_id, $tree);
91
-                return ($fam !== null && $fam->canShow()) ? [(int) $value->majs_sosa => $fam] : null;
91
+                return ($fam !== null && $fam->canShow()) ? [(int)$value->majs_sosa => $fam] : null;
92 92
         })->filter();
93 93
 
94 94
         $nb_families_shown = $list_families->count();
95 95
 
96
-        return $this->viewResponse($this->module->name() . '::list-ancestors-fam-tab', [
96
+        return $this->viewResponse($this->module->name().'::list-ancestors-fam-tab', [
97 97
             'module_name'       =>  $this->module->name(),
98 98
             'title'             =>  I18N::translate('Sosa Ancestors'),
99 99
             'tree'              =>  $tree,
Please login to merge, or discard this patch.
app/Module/Sosa/Http/RequestHandlers/SosaComputeAction.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -32,54 +32,54 @@
 block discarded – undo
32 32
  */
33 33
 class SosaComputeAction implements RequestHandlerInterface
34 34
 {
35
-    private UserService $user_service;
35
+	private UserService $user_service;
36 36
 
37
-    /**
38
-     * Constructor for SosaConfigAction Request Handler
39
-     *
40
-     * @param UserService $user_service
41
-     */
42
-    public function __construct(UserService $user_service)
43
-    {
44
-        $this->user_service = $user_service;
45
-    }
37
+	/**
38
+	 * Constructor for SosaConfigAction Request Handler
39
+	 *
40
+	 * @param UserService $user_service
41
+	 */
42
+	public function __construct(UserService $user_service)
43
+	{
44
+		$this->user_service = $user_service;
45
+	}
46 46
 
47
-    /**
48
-     * {@inheritDoc}
49
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
50
-     */
51
-    public function handle(ServerRequestInterface $request): ResponseInterface
52
-    {
53
-        $tree = Validator::attributes($request)->tree();
47
+	/**
48
+	 * {@inheritDoc}
49
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
50
+	 */
51
+	public function handle(ServerRequestInterface $request): ResponseInterface
52
+	{
53
+		$tree = Validator::attributes($request)->tree();
54 54
 
55
-        $user_id = Validator::parsedBody($request)->integer('user_id', Auth::id() ?? 0);
56
-        $partial_from = Validator::parsedBody($request)->isXref()->string('partial_from', '');
55
+		$user_id = Validator::parsedBody($request)->integer('user_id', Auth::id() ?? 0);
56
+		$partial_from = Validator::parsedBody($request)->isXref()->string('partial_from', '');
57 57
 
58
-        if (($user_id == -1 && Auth::isManager($tree)) || Auth::id() == $user_id) {
59
-            $user = $user_id == -1 ? new DefaultUser() : $this->user_service->find($user_id);
58
+		if (($user_id == -1 && Auth::isManager($tree)) || Auth::id() == $user_id) {
59
+			$user = $user_id == -1 ? new DefaultUser() : $this->user_service->find($user_id);
60 60
 
61
-            /** @var SosaCalculatorService $sosa_calc_service */
62
-            $sosa_calc_service = app()->makeWith(SosaCalculatorService::class, [ 'tree' => $tree, 'user' => $user]);
61
+			/** @var SosaCalculatorService $sosa_calc_service */
62
+			$sosa_calc_service = app()->makeWith(SosaCalculatorService::class, [ 'tree' => $tree, 'user' => $user]);
63 63
 
64
-            if (
65
-                $partial_from !== '' &&
66
-                ($sosa_from = Registry::individualFactory()->make($partial_from, $tree)) !== null
67
-            ) {
68
-                $res = $sosa_calc_service->computeFromIndividual($sosa_from);
69
-            } else {
70
-                $res = $sosa_calc_service->computeAll();
71
-            }
64
+			if (
65
+				$partial_from !== '' &&
66
+				($sosa_from = Registry::individualFactory()->make($partial_from, $tree)) !== null
67
+			) {
68
+				$res = $sosa_calc_service->computeFromIndividual($sosa_from);
69
+			} else {
70
+				$res = $sosa_calc_service->computeAll();
71
+			}
72 72
 
73
-            return $res ?
74
-                response('', 200) :
75
-                response(
76
-                    I18N::translate('An error occurred while computing Sosa ancestors.'),
77
-                    StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR
78
-                );
79
-        }
80
-        return response(
81
-            I18N::translate('You do not have permission to modify the user.'),
82
-            StatusCodeInterface::STATUS_FORBIDDEN
83
-        );
84
-    }
73
+			return $res ?
74
+				response('', 200) :
75
+				response(
76
+					I18N::translate('An error occurred while computing Sosa ancestors.'),
77
+					StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR
78
+				);
79
+		}
80
+		return response(
81
+			I18N::translate('You do not have permission to modify the user.'),
82
+			StatusCodeInterface::STATUS_FORBIDDEN
83
+		);
84
+	}
85 85
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             $user = $user_id == -1 ? new DefaultUser() : $this->user_service->find($user_id);
60 60
 
61 61
             /** @var SosaCalculatorService $sosa_calc_service */
62
-            $sosa_calc_service = app()->makeWith(SosaCalculatorService::class, [ 'tree' => $tree, 'user' => $user]);
62
+            $sosa_calc_service = app()->makeWith(SosaCalculatorService::class, ['tree' => $tree, 'user' => $user]);
63 63
 
64 64
             if (
65 65
                 $partial_from !== '' &&
@@ -71,8 +71,7 @@  discard block
 block discarded – undo
71 71
             }
72 72
 
73 73
             return $res ?
74
-                response('', 200) :
75
-                response(
74
+                response('', 200) : response(
76 75
                     I18N::translate('An error occurred while computing Sosa ancestors.'),
77 76
                     StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR
78 77
                 );
Please login to merge, or discard this patch.