Example #1
0
File: OCP2.php Project: lk153/SOLID
    }
    function getSent()
    {
        return $this->sent;
    }
    function getRelativePath()
    {
        return dirname($this->filename);
    }
    function getFullPath()
    {
        return realpath($this->getRelativePath());
    }
}
class Progress
{
    private $measurableContent;
    function __construct(Measurable $measurableContent)
    {
        $this->measurableContent = $measurableContent;
    }
    function getAsPercent()
    {
        return $this->measurableContent->getSent() * 100 / $this->measurableContent->getLength();
    }
}
$file = new File();
$file->setLength(200);
$file->setSent(100);
$progress = new Progress($file);
echo $progress->getAsPercent();