Skip to content

Commit d2ff77c

Browse files
Remove &$same_wide_width param (#18234)
* Remove $same_wide_width in Eps Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Remove $same_wide_width in Svg Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> --------- Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent 529119c commit d2ff77c

4 files changed

Lines changed: 26 additions & 39 deletions

File tree

libraries/classes/Plugins/Schema/Eps/EpsRelationSchema.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use function __;
1515
use function date;
1616
use function in_array;
17+
use function max;
1718
use function sprintf;
1819

1920
/**
@@ -78,11 +79,11 @@ public function __construct(DatabaseName $db)
7879
$this->diagram->getFont(),
7980
$this->diagram->getFontSize(),
8081
$this->pageNumber,
81-
$this->tablewidth,
8282
$this->showKeys,
8383
$this->tableDimension,
8484
$this->offline,
8585
);
86+
$this->tablewidth = max($this->tablewidth, $this->tables[$table]->width);
8687
}
8788

8889
if (! $this->sameWide) {
@@ -188,10 +189,10 @@ private function addRelation(
188189
$font,
189190
$fontSize,
190191
$this->pageNumber,
191-
$this->tablewidth,
192192
false,
193193
$tableDimension,
194194
);
195+
$this->tablewidth = max($this->tablewidth, $this->tables[$masterTable]->width);
195196
}
196197

197198
if (! isset($this->tables[$foreignTable])) {
@@ -202,10 +203,10 @@ private function addRelation(
202203
$font,
203204
$fontSize,
204205
$this->pageNumber,
205-
$this->tablewidth,
206206
false,
207207
$tableDimension,
208208
);
209+
$this->tablewidth = max($this->tablewidth, $this->tables[$foreignTable]->width);
209210
}
210211

211212
$this->relations[] = new RelationStatsEps(

libraries/classes/Plugins/Schema/Eps/TableStatsEps.php

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,16 @@ class TableStatsEps extends TableStats
3636
* @see TableStatsEps::setWidthTable
3737
* @see TableStatsEps::setHeightTable
3838
*
39-
* @param Eps $diagram The EPS diagram
40-
* @param string $db The database name
41-
* @param string $tableName The table name
42-
* @param string $font The font name
43-
* @param int $fontSize The font size
44-
* @param int $pageNumber Page number
45-
* @param int|float $same_wide_width The max width among tables
46-
* @param bool $showKeys Whether to display keys or not
47-
* @param bool $tableDimension Whether to display table position or not
48-
* @param bool $offline Whether the coordinates are sent
49-
* from the browser
39+
* @param Eps $diagram The EPS diagram
40+
* @param string $db The database name
41+
* @param string $tableName The table name
42+
* @param string $font The font name
43+
* @param int $fontSize The font size
44+
* @param int $pageNumber Page number
45+
* @param bool $showKeys Whether to display keys or not
46+
* @param bool $tableDimension Whether to display table position or not
47+
* @param bool $offline Whether the coordinates are sent
48+
* from the browser
5049
*/
5150
public function __construct(
5251
$diagram,
@@ -55,7 +54,6 @@ public function __construct(
5554
$font,
5655
$fontSize,
5756
$pageNumber,
58-
&$same_wide_width,
5957
$showKeys = false,
6058
$tableDimension = false,
6159
$offline = false,
@@ -67,11 +65,6 @@ public function __construct(
6765
// setWidth must me after setHeight, because title
6866
// can include table height which changes table width
6967
$this->setWidthTable($font, $fontSize);
70-
if ($same_wide_width >= $this->width) {
71-
return;
72-
}
73-
74-
$same_wide_width = $this->width;
7568
}
7669

7770
/**

libraries/classes/Plugins/Schema/Svg/SvgRelationSchema.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ public function __construct(DatabaseName $db)
8989
$this->diagram->getFont(),
9090
$this->diagram->getFontSize(),
9191
$this->pageNumber,
92-
$this->tablewidth,
9392
$this->showKeys,
9493
$this->tableDimension,
9594
$this->offline,
9695
);
96+
$this->tablewidth = max($this->tablewidth, $this->tables[$table]->width);
9797
}
9898

9999
if ($this->sameWide) {
@@ -219,10 +219,10 @@ private function addRelation(
219219
$font,
220220
$fontSize,
221221
$this->pageNumber,
222-
$this->tablewidth,
223222
false,
224223
$tableDimension,
225224
);
225+
$this->tablewidth = max($this->tablewidth, $this->tables[$masterTable]->width);
226226
$this->setMinMax($this->tables[$masterTable]);
227227
}
228228

@@ -234,10 +234,10 @@ private function addRelation(
234234
$font,
235235
$fontSize,
236236
$this->pageNumber,
237-
$this->tablewidth,
238237
false,
239238
$tableDimension,
240239
);
240+
$this->tablewidth = max($this->tablewidth, $this->tables[$foreignTable]->width);
241241
$this->setMinMax($this->tables[$foreignTable]);
242242
}
243243

libraries/classes/Plugins/Schema/Svg/TableStatsSvg.php

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,15 @@ class TableStatsSvg extends TableStats
3737
* @see TableStatsSvg::setWidthTable
3838
* @see TableStatsSvg::setHeightTable
3939
*
40-
* @param Svg $diagram The current SVG image document
41-
* @param string $db The database name
42-
* @param string $tableName The table name
43-
* @param string $font Font face
44-
* @param int $fontSize The font size
45-
* @param int $pageNumber Page number
46-
* @param int|float $same_wide_width The max. width among tables
47-
* @param bool $showKeys Whether to display keys or not
48-
* @param bool $tableDimension Whether to display table position or not
49-
* @param bool $offline Whether the coordinates are sent
40+
* @param Svg $diagram The current SVG image document
41+
* @param string $db The database name
42+
* @param string $tableName The table name
43+
* @param string $font Font face
44+
* @param int $fontSize The font size
45+
* @param int $pageNumber Page number
46+
* @param bool $showKeys Whether to display keys or not
47+
* @param bool $tableDimension Whether to display table position or not
48+
* @param bool $offline Whether the coordinates are sent
5049
*/
5150
public function __construct(
5251
$diagram,
@@ -55,7 +54,6 @@ public function __construct(
5554
$font,
5655
$fontSize,
5756
$pageNumber,
58-
&$same_wide_width,
5957
$showKeys = false,
6058
$tableDimension = false,
6159
$offline = false,
@@ -67,11 +65,6 @@ public function __construct(
6765
// setWidth must me after setHeight, because title
6866
// can include table height which changes table width
6967
$this->setWidthTable($font, $fontSize);
70-
if ($same_wide_width >= $this->width) {
71-
return;
72-
}
73-
74-
$same_wide_width = $this->width;
7568
}
7669

7770
/**

0 commit comments

Comments
 (0)