Duda:
¿Cómo puedo llamar a $thiss->line dentro del metodo view();? El objetivo es ver cada linea.
Ej.
Código PHP:
Ver original
public function view() { return $this->line; }
Código PHP:
<?php
class file {
private $path;
private $file;
private $finalpath;
private $line;
public function __construct($ruta, $filename) {
$this->path = $ruta;
$this->file = $filename;
$this->finalpath = $this->path . "/" . $this->file;
}
public function read() {
if (is_dir($this->path) && is_file($this->finalpath)) {
return file($this->finalpath);
}
return false;
}
public function walk() {
if (is_array($this->read())) {
foreach ($this->read() as $value) {
$this->line .= $value;
}
return $this->line;
}
}
public function view() {
return $this->walk();
}
}
?>