PHP code example of feriatos / sigma-test-task

1. Go to this page and download the library: Download feriatos/sigma-test-task library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

feriatos / sigma-test-task example snippets


$pricing = new OneTierPricing();
$pricing->addProduct(new OneTierProduct('ZA', 2, 7, 4));
$pricing->addProduct(new OneTierProduct('YB', 12));
$pricing->addProduct(new OneTierProduct('FC', 1.25, 6, 6));
$pricing->addProduct(new OneTierProduct('GD', 0.15));

$terminal = new POSTerminal();
$terminal->setPricing($pricing);

$terminal->scanItem('ZA');
$terminal->scanItem('YB');
$terminal->scanItem('FC');
$terminal->scanItem('GD');
$terminal->scanItem('ZA');
$terminal->scanItem('YB');
$terminal->scanItem('ZA');
$terminal->scanItem('ZA');

$totalPrice = $terminal->getTotal();

$terminal->resetItems();