Passed
Branch main (f9aaf7)
by Jonathan
14:43
created
app/Module/PatronymicLineage/Model/LineageNode.php 1 patch
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -25,117 +25,117 @@
 block discarded – undo
25 25
 class LineageNode
26 26
 {
27 27
 
28
-    /**
29
-     * @var Collection $linked_fams Spouse families linked to the node
30
-     */
31
-    private $linked_fams;
32
-
33
-    /**
34
-     * @var ?Individual $node_indi Reference individual for the node
35
-     */
36
-    private $node_indi;
37
-
38
-    /**
39
-     * @var LineageRootNode $root_node Root node of the lineage
40
-     */
41
-    private $root_node;
42
-
43
-    /**
44
-     * @var ?string $alt_surname Linked surname, used to link to another lineage
45
-     */
46
-    private $alt_surname;
47
-
48
-    /**
49
-     * Constructor for Lineage node
50
-     *
51
-     * @param Individual $node_indi Main individual
52
-     * @param LineageRootNode $root_node Node of the lineage root
53
-     * @param null|string $alt_surname Follow-up surname
54
-     */
55
-    public function __construct(?Individual $node_indi = null, LineageRootNode $root_node, $alt_surname = null)
56
-    {
57
-        $this->node_indi = $node_indi;
58
-        $this->root_node = $root_node;
59
-        $this->alt_surname = $alt_surname;
60
-        $this->linked_fams = new Collection();
61
-    }
62
-
63
-    /**
64
-     * Add a spouse family to the node
65
-     *
66
-     * @param Family $fams
67
-     * @return stdClass
68
-     */
69
-    public function addFamily(Family $fams): object
70
-    {
71
-        if (!$this->linked_fams->has($fams->xref())) {
72
-            $this->linked_fams->put($fams->xref(), (object) [
73
-                'family'   =>  $fams,
74
-                'children' =>  new Collection()
75
-            ]);
76
-        }
77
-        return $this->linked_fams->get($fams->xref());
78
-    }
79
-
80
-    /**
81
-     * Add a child LineageNode to the node
82
-     *
83
-     * @param Family $fams
84
-     * @param LineageNode $child
85
-     */
86
-    public function addChild(Family $fams, LineageNode $child = null): void
87
-    {
88
-        $this->addFamily($fams)->children->push($child);
89
-        $this->root_node->incrementChildNodes();
90
-    }
91
-
92
-    /**
93
-     * Returns the node individual
94
-     *
95
-     * @return Individual|NULL
96
-     */
97
-    public function individual(): ?Individual
98
-    {
99
-        return $this->node_indi;
100
-    }
101
-
102
-    /**
103
-     * Returns the lineage root node individual
104
-     *
105
-     * @return LineageRootNode
106
-     */
107
-    public function rootNode(): LineageRootNode
108
-    {
109
-        return $this->root_node;
110
-    }
111
-
112
-    /**
113
-     * Returns the spouse families linked to the node
114
-     *
115
-     * @return Collection<string, \stdClass>
116
-     */
117
-    public function families(): Collection
118
-    {
119
-        return $this->linked_fams;
120
-    }
121
-
122
-    /**
123
-     * Returns the follow-up surname
124
-     *
125
-     * @return string
126
-     */
127
-    public function followUpSurname(): string
128
-    {
129
-        return $this->alt_surname ?? '';
130
-    }
131
-
132
-    /**
133
-     * Indicates whether the node has a follow up surname
134
-     *
135
-     * @return boolean
136
-     */
137
-    public function hasFollowUpSurname(): bool
138
-    {
139
-        return mb_strlen($this->followUpSurname()) > 0 ;
140
-    }
28
+	/**
29
+	 * @var Collection $linked_fams Spouse families linked to the node
30
+	 */
31
+	private $linked_fams;
32
+
33
+	/**
34
+	 * @var ?Individual $node_indi Reference individual for the node
35
+	 */
36
+	private $node_indi;
37
+
38
+	/**
39
+	 * @var LineageRootNode $root_node Root node of the lineage
40
+	 */
41
+	private $root_node;
42
+
43
+	/**
44
+	 * @var ?string $alt_surname Linked surname, used to link to another lineage
45
+	 */
46
+	private $alt_surname;
47
+
48
+	/**
49
+	 * Constructor for Lineage node
50
+	 *
51
+	 * @param Individual $node_indi Main individual
52
+	 * @param LineageRootNode $root_node Node of the lineage root
53
+	 * @param null|string $alt_surname Follow-up surname
54
+	 */
55
+	public function __construct(?Individual $node_indi = null, LineageRootNode $root_node, $alt_surname = null)
56
+	{
57
+		$this->node_indi = $node_indi;
58
+		$this->root_node = $root_node;
59
+		$this->alt_surname = $alt_surname;
60
+		$this->linked_fams = new Collection();
61
+	}
62
+
63
+	/**
64
+	 * Add a spouse family to the node
65
+	 *
66
+	 * @param Family $fams
67
+	 * @return stdClass
68
+	 */
69
+	public function addFamily(Family $fams): object
70
+	{
71
+		if (!$this->linked_fams->has($fams->xref())) {
72
+			$this->linked_fams->put($fams->xref(), (object) [
73
+				'family'   =>  $fams,
74
+				'children' =>  new Collection()
75
+			]);
76
+		}
77
+		return $this->linked_fams->get($fams->xref());
78
+	}
79
+
80
+	/**
81
+	 * Add a child LineageNode to the node
82
+	 *
83
+	 * @param Family $fams
84
+	 * @param LineageNode $child
85
+	 */
86
+	public function addChild(Family $fams, LineageNode $child = null): void
87
+	{
88
+		$this->addFamily($fams)->children->push($child);
89
+		$this->root_node->incrementChildNodes();
90
+	}
91
+
92
+	/**
93
+	 * Returns the node individual
94
+	 *
95
+	 * @return Individual|NULL
96
+	 */
97
+	public function individual(): ?Individual
98
+	{
99
+		return $this->node_indi;
100
+	}
101
+
102
+	/**
103
+	 * Returns the lineage root node individual
104
+	 *
105
+	 * @return LineageRootNode
106
+	 */
107
+	public function rootNode(): LineageRootNode
108
+	{
109
+		return $this->root_node;
110
+	}
111
+
112
+	/**
113
+	 * Returns the spouse families linked to the node
114
+	 *
115
+	 * @return Collection<string, \stdClass>
116
+	 */
117
+	public function families(): Collection
118
+	{
119
+		return $this->linked_fams;
120
+	}
121
+
122
+	/**
123
+	 * Returns the follow-up surname
124
+	 *
125
+	 * @return string
126
+	 */
127
+	public function followUpSurname(): string
128
+	{
129
+		return $this->alt_surname ?? '';
130
+	}
131
+
132
+	/**
133
+	 * Indicates whether the node has a follow up surname
134
+	 *
135
+	 * @return boolean
136
+	 */
137
+	public function hasFollowUpSurname(): bool
138
+	{
139
+		return mb_strlen($this->followUpSurname()) > 0 ;
140
+	}
141 141
 }
Please login to merge, or discard this patch.
app/Module/PatronymicLineage/Model/LineageRootNode.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -24,68 +24,68 @@
 block discarded – undo
24 24
 class LineageRootNode extends LineageNode
25 25
 {
26 26
 
27
-    /**
28
-     * @var Collection<string, int> $places Places for the lineage node
29
-     */
30
-    private $places;
27
+	/**
28
+	 * @var Collection<string, int> $places Places for the lineage node
29
+	 */
30
+	private $places;
31 31
 
32
-    /**
33
-     * @var int $nb_children Number of node childs
34
-     */
35
-    private $nb_children;
32
+	/**
33
+	 * @var int $nb_children Number of node childs
34
+	 */
35
+	private $nb_children;
36 36
 
37
-    /**
38
-     * Constructor for LineageRootNode
39
-     *
40
-     * @param Individual|null $node_indi
41
-     */
42
-    public function __construct(?Individual $node_indi = null)
43
-    {
44
-        parent::__construct($node_indi, $this);
45
-        $this->places = new Collection();
46
-        $this->nb_children = 0;
47
-    }
37
+	/**
38
+	 * Constructor for LineageRootNode
39
+	 *
40
+	 * @param Individual|null $node_indi
41
+	 */
42
+	public function __construct(?Individual $node_indi = null)
43
+	{
44
+		parent::__construct($node_indi, $this);
45
+		$this->places = new Collection();
46
+		$this->nb_children = 0;
47
+	}
48 48
 
49
-    /**
50
-     * Adds a place to the list of lineage's place
51
-     *
52
-     * @param Place $place
53
-     */
54
-    public function addPlace(Place $place): void
55
-    {
56
-        $place_name = $place->gedcomName();
57
-        if (mb_strlen($place_name) > 0) {
58
-            $this->places->put($place_name, $this->places->get($place_name, 0) + 1);
59
-        }
60
-    }
49
+	/**
50
+	 * Adds a place to the list of lineage's place
51
+	 *
52
+	 * @param Place $place
53
+	 */
54
+	public function addPlace(Place $place): void
55
+	{
56
+		$place_name = $place->gedcomName();
57
+		if (mb_strlen($place_name) > 0) {
58
+			$this->places->put($place_name, $this->places->get($place_name, 0) + 1);
59
+		}
60
+	}
61 61
 
62
-    /**
63
-     * Returns the number of child nodes.
64
-     * This number is more to be used as indication rather than an accurate one.
65
-     *
66
-     * @return int
67
-     */
68
-    public function numberChildNodes(): int
69
-    {
70
-        return $this->nb_children;
71
-    }
62
+	/**
63
+	 * Returns the number of child nodes.
64
+	 * This number is more to be used as indication rather than an accurate one.
65
+	 *
66
+	 * @return int
67
+	 */
68
+	public function numberChildNodes(): int
69
+	{
70
+		return $this->nb_children;
71
+	}
72 72
 
73
-    /**
74
-     * Increments the number of child nodes by one
75
-     *
76
-     */
77
-    public function incrementChildNodes(): void
78
-    {
79
-        $this->nb_children++;
80
-    }
73
+	/**
74
+	 * Increments the number of child nodes by one
75
+	 *
76
+	 */
77
+	public function incrementChildNodes(): void
78
+	{
79
+		$this->nb_children++;
80
+	}
81 81
 
82
-    /**
83
-     * Returns the list of place for the lineage
84
-     *
85
-     * @return Collection<string, int>
86
-     */
87
-    public function places(): Collection
88
-    {
89
-        return $this->places;
90
-    }
82
+	/**
83
+	 * Returns the list of place for the lineage
84
+	 *
85
+	 * @return Collection<string, int>
86
+	 */
87
+	public function places(): Collection
88
+	{
89
+		return $this->places;
90
+	}
91 91
 }
Please login to merge, or discard this patch.
app/Module/PatronymicLineage/Model/LineageBuilder.php 1 patch
Indentation   +217 added lines, -217 removed lines patch added patch discarded remove patch
@@ -29,221 +29,221 @@
 block discarded – undo
29 29
 class LineageBuilder
