Skip to content

Commit 2852b27

Browse files
Remove some dead code (#163)
1 parent 8428f31 commit 2852b27

File tree

20 files changed

+23
-43
lines changed

20 files changed

+23
-43
lines changed

phpdotnet/phd/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public static function setColor_output($color_output)
173173
self::$optionArray['color_output'] = $color_output;
174174
}
175175

176-
public static function set_color_output($color_output)
176+
public static function set_color_output()
177177
{
178178
trigger_error('Use setColor_output()', E_USER_DEPRECATED);
179179
}

phpdotnet/phd/Format.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ public function getFormatName() {
312312

313313
/* Buffer where append data instead of the standard stream (see format's appendData()) */
314314
final public function parse($xml) {
315-
$parsed = "";
316315
$reader = new Reader();
317316
$render = new Render();
318317

@@ -468,7 +467,7 @@ public function initRow() {
468467
}
469468
public function getEntryOffset(array $attrs) {
470469
$curr = $this->TABLE["next_colnum"];
471-
foreach($this->TABLE["colspec"] as $col => $spec) {
470+
foreach($this->TABLE["colspec"] as $spec) {
472471
if ($spec["colname"] == $attrs["colname"]) {
473472
$colnum = $spec["colnum"];
474473
$this->TABLE["next_colnum"] += $colnum-$curr;
@@ -479,7 +478,7 @@ public function getEntryOffset(array $attrs) {
479478
}
480479
public function colspan(array $attrs) {
481480
if (isset($attrs["namest"])) {
482-
foreach($this->TABLE["colspec"] as $colnum => $spec) {
481+
foreach($this->TABLE["colspec"] as $spec) {
483482
if ($spec["colname"] == $attrs["namest"]) {
484483
$from = $spec["colnum"];
485484
continue;

phpdotnet/phd/Format/Abstract/PDF.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ class PdfWriter {
7979
const LINE_SPACING = 2; // nb of points between two lines
8080
const INDENT_SPACING = 10; // nb of points for indent
8181
const DEFAULT_SHIFT = 20; // default value (points) for shifted paragraph
82-
private $SCALE; // nb of points for 1 centimeter
8382
private $PAGE_WIDTH; // in points
8483
private $PAGE_HEIGHT; // in points
8584

@@ -94,7 +93,6 @@ class PdfWriter {
9493
private $currentFontColor;
9594
private $fonts;
9695
private $oldFonts = array();
97-
private $text;
9896

9997
private $vOffset = 0;
10098
private $hOffset = 0;
@@ -142,9 +140,9 @@ function __construct($pageWidth = 210, $pageHeight = 297, Config $config) {
142140
$this->haruDoc->setPagesConfiguration(2);
143141

144142
// Page format
145-
$this->SCALE = 72/25.4;
146-
$this->PAGE_WIDTH = $pageWidth * $this->SCALE;
147-
$this->PAGE_HEIGHT = $pageHeight * $this->SCALE;
143+
$scale = 72/25.4;
144+
$this->PAGE_WIDTH = $pageWidth * $scale;
145+
$this->PAGE_HEIGHT = $pageHeight * $scale;
148146

149147
// Set fonts
150148
$this->fonts["Helvetica"] = $this->haruDoc->getFont("Helvetica", "WinAnsiEncoding");

phpdotnet/phd/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public function format_chunk($open, $name, $attrs, $props) {
343343
return false;
344344
}
345345
if (array_pop($this->isChunk)) {
346-
$lastchunk = array_pop($this->chunks);
346+
array_pop($this->chunks);
347347
$this->currentchunk = end($this->chunks);
348348
$this->appendID();
349349
}

phpdotnet/phd/MediaManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function findFile($filename, $allowfallback = true)
127127
);
128128

129129
$foundfile = false;
130-
foreach($sourcefilenames as $pathoffset => $filenameinfo) {
130+
foreach($sourcefilenames as $filenameinfo) {
131131
// Look for current language specific file.
132132
if (file_exists($testingfile = $this->relative_source_path . $filenameinfo[0] . $filenameinfo[1])) {
133133
$foundfile = $testingfile;

phpdotnet/phd/Options/Handler.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function option_f(string $k, mixed $v): array
7474
public function option_format(string $k, mixed $v): array
7575
{
7676
$formats = [];
77-
foreach((array)$v as $i => $val) {
77+
foreach((array)$v as $val) {
7878
if (!in_array($val, $formats)) {
7979
$formats[] = $val;
8080
}
@@ -319,7 +319,7 @@ public function option_s(string $k, mixed $v): array
319319
public function option_skip(string $k, mixed $v): array
320320
{
321321
$skip_ids = $this->config->skip_ids();
322-
foreach((array)$v as $i => $val) {
322+
foreach((array)$v as $val) {
323323
$recursive = true;
324324
if (strpos($val, "=") !== false) {
325325
list($val, $recursive) = explode("=", $val);
@@ -370,7 +370,7 @@ public function option_verbose(string $k, mixed $v): array
370370
{
371371
static $verbose = 0;
372372

373-
foreach((array)$v as $i => $val) {
373+
foreach((array)$v as $val) {
374374
foreach(explode("|", $val) as $const) {
375375
if (defined($const)) {
376376
$verbose |= (int)constant($const);
@@ -452,7 +452,7 @@ public function option_color(string $k, mixed $v): array
452452
public function option_css(string $k, mixed $v): array
453453
{
454454
$styles = [];
455-
foreach((array)$v as $key => $val) {
455+
foreach((array)$v as $val) {
456456
if (!in_array($val, $styles)) {
457457
$styles[] = $val;
458458
}
@@ -474,7 +474,7 @@ public function option_k(string $k, mixed $v): array
474474
public function option_packagedir(string $k, mixed $v): array
475475
{
476476
$packages = $this->config->package_dirs();
477-
foreach((array)$v as $key => $val) {
477+
foreach((array)$v as $val) {
478478
if ($path = realpath($val)) {
479479
if (!in_array($path, $packages)) {
480480
$packages[] = $path;

phpdotnet/phd/PI/PHPDOCHandler.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public function parse($target, $data) {
2626
case "function":
2727
case "refentry":
2828
$tmp = $this->format->getRefs();
29-
$ret = "";
3029
$refs = array();
3130
$info = array();
3231
foreach($tmp as $id) {

phpdotnet/phd/Package/Generic/PDF.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,6 @@ public function format_entry($open, $name, $attrs, $props) {
771771
if ($open) {
772772
$dbattrs = Format::getColspec($attrs[Reader::XMLNS_DOCBOOK]);
773773
$align = (isset($dbattrs["align"]) ? $dbattrs["align"] : $align);
774-
$retval = "";
775774
if (isset($dbattrs["colname"])) {
776775
for($i=Format::getEntryOffset($dbattrs); $i>0; --$i) {
777776
$this->pdfDoc->add(PdfWriter::TABLE_ENTRY, array(1, 1, $align));
@@ -995,7 +994,6 @@ public function format_initializer($open, $name, $attrs) {
995994
public function format_footnoteref($open, $name, $attrs, $props) {
996995
if ($open) {
997996
$linkend = $attrs[Reader::XMLNS_DOCBOOK]["linkend"];
998-
$found = false;
999997
foreach($this->cchunk["footnote"] as $k => $note) {
1000998
if ($note["id"] === $linkend) {
1001999
$this->pdfDoc->setFont(PdfWriter::FONT_NORMAL, 12, array(0,0,1));
@@ -1031,7 +1029,7 @@ public function format_footnote($open, $name, $attrs, $props) {
10311029
}
10321030

10331031
public function format_co($open, $name, $attrs, $props) {
1034-
if (($open || $props["empty"]) && isset($attrs[Reader::XMLNS_XML]["id"]) && $id = $attrs[Reader::XMLNS_XML]["id"]) {
1032+
if (($open || $props["empty"]) && isset($attrs[Reader::XMLNS_XML]["id"]) && $attrs[Reader::XMLNS_XML]["id"]) {
10351033
$co = ++$this->cchunk["co"];
10361034
$this->pdfDoc->setFont(PdfWriter::FONT_NORMAL, 12, array(0,0,1));
10371035
if (isset($attrs[Reader::XMLNS_DOCBOOK]["linkends"]) && $linkends = $attrs[Reader::XMLNS_DOCBOOK]["linkends"]) {

phpdotnet/phd/Package/Generic/TocFeed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ protected function createAtomToc($id)
357357

358358
$toc = '';
359359
$date = $this->date;
360-
foreach ($chunks as $junk => $chunkid) {
360+
foreach ($chunks as $chunkid) {
361361
$long = $this->getLongDescription($chunkid);
362362
$short = $this->getShortDescription($chunkid);
363363
$id = $this->idprefix . $chunkid;

phpdotnet/phd/Package/Generic/XHTML.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,6 @@ public function format_suppressed_text($value, $tag) {
676676
}
677677

678678
public function format_link($open, $name, $attrs, $props) {
679-
$link = null;
680679
if ($open) {
681680
$link = $class = $content = "";
682681

@@ -855,7 +854,6 @@ public function format_container_chunk_below($open, $name, $attrs, $props) {
855854
}
856855

857856
$toc = '<ol>';
858-
$desc = "";
859857
if (!in_array($id, $this->TOC_WRITTEN ?? [])) {
860858
$toc = $this->createTOC($id, $name, $props);
861859
}
@@ -1419,7 +1417,6 @@ public function format_fieldsynopsis_varname($open, $name, $attrs) {
14191417
public function format_footnoteref($open, $name, $attrs, $props) {
14201418
if ($open) {
14211419
$linkend = $attrs[Reader::XMLNS_DOCBOOK]["linkend"];
1422-
$found = false;
14231420
foreach($this->cchunk["footnote"] as $k => $note) {
14241421
if ($note["id"] === $linkend) {
14251422
return '<a href="#fnid' .$note["id"]. '"><sup>[' .($k + 1). ']</sup></a>';

0 commit comments

Comments
 (0)