Skip to content

Instantly share code, notes, and snippets.

@roderik
Created April 30, 2012 07:21
Show Gist options
  • Save roderik/2556198 to your computer and use it in GitHub Desktop.
Save roderik/2556198 to your computer and use it in GitHub Desktop.
BillSplitCommand v1
<?php
namespace Kunstmaan\Hosting\BillSplitBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class BillSplitCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName('bill:split')
->setDescription('Split the bill')
->addArgument('billpath', InputArgument::REQUIRED, 'The path to the bill yml file');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
// TODO: parse input, pass to the parseBill method.
}
/**
* Parses the YAML file containing the bill content into an array.
*
* @param SplFileObject $bill
* @param OutputInterface $output
* @return array a multidimensional array with the bill.yml content
*/
private function parseBill(SplFileObject $bill, OutputInterface $output)
{
// TODO: add code
return array();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment