1. sfConfigureAuthorTask.class.php
  2. /** * Configures the main author of the project. * * @package symfony * @subpackage task * @author Fabien Potencier * @version SVN: $Id: sfConfigureAuthorTask.class.php 6978 2008-01-06 18:53:47Z fabien $ */
  3. class sfConfigureAuthorTask extends sfBaseTask
  4. {
  5. /**
  6. * @see sfTask
  7. */
  8. protected function configure()
  9. {
  10. $this->addArguments(array(
  11. new sfCommandArgument('author', sfCommandArgument::REQUIRED, 'The project author'),
  12. ));
  13. $this->namespace = 'configure';
  14. $this->name = 'author';
  15. $this->briefDescription = 'Configure project author';
  16. $this->detailedDescription = <<<EOF
  17. The [configure:author|INFO] task configures the author for a project:
  18. [./symfony configure:author "Fabien Potencier <fabien.potencier@symfony-project.com>"|INFO]
  19. The author is used by the generates to pre-configure the PHPDoc header for each generated file.
  20. The value is stored in [config/properties.ini].
  21. EOF;
  22. }
  23. /**
  24. * @see sfTask
  25. */
  26. protected function execute($arguments = array(), $options = array())
  27. {
  28. $file = sfConfig::get('sf_config_dir').'/properties.ini';
  29. $content = parse_ini_file($file, true);
  30. if (!isset($content['symfony']))
  31. {
  32. $content['symfony'] = array();
  33. }
  34. $content['symfony']['author'] = $arguments['author'];
  35. $ini = '';
  36. foreach ($content as $section => $values)
  37. {
  38. $ini .= sprintf("[%s]\n", $section);
  39. foreach ($values as $key => $value)
  40. {
  41. $ini .= sprintf(" %s=%s\n", $key, $value);
  42. }
  43. }
  44. file_put_contents($file, $ini);
  45. }
  46. }

Debug toolbar