<?php
require_once 'CommandInterface.php';

class 
Command implements CommandInterface
{
    public function 
execute(Context $context)
    {
        
$currentCommand $context->getCurrentCommand();
        if (
$currentCommand === 'diskspace') {
            
$path      './';

            
$freeSize disk_free_space('./');
            
$maxSize  disk_total_space('./');

            
$ratio $freeSize $maxSize 100;

            echo 
sprintf('Disk Free : %5.1dMB(%3d%%)<br />'$freeSize 1024 1024$ratio);
        } elseif (
$currentCommand === 'date') {
            echo 
date('Y/m/d H:i:s') . '<br />';
        } elseif (
$currentCommand === 'line') {
            echo 
'----------<br />';
        } else {
            throw new 
RuntimeException('Invalid command [' $currentCommand '].');
        }
    }
}