Ejemplo n.º 1
0
  /**
   * Returns the list of markers to scan for and summize in their separate page.
   *
   * @return string[]
   */
  public function getMarkers()
  {
    // get the file from the config is present
    $config_markers = (isset(DocBlox_Abstract::config()->markers) && isset(DocBlox_Abstract::config()->markers->item)) ?
      DocBlox_Abstract::config()->markers->item :
      array();
    if ($config_markers instanceof Zend_Config)
    {
      $config_markers = $config_markers->toArray();
    }
    if (is_string($config_markers))
    {
      $config_markers = array($config_markers);
    }

    // get all directories which must be recursively checked
    $option_marker = $this->getOption('marker') ?
      explode(',', $this->getOption('marker')) :
      $config_markers;

    return $option_marker;
  }
Ejemplo n.º 2
0
    throw new Zend_Console_Getopt_Exception('');
  }

  // initialize timer
  $timer = new sfTimer();

  if ($opts->getOption('output'))
  {
    $writer = $opts->getOption('output');
  } else
  {
    if (!isset(DocBlox_Abstract::config()->transformation->writer))
    {
      throw new Exception('Unable to find configuration entry for the transformation writer, please check your configuration file.');
    }
    $writer = DocBlox_Abstract::config()->transformation->writer;
  }
  $writer = 'DocBlox_Writer_'.ucfirst($writer);
  $writer = new $writer();

  // set target option if it was provided by the user
  if ($opts->getOption('target'))
  {
    $path = realpath($opts->getOption('target'));
    if (!file_exists($path) && !is_dir($path) && !is_writable($path))
    {
      throw new Exception('Given target directory does not exist or is not writable');
    }

    $writer->setTarget($path);
  }
Ejemplo n.º 3
0
  if ($opts->getOption('h'))
  {
    throw new Zend_Console_Getopt_Exception('');
  }

  // merge config with a new one if it is provided
  if ($opts->getOption('c'))
  {
    $filename = $opts->getOption('c');
    if (!is_readable($filename))
    {
      throw new Exception('Config file "'.$filename.'" is not readable');
    }

    DocBlox_Abstract::config()->merge(new Zend_Config_Xml(file_get_contents($filename)));
    DocBlox_Abstract::config()->setReadOnly();
  }

  // getTarget throws an exception if an incorrect path was given; in which case we want to show the help
  $path = $opts->getTarget();

  if (count($opts->getFiles()) < 1)
  {
    throw new Zend_Console_Getopt_Exception('No parsable files were found, did you specify any using the -f or -d parameter?');
  }

} catch (Zend_Console_Getopt_Exception $e)
{
  // if the message actually contains anything, show it.
  if ($e->getMessage())
  {
Ejemplo n.º 4
0
  /**
   * Loads the configuration for DocBlox.
   *
   * @param string $filename
   */
  public static function loadConfig($filename)
  {
    if (!is_readable($filename))
    {
      throw new Exception('Config file "'.$filename.'" is not readable');
    }

    self::$config = new Zend_Config_Xml(file_get_contents($filename), null, true);
  }