30 30
 {
31 31
 
32
-    /**
33
-     * @var string $surname Reference surname
34
-     */
35
-    private $surname;
36
-
37
-    /**
38
-     * @var Tree $tree Reference tree
39
-     */
40
-    private $tree;
41
-
42
-    /**
43
-     * @var IndividualListModule|null $indilist_module
44
-     */
45
-    private $indilist_module;
46
-
47
-    /**
48
-     * @var Collection $used_indis Individuals already processed
49
-     */
50
-    private $used_indis;
51
-
52
-    /**
53
-     * Constructor for Lineage Builder
54
-     *
55
-     * @param string $surname Reference surname
56
-     * @param Tree $tree Gedcom tree
57
-     */
58
-    public function __construct($surname, Tree $tree, IndividualListModule $indilist_module)
59
-    {
60
-        $this->surname = $surname;
61
-        $this->tree = $tree;
62
-        $this->indilist_module = $indilist_module;
63
-        $this->used_indis = new Collection();
64
-    }
65
-
66
-    /**
67
-     * Build all patronymic lineages for the reference surname.
68
-     *
69
-     * @return Collection<LineageRootNode>|NULL List of root patronymic lineages
70
-     */
71
-    public function buildLineages(): ?Collection
72
-    {
73
-        if ($this->indilist_module === null) {
74
-            return null;
75
-        }
76
-
77
-        $indis = $this->indilist_module->individuals($this->tree, $this->surname, '', '', false, false, I18N::locale());
78
-        //Warning - the IndividualListModule returns a clone of individuals objects. Cannot be used for object equality
79
-        if (count($indis) == 0) {
80
-            return null;
81
-        }
82
-
83
-        $root_lineages = new Collection();
84
-
85
-        foreach ($indis as $indi) {
86
-            /** @var Individual $indi */
87
-            if ($this->used_indis->get($indi->xref(), false) === false) {
88
-                $indi_first = $this->getLineageRootIndividual($indi);
89
-                if ($indi_first !== null) {
90
-                    // The root lineage needs to be recreated from the Factory, to retrieve the proper object
91
-                    $indi_first = Registry::individualFactory()->make($indi_first->xref(), $this->tree);
92
-                }
93
-                if ($indi_first === null) {
94
-                    continue;
95
-                }
96
-                $this->used_indis->put($indi_first->xref(), true);
97
-                if ($indi_first->canShow()) {
98
-                    //Check if the root individual has brothers and sisters, without parents
99
-                    $indi_first_child_family = $indi_first->childFamilies()->first();
100
-                    if ($indi_first_child_family !== null) {
101
-                        $root_node = new LineageRootNode(null);
102
-                        $root_node->addFamily($indi_first_child_family);
103
-                    } else {
104
-                        $root_node = new LineageRootNode($indi_first);
105
-                    }
106
-                    $root_node = $this->buildLineage($root_node);
107
-                    $root_lineages->add($root_node);
108
-                }
109
-            }
110
-        }
111
-
112
-        return $root_lineages->sort(function (LineageRootNode $a, LineageRootNode $b) {
113
-
114
-            if ($a->numberChildNodes() == $b->numberChildNodes()) {
115
-                return 0;
116
-            }
117
-            return ($a->numberChildNodes() > $b->numberChildNodes()) ? -1 : 1;
118
-        });
119
-    }
120
-
121
-    /**
122
-     * Retrieve the root individual, from any individual, by recursion.
123
-     * The Root individual is the individual without a father, or without a mother holding the same name.
124
-     *
125
-     * @param Individual $indi
126
-     * @return Individual|NULL Root individual
127
-     */
128
-    private function getLineageRootIndividual(Individual $indi): ?Individual
129
-    {
130
-        $child_families = $indi->childFamilies();
131
-        if ($this->used_indis->get($indi->xref(), false) !== false) {
132
-            return null;
133
-        }
134
-
135
-        foreach ($child_families as $child_family) {
136
-            /** @var Family $child_family */
137
-            $child_family->husband();
138
-            if (($husb = $child_family->husband()) !== null) {
139
-                if ($husb->isPendingAddition() && $husb->privatizeGedcom(Auth::PRIV_HIDE) == '') {
140
-                    return $indi;
141
-                }
142
-                return $this->getLineageRootIndividual($husb);
143
-            } elseif (($wife = $child_family->wife()) !== null) {
144
-                if (!($wife->isPendingAddition() && $wife->privatizeGedcom(Auth::PRIV_HIDE) == '')) {
145
-                    $indi_surname = $indi->getAllNames()[$indi->getPrimaryName()]['surname'];
146
-                    $wife_surname = $wife->getAllNames()[$wife->getPrimaryName()]['surname'];
147
-                    if (
148
-                        $indi->canShowName()
149
-                        && $wife->canShowName()
150
-                        && I18N::comparator()($indi_surname, $wife_surname) == 0
151
-                    ) {
152
-                            return $this->getLineageRootIndividual($wife);
153
-                    }
154
-                }
155
-                return $indi;
156
-            }
157
-        }
158
-        return $indi;
159
-    }
160
-
161
-    /**
162
-     * Computes descendent Lineage from a node.
163
-     * Uses recursion to build the lineage tree
164
-     *
165
-     * @param LineageNode $node
166
-     * @return LineageNode Computed lineage
167
-     */
168
-    private function buildLineage(LineageNode $node): LineageNode
169
-    {
170
-        $indi_surname = '';
171
-
172
-        $indi_node = $node->individual();
173
-        if ($indi_node !== null) {
174
-            if ($node->families()->count() == 0) {
175
-                foreach ($indi_node->spouseFamilies() as $spouse_family) {
176
-                    $node->addFamily($spouse_family);
177
-                }
178
-            }
179
-
180
-            $indi_surname = $indi_node->getAllNames()[$indi_node->getPrimaryName()]['surname'] ?? '';
181
-            $node->rootNode()->addPlace($indi_node->getBirthPlace());
182
-
183
-            //Tag the individual as used
184
-            $this->used_indis->put($indi_node->xref(), true);
185
-        }
186
-
187
-        foreach ($node->families() as $family_node) {
188
-            /** @var Family $spouse_family */
189
-            $spouse_family = $family_node->family;
190
-            $spouse_surname = '';
191
-            $spouse = null;
192
-            if (
193
-                $indi_node !== null &&
194
-                ($spouse = $spouse_family->spouse($indi_node)) !== null && $spouse->canShowName()
195
-            ) {
196
-                $spouse_surname = $spouse->getAllNames()[$spouse->getPrimaryName()]['surname'] ?? '';
197
-            }
198
-
199
-            $nb_children = $nb_natural = 0;
200
-
201
-            foreach ($spouse_family->children() as $child) {
202
-                if (!($child->isPendingAddition() && $child->privatizeGedcom(Auth::PRIV_HIDE) == '')) {
203
-                    $child_surname = $child->getAllNames()[$child->getPrimaryName()]['surname'] ?? '';
204
-
205
-                    $nb_children++;
206
-                    if ($indi_node !== null && $indi_node->sex() == 'F') { //If the root individual is the mother
207
-                        //Print only lineages of children with the same surname as their mother
208
-                        //(supposing they are natural children)
209
-                        /** @psalm-suppress RedundantCondition */
210
-                        if (
211
-                            $spouse === null ||
212
-                            ($spouse_surname !== '' && I18N::comparator()($child_surname, $spouse_surname) != 0)
213
-                        ) {
214
-                            if (I18N::comparator()($child_surname, $indi_surname) == 0) {
215
-                                $nb_natural++;
216
-                                $node_child = new LineageNode($child, $node->rootNode());
217
-                                $node_child = $this->buildLineage($node_child);
218
-                                $node->addChild($spouse_family, $node_child);
219
-                            }
220
-                        }
221
-                    } else { //If the root individual is the father
222
-                        $nb_natural++;
223
-                        //Print if the children does not bear the same name as his mother
224
-                        //(and different from his father)
225
-                        if (
226
-                            mb_strlen($child_surname) == 0 ||
227
-                            mb_strlen($indi_surname) == 0 || mb_strlen($spouse_surname) == 0 ||
228
-                            I18N::comparator()($child_surname, $indi_surname) == 0 ||
229
-                            I18N::comparator()($child_surname, $spouse_surname) != 0
230
-                        ) {
231
-                            $node_child = new LineageNode($child, $node->rootNode());
232
-                            $node_child = $this->buildLineage($node_child);
233
-                        } else {
234
-                            $node_child = new LineageNode($child, $node->rootNode(), $child_surname);
235
-                        }
236
-                        $node->addChild($spouse_family, $node_child);
237
-                    }
238
-                }
239
-            }
240
-
241
-            //Do not print other children
242
-            if (($nb_children - $nb_natural) > 0) {
243
-                $node->addChild($spouse_family, null);
244
-            }
245
-        }
246
-
247
-        return $node;
248
-    }
32
+	/**
33
+	 * @var string $surname Reference surname
34
+	 */
35
+	private $surname;
36
+
37
+	/**
38
+	 * @var Tree $tree Reference tree
39
+	 */
40
+	private $tree;
41
+
42
+	/**
43
+	 * @var IndividualListModule|null $indilist_module
44
+	 */
45
+	private $indilist_module;
46
+
47
+	/**
48
+	 * @var Collection $used_indis Individuals already processed
49
+	 */
50
+	private $used_indis;
51
+
52
+	/**
53
+	 * Constructor for Lineage Builder
54
+	 *
55
+	 * @param string $surname Reference surname
56
+	 * @param Tree $tree Gedcom tree
57
+	 */
58
+	public function __construct($surname, Tree $tree, IndividualListModule $indilist_module)
59
+	{
60
+		$this->surname = $surname;
61
+		$this->tree = $tree;
62
+		$this->indilist_module = $indilist_module;
63
+		$this->used_indis = new Collection();
64
+	}
65
+
66
+	/**
67
+	 * Build all patronymic lineages for the reference surname.
68
+	 *
69
+	 * @return Collection<LineageRootNode>|NULL List of root patronymic lineages
70
+	 */
71
+	public function buildLineages(): ?Collection
72
+	{
73
+		if ($this->indilist_module === null) {
74
+			return null;
75
+		}
76
+
77
+		$indis = $this->indilist_module->individuals($this->tree, $this->surname, '', '', false, false, I18N::locale());
78
+		//Warning - the IndividualListModule returns a clone of individuals objects. Cannot be used for object equality
79
+		if (count($indis) == 0) {
80
+			return null;
81
+		}
82
+
83
+		$root_lineages = new Collection();
84
+
85
+		foreach ($indis as $indi) {
86
+			/** @var Individual $indi */
87
+			if ($this->used_indis->get($indi->xref(), false) === false) {
88
+				$indi_first = $this->getLineageRootIndividual($indi);
89
+				if ($indi_first !== null) {
90
+					// The root lineage needs to be recreated from the Factory, to retrieve the proper object
91
+					$indi_first = Registry::individualFactory()->make($indi_first->xref(), $this->tree);
92
+				}
93
+				if ($indi_first === null) {
94
+					continue;
95
+				}
96
+				$this->used_indis->put($indi_first->xref(), true);
97
+				if ($indi_first->canShow()) {
98
+					//Check if the root individual has brothers and sisters, without parents
99
+					$indi_first_child_family = $indi_first->childFamilies()->first();
100
+					if ($indi_first_child_family !== null) {
101
+						$root_node = new LineageRootNode(null);
102
+						$root_node->addFamily($indi_first_child_family);
103
+					} else {
104
+						$root_node = new LineageRootNode($indi_first);
105
+					}
106
+					$root_node = $this->buildLineage($root_node);
107
+					$root_lineages->add($root_node);
108
+				}
109
+			}
110
+		}
111
+
112
+		return $root_lineages->sort(function (LineageRootNode $a, LineageRootNode $b) {
113
+
114
+			if ($a->numberChildNodes() == $b->numberChildNodes()) {
115
+				return 0;
116
+			}
117
+			return ($a->numberChildNodes() > $b->numberChildNodes()) ? -1 : 1;
118
+		});
119
+	}
120
+
121
+	/**
122
+	 * Retrieve the root individual, from any individual, by recursion.
123
+	 * The Root individual is the individual without a father, or without a mother holding the same name.
124
+	 *
125
+	 * @param Individual $indi
126
+	 * @return Individual|NULL Root individual
127
+	 */
128
+	private function getLineageRootIndividual(Individual $indi): ?Individual
129
+	{
130
+		$child_families = $indi->childFamilies();
131
+		if ($this->used_indis->get($indi->xref(), false) !== false) {
132
+			return null;
133
+		}
134
+
135
+		foreach ($child_families as $child_family) {
136
+			/** @var Family $child_family */
137
+			$child_family->husband();
138
+			if (($husb = $child_family->husband()) !== null) {
139
+				if ($husb->isPendingAddition() && $husb->privatizeGedcom(Auth::PRIV_HIDE) == '') {
140
+					return $indi;
141
+				}
142
+				return $this->getLineageRootIndividual($husb);
143
+			} elseif (($wife = $child_family->wife()) !== null) {
144
+				if (!($wife->isPendingAddition() && $wife->privatizeGedcom(Auth::PRIV_HIDE) == '')) {
145
+					$indi_surname = $indi->getAllNames()[$indi->getPrimaryName()]['surname'];
146
+					$wife_surname = $wife->getAllNames()[$wife->getPrimaryName()]['surname'];
147
+					if (
148
+						$indi->canShowName()
149
+						&& $wife->canShowName()
150
+						&& I18N::comparator()($indi_surname, $wife_surname) == 0
151
+					) {
152
+							return $this->getLineageRootIndividual($wife);
153
+					}
154
+				}
155
+				return $indi;
156
+			}
157
+		}
158
+		return $indi;
159
+	}
160
+
161
+	/**
162
+	 * Computes descendent Lineage from a node.
163
+	 * Uses recursion to build the lineage tree
164
+	 *
165
+	 * @param LineageNode $node
166
+	 * @return LineageNode Computed lineage
167
+	 */
168
+	private function buildLineage(LineageNode $node): LineageNode
169
+	{
170
+		$indi_surname = '';
171
+
172
+		$indi_node = $node->individual();
173
+		if ($indi_node !== null) {
174
+			if ($node->families()->count() == 0) {
175
+				foreach ($indi_node->spouseFamilies() as $spouse_family) {
176
+					$node->addFamily($spouse_family);
177
+				}
178
+			}
179
+
180
+			$indi_surname = $indi_node->getAllNames()[$indi_node->getPrimaryName()]['surname'] ?? '';
181
+			$node->rootNode()->addPlace($indi_node->getBirthPlace());
182
+
183
+			//Tag the individual as used
184
+			$this->used_indis->put($indi_node->xref(), true);
185
+		}
186
+
187
+		foreach ($node->families() as $family_node) {
188
+			/** @var Family $spouse_family */
189
+			$spouse_family = $family_node->family;
190
+			$spouse_surname = '';
191
+			$spouse = null;
192
+			if (
193
+				$indi_node !== null &&
194
+				($spouse = $spouse_family->spouse($indi_node)) !== null && $spouse->canShowName()
195
+			) {
196
+				$spouse_surname = $spouse->getAllNames()[$spouse->getPrimaryName()]['surname'] ?? '';
197
+			}
198
+
199
+			$nb_children = $nb_natural = 0;
200
+
201
+			foreach ($spouse_family->children() as $child) {
202
+				if (!($child->isPendingAddition() && $child->privatizeGedcom(Auth::PRIV_HIDE) == '')) {
203
+					$child_surname = $child->getAllNames()[$child->getPrimaryName()]['surname'] ?? '';
204
+
205
+					$nb_children++;
206
+					if ($indi_node !== null && $indi_node->sex() == 'F') { //If the root individual is the mother
207
+						//Print only lineages of children with the same surname as their mother
208
+						//(supposing they are natural children)
209
+						/** @psalm-suppress RedundantCondition */
210
+						if (
211
+							$spouse === null ||
212
+							($spouse_surname !== '' && I18N::comparator()($child_surname, $spouse_surname) != 0)
213
+						) {
214
+							if (I18N::comparator()($child_surname, $indi_surname) == 0) {
215
+								$nb_natural++;
216
+								$node_child = new LineageNode($child, $node->rootNode());
217
+								$node_child = $this->buildLineage($node_child);
218
+								$node->addChild($spouse_family, $node_child);
219
+							}
220
+						}
221
+					} else { //If the root individual is the father
222
+						$nb_natural++;
223
+						//Print if the children does not bear the same name as his mother
224
+						//(and different from his father)
225
+						if (
226
+							mb_strlen($child_surname) == 0 ||
227
+							mb_strlen($indi_surname) == 0 || mb_strlen($spouse_surname) == 0 ||
228
+							I18N::comparator()($child_surname, $indi_surname) == 0 ||
229
+							I18N::comparator()($child_surname, $spouse_surname) != 0
230
+						) {
231
+							$node_child = new LineageNode($child, $node->rootNode());
232
+							$node_child = $this->buildLineage($node_child);
233
+						} else {
234
+							$node_child = new LineageNode($child, $node->rootNode(), $child_surname);
235
+						}
236
+						$node->addChild($spouse_family, $node_child);
237
+					}
238
+				}
239
+			}
240
+
241
+			//Do not print other children
242
+			if (($nb_children - $nb_natural) > 0) {
243
+				$node->addChild($spouse_family, null);
244
+			}
245
+		}
246
+
247
+		return $node;
248
+	}
249 249
 }
Please login to merge, or discard this patch.
app/Module/WelcomeBlock/WelcomeBlockModule.php 2 patches
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -33,159 +33,159 @@
 block discarded – undo
33 33
  */
34 34
 class WelcomeBlockModule extends AbstractModule implements ModuleMyArtJaubInterface, ModuleBlockInterface
35 35
 {
36
-    use ModuleMyArtJaubTrait;
37
-    use ModuleBlockTrait;
38
-
39
-    /**
40
-     * {@inheritDoc}
41
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
42
-     */
43
-    public function title(): string
44
-    {
45
-        return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block');
46
-    }
47
-
48
-    /**
49
-     * {@inheritDoc}
50
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
51
-     */
52
-    public function description(): string
53
-    {
54
-        //phpcs:ignore Generic.Files.LineLength.TooLong
55
-        return /* I18N: Description of the “WelcomeBlock” module */ I18N::translate('The MyArtJaub Welcome block welcomes the visitor to the site, allows a quick login to the site, and displays statistics on visits.');
56
-    }
57
-
58
-    /**
59
-     * {@inheritDoc}
60
-     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
61
-     */
62
-    public function loadRoutes(Map $router): void
63
-    {
64
-        $router->attach('', '', static function (Map $router): void {
65
-
66
-            $router->attach('', '/module-maj/welcomeblock/{block_id}', static function (Map $router): void {
67
-                $router->tokens(['block_id' => '\d+']);
68
-                $router->get(MatomoStats::class, '/matomostats', MatomoStats::class);
69
-            });
70
-        });
71
-    }
72
-
73
-    /**
74
-     * {@inheritDoc}
75
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
76
-     */
77
-    public function customModuleVersion(): string
78
-    {
79
-        return '2.0.11-v.2';
80
-    }
81
-
82
-    /**
83
-     * {@inheritDoc}
84
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
85
-     */
86
-    public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
87
-    {
88
-        $fab_welcome_block_view = app(\Fisharebest\Webtrees\Module\WelcomeBlockModule::class)
89
-            ->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
90
-
91
-        $fab_login_block_view = app(\Fisharebest\Webtrees\Module\LoginBlockModule::class)
92
-            ->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
93
-
94
-        $content = view($this->name() . '::block-embed', [
95
-            'block_id'                  =>  $block_id,
96
-            'fab_welcome_block_view'    =>  $fab_welcome_block_view,
97
-            'fab_login_block_view'      =>  $fab_login_block_view,
98
-            'matomo_enabled'            =>  $this->isMatomoEnabled($block_id),
99
-            'js_script_url'             =>  $this->assetUrl('js/welcomeblock.min.js')
100
-        ]);
101
-
102
-        if ($context !== self::CONTEXT_EMBED) {
103
-            return view('modules/block-template', [
104
-                'block'      => Str::kebab($this->name()),
105
-                'id'         => $block_id,
106
-                'config_url' => $this->configUrl($tree, $context, $block_id),
107
-                'title'      => $tree->title(),
108
-                'content'    => $content,
109
-            ]);
110
-        }
111
-
112
-        return $content;
113
-    }
114
-
115
-    /**
116
-     * {@inheritDoc}
117
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isTreeBlock()
118
-     */
119
-    public function isTreeBlock(): bool
120
-    {
121
-        return true;
122
-    }
123
-
124
-    /**
125
-     * {@inheritDoc}
126
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::editBlockConfiguration()
127
-     */
128
-    public function editBlockConfiguration(Tree $tree, int $block_id): string
129
-    {
130
-        return view($this->name() . '::config', $this->matomoSettings($block_id));
131
-    }
132
-
133
-    /**
134
-     * {@inheritDoc}
135
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::saveBlockConfiguration()
136
-     */
137
-    public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void
138
-    {
139
-        $params = (array) $request->getParsedBody();
140
-
141
-        $matomo_enabled = $params['matomo_enabled'] == 'yes';
142
-        $this->setBlockSetting($block_id, 'matomo_enabled', $matomo_enabled ? 'yes' : 'no');
143
-        if (!$matomo_enabled) {
144
-            return;
145
-        }
146
-
147
-        if (filter_var($params['matomo_url'], FILTER_VALIDATE_URL) === false) {
148
-            FlashMessages::addMessage(I18N::translate('The Matomo URL provided is not valid.'), 'danger');
149
-            return;
150
-        }
151
-
152
-        if (filter_var($params['matomo_siteid'], FILTER_VALIDATE_INT) === false) {
153
-            FlashMessages::addMessage(I18N::translate('The Matomo Site ID provided is not valid.'), 'danger');
154
-            return;
155
-        }
156
-
157
-        $this
158
-            ->setBlockSetting($block_id, 'matomo_url', trim($params['matomo_url']))
159
-            ->setBlockSetting($block_id, 'matomo_token', trim($params['matomo_token']))
160
-            ->setBlockSetting($block_id, 'matomo_siteid', $params['matomo_siteid']);
161
-
162
-        Registry::cache()->file()->forget($this->name() . '-matomovisits-yearly-' . $block_id);
163
-    }
164
-
165
-    /**
166
-     * Returns whether Matomo statistics is enabled for a specific MyArtJaub WelcomeBlock block
167
-     *
168
-     * @param int $block_id
169
-     * @return bool
170
-     */
171
-    public function isMatomoEnabled(int $block_id): bool
172
-    {
173
-        return $this->getBlockSetting($block_id, 'matomo_enabled', 'no') === 'yes';
174
-    }
175
-
176
-    /**
177
-     * Returns settings for retrieving Matomo statistics for a specific MyArtJaub WelcomeBlock block
178
-     *
179
-     * @param int $block_id
180
-     * @return array<string, mixed>
181
-     */
182
-    public function matomoSettings(int $block_id): array
183
-    {
184
-        return [
185
-            'matomo_enabled' => $this->isMatomoEnabled($block_id),
186
-            'matomo_url' => $this->getBlockSetting($block_id, 'matomo_url'),
187
-            'matomo_token' => $this->getBlockSetting($block_id, 'matomo_token'),
188
-            'matomo_siteid'  => (int) $this->getBlockSetting($block_id, 'matomo_siteid', '0')
189
-        ];
190
-    }
36
+	use ModuleMyArtJaubTrait;
37
+	use ModuleBlockTrait;
38
+
39
+	/**
40
+	 * {@inheritDoc}
41
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
42
+	 */
43
+	public function title(): string
44
+	{
45
+		return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block');
46
+	}
47
+
48
+	/**
49
+	 * {@inheritDoc}
50
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
51
+	 */
52
+	public function description(): string
53
+	{
54
+		//phpcs:ignore Generic.Files.LineLength.TooLong
55
+		return /* I18N: Description of the “WelcomeBlock” module */ I18N::translate('The MyArtJaub Welcome block welcomes the visitor to the site, allows a quick login to the site, and displays statistics on visits.');
56
+	}
57
+
58
+	/**
59
+	 * {@inheritDoc}
60
+	 * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
61
+	 */
62
+	public function loadRoutes(Map $router): void
63
+	{
64
+		$router->attach('', '', static function (Map $router): void {
65
+
66
+			$router->attach('', '/module-maj/welcomeblock/{block_id}', static function (Map $router): void {
67
+				$router->tokens(['block_id' => '\d+']);
68
+				$router->get(MatomoStats::class, '/matomostats', MatomoStats::class);
69
+			});
70
+		});
71
+	}
72
+
73
+	/**
74
+	 * {@inheritDoc}
75
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
76
+	 */
77
+	public function customModuleVersion(): string
78
+	{
79
+		return '2.0.11-v.2';
80
+	}
81
+
82
+	/**
83
+	 * {@inheritDoc}
84
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
85
+	 */
86
+	public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
87
+	{
88
+		$fab_welcome_block_view = app(\Fisharebest\Webtrees\Module\WelcomeBlockModule::class)
89
+			->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
90
+
91
+		$fab_login_block_view = app(\Fisharebest\Webtrees\Module\LoginBlockModule::class)
92
+			->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
93
+
94
+		$content = view($this->name() . '::block-embed', [
95
+			'block_id'                  =>  $block_id,
96
+			'fab_welcome_block_view'    =>  $fab_welcome_block_view,
97
+			'fab_login_block_view'      =>  $fab_login_block_view,
98
+			'matomo_enabled'            =>  $this->isMatomoEnabled($block_id),
99
+			'js_script_url'             =>  $this->assetUrl('js/welcomeblock.min.js')
100
+		]);
101
+
102
+		if ($context !== self::CONTEXT_EMBED) {
103
+			return view('modules/block-template', [
104
+				'block'      => Str::kebab($this->name()),
105
+				'id'         => $block_id,
106
+				'config_url' => $this->configUrl($tree, $context, $block_id),
107
+				'title'      => $tree->title(),
108
+				'content'    => $content,
109
+			]);
110
+		}
111
+
112
+		return $content;
113
+	}
114
+
115
+	/**
116
+	 * {@inheritDoc}
117
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isTreeBlock()
118
+	 */
119
+	public function isTreeBlock(): bool
120
+	{
121
+		return true;
122
+	}
123
+
124
+	/**
125
+	 * {@inheritDoc}
126
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::editBlockConfiguration()
127
+	 */
128
+	public function editBlockConfiguration(Tree $tree, int $block_id): string
129
+	{
130
+		return view($this->name() . '::config', $this->matomoSettings($block_id));
131
+	}
132
+
133
+	/**
134
+	 * {@inheritDoc}
135
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::saveBlockConfiguration()
136
+	 */
137
+	public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void
138
+	{
139
+		$params = (array) $request->getParsedBody();
140
+
141
+		$matomo_enabled = $params['matomo_enabled'] == 'yes';
142
+		$this->setBlockSetting($block_id, 'matomo_enabled', $matomo_enabled ? 'yes' : 'no');
143
+		if (!$matomo_enabled) {
144
+			return;
145
+		}
146
+
147
+		if (filter_var($params['matomo_url'], FILTER_VALIDATE_URL) === false) {
148
+			FlashMessages::addMessage(I18N::translate('The Matomo URL provided is not valid.'), 'danger');
149
+			return;
150
+		}
151
+
152
+		if (filter_var($params['matomo_siteid'], FILTER_VALIDATE_INT) === false) {
153
+			FlashMessages::addMessage(I18N::translate('The Matomo Site ID provided is not valid.'), 'danger');
154
+			return;
155
+		}
156
+
157
+		$this
158
+			->setBlockSetting($block_id, 'matomo_url', trim($params['matomo_url']))
159
+			->setBlockSetting($block_id, 'matomo_token', trim($params['matomo_token']))
160
+			->setBlockSetting($block_id, 'matomo_siteid', $params['matomo_siteid']);
161
+
162
+		Registry::cache()->file()->forget($this->name() . '-matomovisits-yearly-' . $block_id);
163
+	}
164
+
165
+	/**
166
+	 * Returns whether Matomo statistics is enabled for a specific MyArtJaub WelcomeBlock block
167
+	 *
168
+	 * @param int $block_id
169
+	 * @return bool
170
+	 */
171
+	public function isMatomoEnabled(int $block_id): bool
172
+	{
173
+		return $this->getBlockSetting($block_id, 'matomo_enabled', 'no') === 'yes';
174
+	}
175
+
176
+	/**
177
+	 * Returns settings for retrieving Matomo statistics for a specific MyArtJaub WelcomeBlock block
178
+	 *
179
+	 * @param int $block_id
180
+	 * @return array<string, mixed>
181
+	 */
182
+	public function matomoSettings(int $block_id): array
183
+	{
184
+		return [
185
+			'matomo_enabled' => $this->isMatomoEnabled($block_id),
186
+			'matomo_url' => $this->getBlockSetting($block_id, 'matomo_url'),
187
+			'matomo_token' => $this->getBlockSetting($block_id, 'matomo_token'),
188
+			'matomo_siteid'  => (int) $this->getBlockSetting($block_id, 'matomo_siteid', '0')
189
+		];
190
+	}
191 191
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function loadRoutes(Map $router): void
63 63
     {
64
-        $router->attach('', '', static function (Map $router): void {
64
+        $router->attach('', '', static function(Map $router): void {
65 65
 
66
-            $router->attach('', '/module-maj/welcomeblock/{block_id}', static function (Map $router): void {
66
+            $router->attach('', '/module-maj/welcomeblock/{block_id}', static function(Map $router): void {
67 67
                 $router->tokens(['block_id' => '\d+']);
68 68
                 $router->get(MatomoStats::class, '/matomostats', MatomoStats::class);
69 69
             });
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $fab_login_block_view = app(\Fisharebest\Webtrees\Module\LoginBlockModule::class)
92 92
             ->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
93 93
 
94
-        $content = view($this->name() . '::block-embed', [
94
+        $content = view($this->name().'::block-embed', [
95 95
             'block_id'                  =>  $block_id,
96 96
             'fab_welcome_block_view'    =>  $fab_welcome_block_view,
97 97
             'fab_login_block_view'      =>  $fab_login_block_view,
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function editBlockConfiguration(Tree $tree, int $block_id): string
129 129
     {
130
-        return view($this->name() . '::config', $this->matomoSettings($block_id));
130
+        return view($this->name().'::config', $this->matomoSettings($block_id));
131 131
     }
132 132
 
133 133
     /**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void
138 138
     {
139
-        $params = (array) $request->getParsedBody();
139
+        $params = (array)$request->getParsedBody();
140 140
 
141 141
         $matomo_enabled = $params['matomo_enabled'] == 'yes';
142 142
         $this->setBlockSetting($block_id, 'matomo_enabled', $matomo_enabled ? 'yes' : 'no');
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             ->setBlockSetting($block_id, 'matomo_token', trim($params['matomo_token']))
160 160
             ->setBlockSetting($block_id, 'matomo_siteid', $params['matomo_siteid']);
161 161
 
162
-        Registry::cache()->file()->forget($this->name() . '-matomovisits-yearly-' . $block_id);
162
+        Registry::cache()->file()->forget($this->name().'-matomovisits-yearly-'.$block_id);
163 163
     }
164 164
 
165 165
     /**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
             'matomo_enabled' => $this->isMatomoEnabled($block_id),
186 186
             'matomo_url' => $this->getBlockSetting($block_id, 'matomo_url'),
187 187
             'matomo_token' => $this->getBlockSetting($block_id, 'matomo_token'),
188
-            'matomo_siteid'  => (int) $this->getBlockSetting($block_id, 'matomo_siteid', '0')
188
+            'matomo_siteid'  => (int)$this->getBlockSetting($block_id, 'matomo_siteid', '0')
189 189
         ];
190 190
     }
191 191
 }
Please login to merge, or discard this patch.
app/Module/IsSourced/Hooks/IsSourcedStatusHook.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -25,63 +25,63 @@
 block discarded – undo
25 25
  */
26 26
 class IsSourcedStatusHook implements RecordNameTextExtenderInterface
27 27
 {
28
-    private ModuleInterface $module;
29
-    private SourceStatusService $source_status_service;
28
+	private ModuleInterface $module;
29
+	private SourceStatusService $source_status_service;
30 30
 
31
-    /**
32
-     * Constructor for IsSourcedStatusHook
33
-     *
34
-     * @param ModuleInterface $module
35
-     * @param SourceStatusService $source_status_service
36
-     */
37
-    public function __construct(ModuleInterface $module, SourceStatusService $source_status_service)
38
-    {
39
-        $this->module = $module;
40
-        $this->source_status_service = $source_status_service;
41
-    }
31
+	/**
32
+	 * Constructor for IsSourcedStatusHook
33
+	 *
34
+	 * @param ModuleInterface $module
35
+	 * @param SourceStatusService $source_status_service
36
+	 */
37
+	public function __construct(ModuleInterface $module, SourceStatusService $source_status_service)
38
+	{
39
+		$this->module = $module;
40
+		$this->source_status_service = $source_status_service;
41
+	}
42 42
 
43
-    /**
44
-     * {@inheritDoc}
45
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module()
46
-     */
47
-    public function module(): ModuleInterface
48
-    {
49
-        return $this->module;
50
-    }
43
+	/**
44
+	 * {@inheritDoc}
45
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module()
46
+	 */
47
+	public function module(): ModuleInterface
48
+	{
49
+		return $this->module;
50
+	}
51 51
 
52
-    /**
53
-     * {@inheritDoc}
54
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNamePrepend()
55
-     */
56
-    public function recordNamePrepend(GedcomRecord $record, bool $use_long = false, string $size = ''): string
57
-    {
58
-        return '';
59
-    }
52
+	/**
53
+	 * {@inheritDoc}
54
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNamePrepend()
55
+	 */
56
+	public function recordNamePrepend(GedcomRecord $record, bool $use_long = false, string $size = ''): string
57
+	{
58
+		return '';
59
+	}
60 60
 
61
-    /**
62
-     * {@inheritDoc}
63
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNameAppend()
64
-     */
65
-    public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string
66
-    {
67
-        if ($use_long && $record instanceof Individual) {
68
-            return
69
-                view($this->module()->name() . '::icons/source-status', [
70
-                    'module_name' => $this->module()->name(),
71
-                    'source_status' => $this->source_status_service->sourceStatusForRecord($record),
72
-                    'context'  => 'INDI',
73
-                    'size_style' => $size ]) .
74
-                view($this->module()->name() . '::icons/source-status', [
75
-                    'module_name' => $this->module()->name(),
76
-                    'source_status' => $this->source_status_service->sourceStatusForBirth($record),
77
-                    'context'  => 'INDI:BIRT',
78
-                    'size_style' => $size ]) .
79
-                ($record->isDead() ? view($this->module()->name() . '::icons/source-status', [
80
-                    'module_name' => $this->module()->name(),
81
-                    'source_status' => $this->source_status_service->sourceStatusForDeath($record),
82
-                    'context'  => 'INDI:DEAT',
83
-                    'size_style' => $size ]) : '') ;
84
-        }
85
-        return '';
86
-    }
61
+	/**
62
+	 * {@inheritDoc}
63
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNameAppend()
64
+	 */
65
+	public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string
66
+	{
67
+		if ($use_long && $record instanceof Individual) {
68
+			return
69
+				view($this->module()->name() . '::icons/source-status', [
70
+					'module_name' => $this->module()->name(),
71
+					'source_status' => $this->source_status_service->sourceStatusForRecord($record),
72
+					'context'  => 'INDI',
73
+					'size_style' => $size ]) .
74
+				view($this->module()->name() . '::icons/source-status', [
75
+					'module_name' => $this->module()->name(),
76
+					'source_status' => $this->source_status_service->sourceStatusForBirth($record),
77
+					'context'  => 'INDI:BIRT',
78
+					'size_style' => $size ]) .
79
+				($record->isDead() ? view($this->module()->name() . '::icons/source-status', [
80
+					'module_name' => $this->module()->name(),
81
+					'source_status' => $this->source_status_service->sourceStatusForDeath($record),
82
+					'context'  => 'INDI:DEAT',
83
+					'size_style' => $size ]) : '') ;
84
+		}
85
+		return '';
86
+	}
87 87
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -66,21 +66,21 @@
 block discarded – undo
66 66
     {
67 67
         if ($use_long && $record instanceof Individual) {
68 68
             return
69
-                view($this->module()->name() . '::icons/source-status', [
69
+                view($this->module()->name().'::icons/source-status', [
70 70
                     'module_name' => $this->module()->name(),
71 71
                     'source_status' => $this->source_status_service->sourceStatusForRecord($record),
72 72
                     'context'  => 'INDI',
73
-                    'size_style' => $size ]) .
74
-                view($this->module()->name() . '::icons/source-status', [
73
+                    'size_style' => $size]).
74
+                view($this->module()->name().'::icons/source-status', [
75 75
                     'module_name' => $this->module()->name(),
76 76
                     'source_status' => $this->source_status_service->sourceStatusForBirth($record),
77 77
                     'context'  => 'INDI:BIRT',
78
-                    'size_style' => $size ]) .
79
-                ($record->isDead() ? view($this->module()->name() . '::icons/source-status', [
78
+                    'size_style' => $size]).
79
+                ($record->isDead() ? view($this->module()->name().'::icons/source-status', [
80 80
                     'module_name' => $this->module()->name(),
81 81
                     'source_status' => $this->source_status_service->sourceStatusForDeath($record),
82 82
                     'context'  => 'INDI:DEAT',
83
-                    'size_style' => $size ]) : '') ;
83
+                    'size_style' => $size]) : '');
84 84
         }
85 85
         return '';
86 86
     }
Please login to merge, or discard this patch.
app/Module/IsSourced/Hooks/IsSourcedStatusColumnsHook.php 2 patches
Indentation   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -30,183 +30,183 @@
 block discarded – undo
30 30
  * Hook for adding columns with source statuses in datatables.
31 31
  */
32 32
 class IsSourcedStatusColumnsHook implements
33
-    FamilyDatatablesExtenderInterface,
34
-    IndividualDatatablesExtenderInterface,
35
-    SosaFamilyDatatablesExtenderInterface,
36
-    SosaIndividualDatatablesExtenderInterface,
37
-    SosaMissingDatatablesExtenderInterface
33
+	FamilyDatatablesExtenderInterface,
34
+	IndividualDatatablesExtenderInterface,
35
+	SosaFamilyDatatablesExtenderInterface,
36
+	SosaIndividualDatatablesExtenderInterface,
37
+	SosaMissingDatatablesExtenderInterface
38 38
 {
39
-    private ModuleInterface $module;
40
-    private SourceStatusService $source_status_service;
39
+	private ModuleInterface $module;
40
+	private SourceStatusService $source_status_service;
41 41
 
42
-    /**
43
-     * Constructor for IsSourcedStatusColumnsHook
44
-     *
45
-     * @param ModuleInterface $module
46
-     * @param SourceStatusService $source_status_service
47
-     */
48
-    public function __construct(ModuleInterface $module, SourceStatusService $source_status_service)
49
-    {
50
-        $this->module = $module;
51
-        $this->source_status_service = $source_status_service;
52
-    }
42
+	/**
43
+	 * Constructor for IsSourcedStatusColumnsHook
44
+	 *
45
+	 * @param ModuleInterface $module
46
+	 * @param SourceStatusService $source_status_service
47
+	 */
48
+	public function __construct(ModuleInterface $module, SourceStatusService $source_status_service)
49
+	{
50
+		$this->module = $module;
51
+		$this->source_status_service = $source_status_service;
52
+	}
53 53
 
54
-    /**
55
-     * {@inheritDoc}
56
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module()
57
-     */
58
-    public function module(): ModuleInterface
59
-    {
60
-        return $this->module;
61
-    }
54
+	/**
55
+	 * {@inheritDoc}
56
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module()
57
+	 */
58
+	public function module(): ModuleInterface
59
+	{
60
+		return $this->module;
61
+	}
62 62
 
63
-    /**
64
-     * {@inheritDoc}
65
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\IndividualDatatablesExtenderInterface::individualColumns()
66
-     */
67
-    public function individualColumns(iterable $records): array
68
-    {
69
-        $records = collect($records);
70
-        return [
71
-            'issourced' => [
72
-                'birth' => [
73
-                    'position' => 7,
74
-                    'column_def' => [ 'class' => 'text-center' ],
75
-                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
76
-                        'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label())
77
-                    ]),
78
-                    'records' => $records->map(function (Individual $individual): array {
79
-                        $source_status = $this->source_status_service->sourceStatusForBirth($individual);
80
-                        return [
81
-                            'order' => $source_status->order(),
82
-                            'text' => view($this->module()->name() . '::icons/source-status', [
83
-                                'module_name' => $this->module()->name(),
84
-                                'source_status' => $source_status,
85
-                                'context'  => 'INDI:BIRT',
86
-                                'size_style' => '' ])
87
-                        ];
88
-                    })->toArray()
89
-                ],
90
-                'death' => [
91
-                    'position' => 12,
92
-                    'column_def' => [ 'class' => 'text-center' ],
93
-                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
94
-                        'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:DEAT')->label())
95
-                    ]),
96
-                    'records' => $records->map(function (Individual $individual): array {
97
-                        $source_status = $this->source_status_service->sourceStatusForDeath($individual);
98
-                        return $individual->isDead() ? [
99
-                            'order' =>  $source_status->order(),
100
-                            'text' => view($this->module()->name() . '::icons/source-status', [
101
-                                'module_name' => $this->module()->name(),
102
-                                'source_status' => $source_status,
103
-                                'context'  => 'INDI:DEAT',
104
-                                'size_style' => '' ])
105
-                        ] : ['order' => 0, 'text' => ''];
106
-                    })->toArray()
107
-                ]
108
-            ]
109
-        ];
110
-    }
63
+	/**
64
+	 * {@inheritDoc}
65
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\IndividualDatatablesExtenderInterface::individualColumns()
66
+	 */
67
+	public function individualColumns(iterable $records): array
68
+	{
69
+		$records = collect($records);
70
+		return [
71
+			'issourced' => [
72
+				'birth' => [
73
+					'position' => 7,
74
+					'column_def' => [ 'class' => 'text-center' ],
75
+					'th' => view($this->module()->name() . '::components/column-th-issourced', [
76
+						'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label())
77
+					]),
78
+					'records' => $records->map(function (Individual $individual): array {
79
+						$source_status = $this->source_status_service->sourceStatusForBirth($individual);
80
+						return [
81
+							'order' => $source_status->order(),
82
+							'text' => view($this->module()->name() . '::icons/source-status', [
83
+								'module_name' => $this->module()->name(),
84
+								'source_status' => $source_status,
85
+								'context'  => 'INDI:BIRT',
86
+								'size_style' => '' ])
87
+						];
88
+					})->toArray()
89
+				],
90
+				'death' => [
91
+					'position' => 12,
92
+					'column_def' => [ 'class' => 'text-center' ],
93
+					'th' => view($this->module()->name() . '::components/column-th-issourced', [
94
+						'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:DEAT')->label())
95
+					]),
96
+					'records' => $records->map(function (Individual $individual): array {
97
+						$source_status = $this->source_status_service->sourceStatusForDeath($individual);
98
+						return $individual->isDead() ? [
99
+							'order' =>  $source_status->order(),
100
+							'text' => view($this->module()->name() . '::icons/source-status', [
101
+								'module_name' => $this->module()->name(),
102
+								'source_status' => $source_status,
103
+								'context'  => 'INDI:DEAT',
104
+								'size_style' => '' ])
105
+						] : ['order' => 0, 'text' => ''];
106
+					})->toArray()
107
+				]
108
+			]
109
+		];
110
+	}
111 111
 
112
-    /**
113
-     * {@inheritDoc}
114
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\FamilyDatatablesExtenderInterface::familyColumns()
115
-     */
116
-    public function familyColumns(iterable $records): array
117
-    {
118
-        $records = collect($records);
119
-        return [
120
-            'issourced' => [
121
-                'marr' => [
122
-                    'position' => 10,
123
-                    'column_def' => [ 'class' => 'text-center' ],
124
-                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
125
-                        'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('FAM:MARR')->label())
126
-                    ]),
127
-                    'records' => $records->map(function (Family $family): array {
128
-                        $source_status = $this->source_status_service->sourceStatusForMarriage($family);
129
-                        return $family->getMarriage() !== null ? [
130
-                            'order' =>  $source_status->order(),
131
-                            'text' => view($this->module()->name() . '::icons/source-status', [
132
-                                'module_name' => $this->module()->name(),
133
-                                'source_status' => $source_status,
134
-                                'context'  => 'FAM:MARR',
135
-                                'size_style' => '' ])
136
-                        ] : ['order' => 0, 'text' => ''];
137
-                    })->toArray()
138
-                ]
139
-            ]
140
-        ];
141
-    }
112
+	/**
113
+	 * {@inheritDoc}
114
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\FamilyDatatablesExtenderInterface::familyColumns()
115
+	 */
116
+	public function familyColumns(iterable $records): array
117
+	{
118
+		$records = collect($records);
119
+		return [
120
+			'issourced' => [
121
+				'marr' => [
122
+					'position' => 10,
123
+					'column_def' => [ 'class' => 'text-center' ],
124
+					'th' => view($this->module()->name() . '::components/column-th-issourced', [
125
+						'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('FAM:MARR')->label())
126
+					]),
127
+					'records' => $records->map(function (Family $family): array {
128
+						$source_status = $this->source_status_service->sourceStatusForMarriage($family);
129
+						return $family->getMarriage() !== null ? [
130
+							'order' =>  $source_status->order(),
131
+							'text' => view($this->module()->name() . '::icons/source-status', [
132
+								'module_name' => $this->module()->name(),
133
+								'source_status' => $source_status,
134
+								'context'  => 'FAM:MARR',
135
+								'size_style' => '' ])
136
+						] : ['order' => 0, 'text' => ''];
137
+					})->toArray()
138
+				]
139
+			]
140
+		];
141
+	}
142 142
 
143
-    /**
144
-     * {@inheritDoc}
145
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaIndividualDatatablesExtenderInterface::sosaIndividualColumns()
146
-     */
147
-    public function sosaIndividualColumns(iterable $records): array
148
-    {
149
-        $columns = $this->individualColumns($records);
150
-        $columns['issourced']['birth']['position'] = 5;
151
-        $columns['issourced']['death']['position'] = 8;
152
-        return $columns;
153
-    }
143
+	/**
144
+	 * {@inheritDoc}
145
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaIndividualDatatablesExtenderInterface::sosaIndividualColumns()
146
+	 */
147
+	public function sosaIndividualColumns(iterable $records): array
148
+	{
149
+		$columns = $this->individualColumns($records);
150
+		$columns['issourced']['birth']['position'] = 5;
151
+		$columns['issourced']['death']['position'] = 8;
152
+		return $columns;
153
+	}
154 154
 
155
-    /**
156
-     * {@inheritDoc}
157
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaFamilyDatatablesExtenderInterface::sosaFamilyColumns()
158
-     */
159
-    public function sosaFamilyColumns(iterable $records): array
160
-    {
161
-        return $this->familyColumns($records);
162
-    }
155
+	/**
156
+	 * {@inheritDoc}
157
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaFamilyDatatablesExtenderInterface::sosaFamilyColumns()
158
+	 */
159
+	public function sosaFamilyColumns(iterable $records): array
160
+	{
161
+		return $this->familyColumns($records);
162
+	}
163 163
 
164
-    /**
165
-     * {@inheritDoc}
166
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaMissingDatatablesExtenderInterface::sosaMissingColumns()
167
-     */
168
-    public function sosaMissingColumns(iterable $records): array
169
-    {
170
-        $records = collect($records);
171
-        return [
172
-            'issourced' => [
173
-                'indi' => [
174
-                    'position' => 3,
175
-                    'column_def' => [ 'class' => 'text-center' ],
176
-                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
177
-                        'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI')->label())
178
-                    ]),
179
-                    'records' => $records->map(function (Individual $individual): array {
180
-                        $source_status = $this->source_status_service->sourceStatusForRecord($individual);
181
-                        return [
182
-                            'order' => $source_status->order(),
183
-                            'text' => view($this->module()->name() . '::icons/source-status', [
184
-                                'module_name' => $this->module()->name(),
185
-                                'source_status' => $source_status,
186
-                                'context'  => 'INDI',
187
-                                'size_style' => '' ])
188
-                        ];
189
-                    })->toArray()
190
-                ],
191
-                'birth' => [
192
-                    'position' => 7,
193
-                    'column_def' => [ 'class' => 'text-center' ],
194
-                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
195
-                        'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label())
196
-                    ]),
197
-                    'records' => $records->map(function (Individual $individual): array {
198
-                        $source_status = $this->source_status_service->sourceStatusForBirth($individual);
199
-                        return [
200
-                            'order' => $source_status->order(),
201
-                            'text' => view($this->module()->name() . '::icons/source-status', [
202
-                                'module_name' => $this->module()->name(),
203
-                                'source_status' => $source_status,
204
-                                'context'  => 'INDI:BIRT',
205
-                                'size_style' => '' ])
206
-                        ];
207
-                    })->toArray()
208
-                ]
209
-            ]
210
-        ];
211
-    }
164
+	/**
165
+	 * {@inheritDoc}
166
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaMissingDatatablesExtenderInterface::sosaMissingColumns()
167
+	 */
168
+	public function sosaMissingColumns(iterable $records): array
169
+	{
170
+		$records = collect($records);
171
+		return [
172
+			'issourced' => [
173
+				'indi' => [
174
+					'position' => 3,
175
+					'column_def' => [ 'class' => 'text-center' ],
176
+					'th' => view($this->module()->name() . '::components/column-th-issourced', [
177
+						'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI')->label())
178
+					]),
179
+					'records' => $records->map(function (Individual $individual): array {
180
+						$source_status = $this->source_status_service->sourceStatusForRecord($individual);
181
+						return [
182
+							'order' => $source_status->order(),
183
+							'text' => view($this->module()->name() . '::icons/source-status', [
184
+								'module_name' => $this->module()->name(),
185
+								'source_status' => $source_status,
186
+								'context'  => 'INDI',
187
+								'size_style' => '' ])
188
+						];
189
+					})->toArray()
190
+				],
191
+				'birth' => [
192
+					'position' => 7,
193
+					'column_def' => [ 'class' => 'text-center' ],
194
+					'th' => view($this->module()->name() . '::components/column-th-issourced', [
195
+						'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label())
196
+					]),
197
+					'records' => $records->map(function (Individual $individual): array {
198
+						$source_status = $this->source_status_service->sourceStatusForBirth($individual);
199
+						return [
200
+							'order' => $source_status->order(),
201
+							'text' => view($this->module()->name() . '::icons/source-status', [
202
+								'module_name' => $this->module()->name(),
203
+								'source_status' => $source_status,
204
+								'context'  => 'INDI:BIRT',
205
+								'size_style' => '' ])
206
+						];
207
+					})->toArray()
208
+				]
209
+			]
210
+		];
211
+	}
212 212
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -71,37 +71,37 @@  discard block
 block discarded – undo
71 71
             'issourced' => [
72 72
                 'birth' => [
73 73
                     'position' => 7,
74
-                    'column_def' => [ 'class' => 'text-center' ],
75
-                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
74
+                    'column_def' => ['class' => 'text-center'],
75
+                    'th' => view($this->module()->name().'::components/column-th-issourced', [
76 76
                         'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label())
77 77
                     ]),
78
-                    'records' => $records->map(function (Individual $individual): array {
78
+                    'records' => $records->map(function(Individual $individual): array {
79 79
                         $source_status = $this->source_status_service->sourceStatusForBirth($individual);
80 80
                         return [
81 81
                             'order' => $source_status->order(),
82
-                            'text' => view($this->module()->name() . '::icons/source-status', [
82
+                            'text' => view($this->module()->name().'::icons/source-status', [
83 83
                                 'module_name' => $this->module()->name(),
84 84
                                 'source_status' => $source_status,
85 85
                                 'context'  => 'INDI:BIRT',
86
-                                'size_style' => '' ])
86
+                                'size_style' => ''])
87 87
                         ];
88 88
                     })->toArray()
89 89
                 ],
90 90
                 'death' => [
91 91
                     'position' => 12,
92
-                    'column_def' => [ 'class' => 'text-center' ],
93
-                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
92
+                    'column_def' => ['class' => 'text-center'],
93
+                    'th' => view($this->module()->name().'::components/column-th-issourced', [
94 94
                         'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:DEAT')->label())
95 95
                     ]),
96
-                    'records' => $records->map(function (Individual $individual): array {
96
+                    'records' => $records->map(function(Individual $individual): array {
97 97
                         $source_status = $this->source_status_service->sourceStatusForDeath($individual);
98 98
                         return $individual->isDead() ? [
99 99
                             'order' =>  $source_status->order(),
100
-                            'text' => view($this->module()->name() . '::icons/source-status', [
100
+                            'text' => view($this->module()->name().'::icons/source-status', [
101 101
                                 'module_name' => $this->module()->name(),
102 102
                                 'source_status' => $source_status,
103 103
                                 'context'  => 'INDI:DEAT',
104
-                                'size_style' => '' ])
104
+                                'size_style' => ''])
105 105
                         ] : ['order' => 0, 'text' => ''];
106 106
                     })->toArray()
107 107
                 ]
@@ -120,19 +120,19 @@  discard block
 block discarded – undo
120 120
             'issourced' => [
121 121
                 'marr' => [
122 122
                     'position' => 10,
123
-                    'column_def' => [ 'class' => 'text-center' ],
124
-                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
123
+                    'column_def' => ['class' => 'text-center'],
124
+                    'th' => view($this->module()->name().'::components/column-th-issourced', [
125 125
                         'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('FAM:MARR')->label())
126 126
                     ]),
127
-                    'records' => $records->map(function (Family $family): array {
127
+                    'records' => $records->map(function(Family $family): array {
128 128
                         $source_status = $this->source_status_service->sourceStatusForMarriage($family);
129 129
                         return $family->getMarriage() !== null ? [
130 130
                             'order' =>  $source_status->order(),
131
-                            'text' => view($this->module()->name() . '::icons/source-status', [
131
+                            'text' => view($this->module()->name().'::icons/source-status', [
132 132
                                 'module_name' => $this->module()->name(),
133 133
                                 'source_status' => $source_status,
134 134
                                 'context'  => 'FAM:MARR',
135
-                                'size_style' => '' ])
135
+                                'size_style' => ''])
136 136
                         ] : ['order' => 0, 'text' => ''];
137 137
                     })->toArray()
138 138
                 ]
@@ -172,37 +172,37 @@  discard block
 block discarded – undo
172 172
             'issourced' => [
173 173
                 'indi' => [
174 174
                     'position' => 3,
175
-                    'column_def' => [ 'class' => 'text-center' ],
176
-                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
175
+                    'column_def' => ['class' => 'text-center'],
176
+                    'th' => view($this->module()->name().'::components/column-th-issourced', [
177 177
                         'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI')->label())
178 178
                     ]),
179
-                    'records' => $records->map(function (Individual $individual): array {
179
+                    'records' => $records->map(function(Individual $individual): array {
180 180
                         $source_status = $this->source_status_service->sourceStatusForRecord($individual);
181 181
                         return [
182 182
                             'order' => $source_status->order(),
183
-                            'text' => view($this->module()->name() . '::icons/source-status', [
183
+                            'text' => view($this->module()->name().'::icons/source-status', [
184 184
                                 'module_name' => $this->module()->name(),
185 185
                                 'source_status' => $source_status,
186 186
                                 'context'  => 'INDI',
187
-                                'size_style' => '' ])
187
+                                'size_style' => ''])
188 188
                         ];
189 189
                     })->toArray()
190 190
                 ],
191 191
                 'birth' => [
192 192
                     'position' => 7,
193
-                    'column_def' => [ 'class' => 'text-center' ],
194
-                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
193
+                    'column_def' => ['class' => 'text-center'],
194
+                    'th' => view($this->module()->name().'::components/column-th-issourced', [
195 195
                         'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label())
196 196
                     ]),
197
-                    'records' => $records->map(function (Individual $individual): array {
197
+                    'records' => $records->map(function(Individual $individual): array {
198 198
                         $source_status = $this->source_status_service->sourceStatusForBirth($individual);
199 199
                         return [
200 200
                             'order' => $source_status->order(),
201
-                            'text' => view($this->module()->name() . '::icons/source-status', [
201
+                            'text' => view($this->module()->name().'::icons/source-status', [
202 202
                                 'module_name' => $this->module()->name(),
203 203
                                 'source_status' => $source_status,
204 204
                                 'context'  => 'INDI:BIRT',
205
-                                'size_style' => '' ])
205
+                                'size_style' => ''])
206 206
                         ];
207 207
                     })->toArray()
208 208
                 ]
Please login to merge, or discard this patch.
app/Module/IsSourced/Data/SourceStatus.php 2 patches
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -22,148 +22,148 @@
 block discarded – undo
22 22
  */
23 23
 class SourceStatus
24 24
 {
25
-    /**
26
-     * @var boolean $source_exist
27
-     */
28
-    private $source_exist = false;
29
-
30
-    /**
31
-     * @var boolean $has_document
32
-     */
33
-    private $has_document = false;
34
-
35
-    /**
36
-     * Return whether the SourceStatus object contains relevant data.
37
-     *
38
-     * @return bool
39
-     */
40
-    public function isSet(): bool
41
-    {
42
-        return true;
43
-    }
44
-
45
-    /**
46
-     * Returns whether the record contains a source.
47
-     *
48
-     * @return bool
49
-     */
50
-    public function hasSource(): bool
51
-    {
52
-        return $this->source_exist;
53
-    }
54
-
55
-    /**
56
-     *  Set whether the record contains a source.
57
-     *
58
-     * @param bool $source_exist
59
-     * @return $this
60
-     */
61
-    public function setHasSource(bool $source_exist): self
62
-    {
63
-        $this->source_exist = $source_exist;
64
-        return $this;
65
-    }
66
-
67
-    /**
68
-     * Combine whether the record contains a source with the previous status.
69
-     *
70
-     * @param bool $source_exist
71
-     * @return $this
72
-     */
73
-    public function addHasSource(bool $source_exist): self
74
-    {
75
-        $this->source_exist = $this->source_exist || $source_exist;
76
-        return $this;
77
-    }
78
-
79
-    /**
80
-     * Return whether the source citation is supported by a document.
81
-     * Uses the _ACT tag from the MyArtJaub Certificates module.
82
-     *
83
-     * @return bool
84
-     */
85
-    public function hasSupportingDocument(): bool
86
-    {
87
-        return $this->hasSource() && $this->has_document;
88
-    }
89
-
90
-    /**
91
-     * Set whether the source citation is supported by a document.
92
-     *
93
-     * @param bool $has_document
94
-     * @return $this
95
-     */
96
-    public function setHasSupportingDocument(bool $has_document): self
97
-    {
98
-        $this->has_document = $has_document;
99
-        return $this;
100
-    }
101
-
102
-    /**
103
-     * Combine whether the source citation is supported by a document with the previous status.
104
-     *
105
-     * @param bool $has_document
106
-     * @return $this
107
-     */
108
-    public function addHasSupportingDocument(bool $has_document): self
109
-    {
110
-        $this->has_document = $this->has_document || $has_document;
111
-        return $this;
112
-    }
113
-
114
-    /**
115
-     * Check whether all possible criteria for defining a sourced element have been met.
116
-     *
117
-     * @return bool
118
-     */
119
-    public function isFullySourced(): bool
120
-    {
121
-        return $this->hasSupportingDocument();
122
-    }
123
-
124
-    /**
125
-     * Get the label to display to describe the source status.
126
-     *
127
-     * @param string $context
128
-     * @return string
129
-     */
130
-    public function label(string $context): string
131
-    {
132
-        $context_label = Registry::elementFactory()->make($context)->label();
133
-
134
-        if (!$this->hasSource()) {
135
-            return I18N::translate('%s not sourced', $context_label);
136
-        }
137
-
138
-        if ($this->hasSupportingDocument()) {
139
-            return I18N::translate('%s sourced with a certificate', $context_label);
140
-        }
141
-
142
-        return I18N::translate('%s sourced', $context_label);
143
-    }
144
-
145
-    /**
146
-     * Get an indicative value to order source statuses
147
-     *
148
-     * @return int
149
-     */
150
-    public function order(): int
151
-    {
152
-        return ($this->hasSource() ? 1 : 0)  * (1 + ($this->hasSupportingDocument() ? 1 : 0));
153
-    }
154
-
155
-    /**
156
-     * Return an element combining properties of the current object with another SourceStatus.
157
-     * Do not use the initial object anymore, it may not appropriately describe the status anymore.
158
-     *
159
-     * @template T of SourceStatus
160
-     * @param T $other
161
-     * @return $this|T
162
-     */
163
-    public function combineWith(SourceStatus $other)
164
-    {
165
-        $this->addHasSource($other->hasSource());
166
-        $this->addHasSupportingDocument($other->hasSource());
167
-        return $this;
168
-    }
25
+	/**
26
+	 * @var boolean $source_exist
27
+	 */
28
+	private $source_exist = false;
29
+
30
+	/**
31
+	 * @var boolean $has_document
32
+	 */
33
+	private $has_document = false;
34
+
35
+	/**
36
+	 * Return whether the SourceStatus object contains relevant data.
37
+	 *
38
+	 * @return bool
39
+	 */
40
+	public function isSet(): bool
41
+	{
42
+		return true;
43
+	}
44
+
45
+	/**
46
+	 * Returns whether the record contains a source.
47
+	 *
48
+	 * @return bool
49
+	 */
50
+	public function hasSource(): bool
51
+	{
52
+		return $this->source_exist;
53
+	}
54
+
55
+	/**
56
+	 *  Set whether the record contains a source.
57
+	 *
58
+	 * @param bool $source_exist
59
+	 * @return $this
60
+	 */
61
+	public function setHasSource(bool $source_exist): self
62
+	{
63
+		$this->source_exist = $source_exist;
64
+		return $this;
65
+	}
66
+
67
+	/**
68
+	 * Combine whether the record contains a source with the previous status.
69
+	 *
70
+	 * @param bool $source_exist
71
+	 * @return $this
72
+	 */
73
+	public function addHasSource(bool $source_exist): self
74
+	{
75
+		$this->source_exist = $this->source_exist || $source_exist;
76
+		return $this;
77
+	}
78
+
79
+	/**
80
+	 * Return whether the source citation is supported by a document.
81
+	 * Uses the _ACT tag from the MyArtJaub Certificates module.
82
+	 *
83
+	 * @return bool
84
+	 */
85
+	public function hasSupportingDocument(): bool
86
+	{
87
+		return $this->hasSource() && $this->has_document;
88
+	}
89
+
90
+	/**
91
+	 * Set whether the source citation is supported by a document.
92
+	 *
93
+	 * @param bool $has_document
94
+	 * @return $this
95
+	 */
96
+	public function setHasSupportingDocument(bool $has_document): self
97
+	{
98
+		$this->has_document = $has_document;
99
+		return $this;
100
+	}
101
+
102
+	/**
103
+	 * Combine whether the source citation is supported by a document with the previous status.
104
+	 *
105
+	 * @param bool $has_document
106
+	 * @return $this
107
+	 */
108
+	public function addHasSupportingDocument(bool $has_document): self
109
+	{
110
+		$this->has_document = $this->has_document || $has_document;
111
+		return $this;
112
+	}
113
+
114
+	/**
115
+	 * Check whether all possible criteria for defining a sourced element have been met.
116
+	 *
117
+	 * @return bool
118
+	 */
119
+	public function isFullySourced(): bool
120
+	{
121
+		return $this->hasSupportingDocument();
122
+	}
123
+
124
+	/**
125
+	 * Get the label to display to describe the source status.
126
+	 *
127
+	 * @param string $context
128
+	 * @return string
129
+	 */
130
+	public function label(string $context): string
131
+	{
132
+		$context_label = Registry::elementFactory()->make($context)->label();
133
+
134
+		if (!$this->hasSource()) {
135
+			return I18N::translate('%s not sourced', $context_label);
136
+		}
137
+
138
+		if ($this->hasSupportingDocument()) {
139
+			return I18N::translate('%s sourced with a certificate', $context_label);
140
+		}
141
+
142
+		return I18N::translate('%s sourced', $context_label);
143
+	}
144
+
145
+	/**
146
+	 * Get an indicative value to order source statuses
147
+	 *
148
+	 * @return int
149
+	 */
150
+	public function order(): int
151
+	{
152
+		return ($this->hasSource() ? 1 : 0)  * (1 + ($this->hasSupportingDocument() ? 1 : 0));
153
+	}
154
+
155
+	/**
156
+	 * Return an element combining properties of the current object with another SourceStatus.
157
+	 * Do not use the initial object anymore, it may not appropriately describe the status anymore.
158
+	 *
159
+	 * @template T of SourceStatus
160
+	 * @param T $other
161
+	 * @return $this|T
162
+	 */
163
+	public function combineWith(SourceStatus $other)
164
+	{
165
+		$this->addHasSource($other->hasSource());
166
+		$this->addHasSupportingDocument($other->hasSource());
167
+		return $this;
168
+	}
169 169
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@
 block discarded – undo
149 149
      */
150 150
     public function order(): int
151 151
     {
152
-        return ($this->hasSource() ? 1 : 0)  * (1 + ($this->hasSupportingDocument() ? 1 : 0));
152
+        return ($this->hasSource() ? 1 : 0) * (1 + ($this->hasSupportingDocument() ? 1 : 0));
153 153
     }
154 154
 
155 155
     /**
Please login to merge, or discard this patch.
app/Module/IsSourced/Data/FactSourceStatus.php 2 patches
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -22,231 +22,231 @@
 block discarded – undo
22 22
  */
23 23
 class FactSourceStatus extends SourceStatus
24 24
 {
25
-    /**
26
-     * @var boolean $has_date
27
-     */
28
-    private $has_date = false;
29
-
30
-    /**
31
-     * @var boolean $has_precise_date
32
-     */
33
-    private $has_precise_date = false;
34
-
35
-    /**
36
-     * @var boolean $has_source_date
37
-     */
38
-    private $has_source_date = false;
39
-
40
-    /**
41
-     * @var boolean $source_date_match
42
-     */
43
-    private $source_date_match = false;
44
-
45
-    /**
46
-     * Return whether the fact is dated.
47
-     *
48
-     * @return bool
49
-     */
50
-    public function factHasDate(): bool
51
-    {
52
-        return $this->has_date;
53
-    }
54
-
55
-    /**
56
-     * Set whether the fact is dated.
57
-     *
58
-     * @param bool $has_date
59
-     * @return $this
60
-     */
61
-    public function setFactHasDate(bool $has_date): self
62
-    {
63
-        $this->has_date = $has_date;
64
-        return $this;
65
-    }
66
-
67
-    /**
68
-     * Combinate whether the fact is dated with the previous status.
69
-     *
70
-     * @param bool $has_date
71
-     * @return $this
72
-     */
73
-    public function addFactHasDate(bool $has_date): self
74
-    {
75
-        $this->has_date = $this->has_date || $has_date;
76
-        return $this;
77
-    }
78
-
79
-    /**
80
-     * Return whether the fact is dated with a precise day.
81
-     * Any date modifier will be considered as not precise.
82
-     * A month or year will be considered as not precise.
83
-     *
84
-     * @return bool
85
-     */
86
-    public function factHasPreciseDate(): bool
87
-    {
88
-        return $this->has_date && $this->has_precise_date;
89
-    }
90
-
91
-    /**
92
-     * Set whather the fact is dated with a precise day.
93
-     *
94
-     * @param bool $has_precise_date
95
-     * @return $this
96
-     */
97
-    public function setFactHasPreciseDate(bool $has_precise_date): self
98
-    {
99
-        $this->has_precise_date = $has_precise_date;
100
-        return $this;
101
-    }
102
-
103
-    /**
104
-     * Combine whether the fact is dated with a precise day.
105
-     *
106
-     * @param bool $has_precise_date
107
-     * @return $this
108
-     */
109
-    public function addFactHasPreciseDate(bool $has_precise_date): self
110
-    {
111
-        $this->has_precise_date = $this->has_precise_date || $has_precise_date;
112
-        return $this;
113
-    }
114
-
115
-    /**
116
-     * Return whether the source citation is dated.
117
-     *
118
-     * @return bool
119
-     */
120
-    public function sourceHasDate(): bool
121
-    {
122
-        return $this->has_source_date;
123
-    }
124
-
125
-    /**
126
-     * Set whether the source citation is dated.
127
-     *
128
-     * @param bool $has_source_date
129
-     * @return $this
130
-     */
131
-    public function setSourceHasDate(bool $has_source_date): self
132
-    {
133
-        $this->has_source_date = $has_source_date;
134
-        return $this;
135
-    }
136
-
137
-    /**
138
-     * Combine whether the source citation is dated with the previous status.
139
-     *
140
-     * @param bool $has_source_date
141
-     * @return $this
142
-     */
143
-    public function addSourceHasDate(bool $has_source_date): self
144
-    {
145
-        $this->has_source_date = $this->has_source_date || $has_source_date;
146
-        return $this;
147
-    }
148
-
149
-    /**
150
-     * Return whether the source citation date is close to the fact date.
151
-     *
152
-     * @return bool
153
-     */
154
-    public function sourceMatchesFactDate(): bool
155
-    {
156
-        return $this->has_precise_date && $this->has_source_date && $this->source_date_match;
157
-    }
158
-
159
-    /**
160
-     * Set whether the source citation date is close to the fact date.
161
-     *
162
-     * @param bool $source_date_match
163
-     * @return $this
164
-     */
165
-    public function setSourceMatchesFactDate(bool $source_date_match): self
166
-    {
167
-        $this->source_date_match = $source_date_match;
168
-        return $this;
169
-    }
170
-
171
-    /**
172
-     * Combine whether the source citation date is close to the fact date with the previous status.
173
-     *
174
-     * @param bool $source_date_match
175
-     * @return $this
176
-     */
177
-    public function addSourceMatchesFactDate(bool $source_date_match): self
178
-    {
179
-        $this->source_date_match = $this->source_date_match || $source_date_match;
180
-        return $this;
181
-    }
182
-
183
-    /**
184
-     * {@inheritDoc}
185
-     * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::isFullySourced()
186
-     */
187
-    public function isFullySourced(): bool
188
-    {
189
-        return parent::isFullySourced() && $this->sourceMatchesFactDate();
190
-    }
191
-
192
-    /**
193
-     * {@inheritDoc}
194
-     * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::label()
195
-     */
196
-    public function label(string $context): string
197
-    {
198
-        $context_label = Registry::elementFactory()->make($context)->label();
199
-
200
-        if ($this->factHasPreciseDate()) {
201
-            if ($this->hasSource()) {
202
-                if ($this->hasSupportingDocument()) {
203
-                    if ($this->sourceMatchesFactDate()) {
204
-                        return I18N::translate('%s sourced with exact certificate', $context_label);
205
-                    } else {
206
-                        return I18N::translate('%s sourced with a certificate', $context_label);
207
-                    }
208
-                }
209
-
210
-                if ($this->sourceMatchesFactDate()) {
211
-                    return I18N::translate('%s precisely sourced', $context_label);
212
-                }
213
-                return I18N::translate('%s sourced', $context_label);
214
-            }
215
-            return I18N::translate('%s not sourced', $context_label);
216
-        }
217
-
218
-        if ($this->factHasDate()) {
219
-            return I18N::translate('%s not precise', $context_label);
220
-        }
221
-        return I18N::translate('%s not found', $context_label);
222
-    }
223
-
224
-    /**
225
-     * {@inheritDoc}
226
-     * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::order()
227
-     */
228
-    public function order(): int
229
-    {
230
-        return ($this->factHasDate() ? 1 : 0) * ($this->hasSource() ? 1 : -1) *
231
-            ( 1 + ($this->factHasPreciseDate() ? 1 : 0) * (1 +
232
-                0b010 * ($this->sourceMatchesFactDate() ? 1 : 0) +
233
-                0b100 * ($this->hasSupportingDocument() ? 1 : 0)
234
-            )
235
-        );
236
-    }
237
-
238
-    /**
239
-     * {@inheritDoc}
240
-     * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::combineWith()
241
-     */
242
-    public function combineWith(SourceStatus $other)
243
-    {
244
-        if ($other instanceof FactSourceStatus) {
245
-            $this->addFactHasDate($other->factHasDate());
246
-            $this->addFactHasPreciseDate($other->factHasPreciseDate());
247
-            $this->addSourceHasDate($other->sourceHasDate());
248
-            $this->addSourceMatchesFactDate($other->sourceMatchesFactDate());
249
-        }
250
-        return parent::combineWith($other);
251
-    }
25
+	/**
26
+	 * @var boolean $has_date
27
+	 */
28
+	private $has_date = false;
29
+
30
+	/**
31
+	 * @var boolean $has_precise_date
32
+	 */
33
+	private $has_precise_date = false;
34
+
35
+	/**
36
+	 * @var boolean $has_source_date
37
+	 */
38
+	private $has_source_date = false;
39
+
40
+	/**
41
+	 * @var boolean $source_date_match
42
+	 */
43
+	private $source_date_match = false;
44
+
45
+	/**
46
+	 * Return whether the fact is dated.
47
+	 *
48
+	 * @return bool
49
+	 */
50
+	public function factHasDate(): bool
51
+	{
52
+		return $this->has_date;
53
+	}
54
+
55
+	/**
56
+	 * Set whether the fact is dated.
57
+	 *
58
+	 * @param bool $has_date
59
+	 * @return $this
60
+	 */
61
+	public function setFactHasDate(bool $has_date): self
62
+	{
63
+		$this->has_date = $has_date;
64
+		return $this;
65
+	}
66
+
67
+	/**
68
+	 * Combinate whether the fact is dated with the previous status.
69
+	 *
70
+	 * @param bool $has_date
71
+	 * @return $this
72
+	 */
73
+	public function addFactHasDate(bool $has_date): self
74
+	{
75
+		$this->has_date = $this->has_date || $has_date;
76
+		return $this;
77
+	}
78
+
79
+	/**
80
+	 * Return whether the fact is dated with a precise day.
81
+	 * Any date modifier will be considered as not precise.
82
+	 * A month or year will be considered as not precise.
83
+	 *
84
+	 * @return bool
85
+	 */
86
+	public function factHasPreciseDate(): bool
87
+	{
88
+		return $this->has_date && $this->has_precise_date;
89
+	}
90
+
91
+	/**
92
+	 * Set whather the fact is dated with a precise day.
93
+	 *
94
+	 * @param bool $has_precise_date
95
+	 * @return $this
96
+	 */
97
+	public function setFactHasPreciseDate(bool $has_precise_date): self
98
+	{
99
+		$this->has_precise_date = $has_precise_date;
100
+		return $this;
101
+	}
102
+
103
+	/**
104
+	 * Combine whether the fact is dated with a precise day.
105
+	 *
106
+	 * @param bool $has_precise_date
107
+	 * @return $this
108
+	 */
109
+	public function addFactHasPreciseDate(bool $has_precise_date): self
110
+	{
111
+		$this->has_precise_date = $this->has_precise_date || $has_precise_date;
112
+		return $this;
113
+	}
114
+
115
+	/**
116
+	 * Return whether the source citation is dated.
117
+	 *
118
+	 * @return bool
119
+	 */
120
+	public function sourceHasDate(): bool
121
+	{
122
+		return $this->has_source_date;
123
+	}
124
+
125
+	/**
126
+	 * Set whether the source citation is dated.
127
+	 *
128
+	 * @param bool $has_source_date
129
+	 * @return $this
130
+	 */
131
+	public function setSourceHasDate(bool $has_source_date): self
132
+	{
133
+		$this->has_source_date = $has_source_date;
134
+		return $this;
135
+	}
136
+
137
+	/**
138
+	 * Combine whether the source citation is dated with the previous status.
139
+	 *
140
+	 * @param bool $has_source_date
141
+	 * @return $this
142
+	 */
143
+	public function addSourceHasDate(bool $has_source_date): self
144
+	{
145
+		$this->has_source_date = $this->has_source_date || $has_source_date;
146
+		return $this;
147
+	}
148
+
149
+	/**
150
+	 * Return whether the source citation date is close to the fact date.
151
+	 *
152
+	 * @return bool
153
+	 */
154
+	public function sourceMatchesFactDate(): bool
155
+	{
156
+		return $this->has_precise_date && $this->has_source_date && $this->source_date_match;
157
+	}
158
+
159
+	/**
160
+	 * Set whether the source citation date is close to the fact date.
161
+	 *
162
+	 * @param bool $source_date_match
163
+	 * @return $this
164
+	 */
165
+	public function setSourceMatchesFactDate(bool $source_date_match): self
166
+	{
167
+		$this->source_date_match = $source_date_match;
168
+		return $this;
169
+	}
170
+
171
+	/**
172
+	 * Combine whether the source citation date is close to the fact date with the previous status.
173
+	 *
174
+	 * @param bool $source_date_match
175
+	 * @return $this
176
+	 */
177
+	public function addSourceMatchesFactDate(bool $source_date_match): self
178
+	{
179
+		$this->source_date_match = $this->source_date_match || $source_date_match;
180
+		return $this;
181
+	}
182
+
183
+	/**
184
+	 * {@inheritDoc}
185
+	 * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::isFullySourced()
186
+	 */
187
+	public function isFullySourced(): bool
188
+	{
189
+		return parent::isFullySourced() && $this->sourceMatchesFactDate();
190
+	}
191
+
192
+	/**
193
+	 * {@inheritDoc}
194
+	 * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::label()
195
+	 */
196
+	public function label(string $context): string
197
+	{
198
+		$context_label = Registry::elementFactory()->make($context)->label();
199
+
200
+		if ($this->factHasPreciseDate()) {
201
+			if ($this->hasSource()) {
202
+				if ($this->hasSupportingDocument()) {
203
+					if ($this->sourceMatchesFactDate()) {
204
+						return I18N::translate('%s sourced with exact certificate', $context_label);
205
+					} else {
206
+						return I18N::translate('%s sourced with a certificate', $context_label);
207
+					}
208
+				}
209
+
210
+				if ($this->sourceMatchesFactDate()) {
211
+					return I18N::translate('%s precisely sourced', $context_label);
212
+				}
213
+				return I18N::translate('%s sourced', $context_label);
214
+			}
215
+			return I18N::translate('%s not sourced', $context_label);
216
+		}
217
+
218
+		if ($this->factHasDate()) {
219
+			return I18N::translate('%s not precise', $context_label);
220
+		}
221
+		return I18N::translate('%s not found', $context_label);
222
+	}
223
+
224
+	/**
225
+	 * {@inheritDoc}
226
+	 * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::order()
227
+	 */
228
+	public function order(): int
229
+	{
230
+		return ($this->factHasDate() ? 1 : 0) * ($this->hasSource() ? 1 : -1) *
231
+			( 1 + ($this->factHasPreciseDate() ? 1 : 0) * (1 +
232
+				0b010 * ($this->sourceMatchesFactDate() ? 1 : 0) +
233
+				0b100 * ($this->hasSupportingDocument() ? 1 : 0)
234
+			)
235
+		);
236
+	}
237
+
238
+	/**
239
+	 * {@inheritDoc}
240
+	 * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::combineWith()
241
+	 */
242
+	public function combineWith(SourceStatus $other)
243
+	{
244
+		if ($other instanceof FactSourceStatus) {
245
+			$this->addFactHasDate($other->factHasDate());
246
+			$this->addFactHasPreciseDate($other->factHasPreciseDate());
247
+			$this->addSourceHasDate($other->sourceHasDate());
248
+			$this->addSourceMatchesFactDate($other->sourceMatchesFactDate());
249
+		}
250
+		return parent::combineWith($other);
251
+	}
252 252
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@
 block discarded – undo
228 228
     public function order(): int
229 229
     {
230 230
         return ($this->factHasDate() ? 1 : 0) * ($this->hasSource() ? 1 : -1) *
231
-            ( 1 + ($this->factHasPreciseDate() ? 1 : 0) * (1 +
231
+            (1 + ($this->factHasPreciseDate() ? 1 : 0) * (1 +
232 232
                 0b010 * ($this->sourceMatchesFactDate() ? 1 : 0) +
233 233
                 0b100 * ($this->hasSupportingDocument() ? 1 : 0)
234 234
             )
Please login to merge, or discard this patch.
app/Module/IsSourced/Data/NullFactSourceStatus.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@
 block discarded – undo
19 19
  */
20 20
 class NullFactSourceStatus extends FactSourceStatus
21 21
 {
22
-    /**
23
-     * {@inheritDoc}
24
-     * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::isSet()
25
-     */
26
-    public function isSet(): bool
27
-    {
28
-        return false;
29
-    }
22
+	/**
23
+	 * {@inheritDoc}
24
+	 * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::isSet()
25
+	 */
26
+	public function isSet(): bool
27
+	{
28
+		return false;
29
+	}
30 30
 
31
-    /**
32
-     * {@inheritDoc}
33
-     * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\FactSourceStatus::combineWith()
34
-     */
35
-    public function combineWith(SourceStatus $other)
36
-    {
37
-        return $other;
38
-    }
31
+	/**
32
+	 * {@inheritDoc}
33
+	 * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\FactSourceStatus::combineWith()
34
+	 */
35
+	public function combineWith(SourceStatus $other)
36
+	{
37
+		return $other;
38
+	}
39 39
 }
Please login to merge, or discard this patch.