Skip to content

Commit

Permalink
Merge branch 'release/2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Sep 4, 2011
2 parents 8d2e7b0 + bcde041 commit 6407654
Show file tree
Hide file tree
Showing 84 changed files with 4,993 additions and 4,338 deletions.
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "libs/FSHL"]
path = libs/FSHL
url = git@github.com:kukulich/fshl.git
[submodule "libs/Nette"]
path = libs/Nette
url = git@github.com:nette/nette.git
[submodule "libs/Texy"]
path = libs/Texy
url = git@github.com:dg/texy.git
[submodule "libs/TokenReflection"]
path = libs/TokenReflection
url = git@github.com:Andrewsville/PHP-Token-Reflection.git
43 changes: 24 additions & 19 deletions ApiGen/Backend.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

/**
* ApiGen 2.0.3 - API documentation generator.
* ApiGen 2.1.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011 Ondřej Nešpor (http://andrewsville.cz)
* Copyright (c) 2011 Jaroslav Hanslík (http://kukulich.cz)
* Copyright (c) 2011 Jaroslav Hanslík (https://github.com/kukulich)
* Copyright (c) 2011 Ondřej Nešpor (https://github.com/Andrewsville)
*
* For the full copyright and license information, please view
* the file LICENSE that was distributed with this source code.
Expand Down Expand Up @@ -154,22 +154,28 @@ protected function parseClassLists()
}
}
}
}
}

foreach ($class->getOwnMethods() as $method) {
$allClasses = $this->processFunction($declared, $allClasses, $method);
}
foreach ($allClasses[self::TOKENIZED_CLASSES] as $class) {
if (!$class->isDocumented()) {
continue;
}

foreach ($class->getOwnMethods() as $method) {
$allClasses = $this->processFunction($declared, $allClasses, $method);
}

foreach ($class->getOwnProperties() as $property) {
$annotations = $property->getAnnotations();
foreach ($class->getOwnProperties() as $property) {
$annotations = $property->getAnnotations();

if (!isset($annotations['var'])) {
continue;
}
if (!isset($annotations['var'])) {
continue;
}

foreach ($annotations['var'] as $doc) {
foreach (explode('|', preg_replace('#\s.*#', '', $doc)) as $name) {
$allClasses = $this->addClass($declared, $allClasses, $name);
}
foreach ($annotations['var'] as $doc) {
foreach (explode('|', preg_replace('#\s.*#', '', $doc)) as $name) {
$allClasses = $this->addClass($declared, $allClasses, $name);
}
}
}
Expand Down Expand Up @@ -200,9 +206,8 @@ private function processFunction(array $declared, array $allClasses, $function)
{
static $parsedAnnotations = array('param', 'return', 'throws');

$annotations = $function->getAnnotations();
foreach ($parsedAnnotations as $annotation) {
$annotations = $function->getAnnotations();

if (!isset($annotations[$annotation])) {
continue;
}
Expand All @@ -215,8 +220,8 @@ private function processFunction(array $declared, array $allClasses, $function)
}

foreach ($function->getParameters() as $param) {
if ($hint = $param->getClass()) {
$allClasses = $this->addClass($declared, $allClasses, $hint->getName());
if ($hint = $param->getClassName()) {
$allClasses = $this->addClass($declared, $allClasses, $hint);
}
}

Expand Down
28 changes: 18 additions & 10 deletions ApiGen/Config.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

/**
* ApiGen 2.0.3 - API documentation generator.
* ApiGen 2.1.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011 Ondřej Nešpor (http://andrewsville.cz)
* Copyright (c) 2011 Jaroslav Hanslík (http://kukulich.cz)
* Copyright (c) 2011 Jaroslav Hanslík (https://github.com/kukulich)
* Copyright (c) 2011 Ondřej Nešpor (https://github.com/Andrewsville)
*
* For the full copyright and license information, please view
* the file LICENSE that was distributed with this source code.
Expand Down Expand Up @@ -68,6 +68,7 @@ class Config
'wipeout' => true,
'quiet' => false,
'progressbar' => true,
'colors' => true,
'debug' => false
);

Expand Down Expand Up @@ -126,7 +127,8 @@ public function __construct()
}, $this->options);

$this->config = self::$defaultConfig;
$this->config['templateConfig'] = TEMPLATE_DIR . '/default/config.neon';
$this->config['templateConfig'] = realpath(TEMPLATE_DIR . '/default/config.neon');
$this->config['colors'] = 'WIN' !== substr(PHP_OS, 0, 3);
}

/**
Expand Down Expand Up @@ -240,11 +242,16 @@ public function parse()
$this->check();

// Default template config
$this->config['resources'] = array();
$this->config['templates'] = array('common' => array(), 'optional' => array());
$this->config['template'] = array(
'resources' => array(),
'templates' => array(
'common' => array(),
'optional' => array()
)
);

// Merge template config
$this->config = array_merge_recursive($this->config, Neon::decode(file_get_contents($this->config['templateConfig'])));
$this->config = array_merge_recursive($this->config, array('template' => Neon::decode(file_get_contents($this->config['templateConfig']))));

// Check template
$this->checkTemplate();
Expand Down Expand Up @@ -316,7 +323,7 @@ private function check()
private function checkTemplate()
{
foreach (array('main', 'optional') as $section) {
foreach ($this->config['templates'][$section] as $type => $config) {
foreach ($this->config['template']['templates'][$section] as $type => $config) {
if (!isset($config['filename'])) {
throw new Exception(sprintf('Filename for %s is not defined', $type), Exception::INVALID_CONFIG);
}
Expand Down Expand Up @@ -371,7 +378,7 @@ public function isHelpRequested()
*/
public function getHelp()
{
return <<<'HELP'
return <<<"HELP"
Usage:
apigen @option@--config@c <@value@path@c> [options]
apigen @option@--source@c <@value@dir@c|@value@file@c> @option@--destination@c <@value@dir@c> [options]
Expand All @@ -389,7 +396,7 @@ public function getHelp()
@option@--google-cse-id@c <@value@value@c> Google Custom Search ID
@option@--google-cse-label@c <@value@value@c> Google Custom Search label
@option@--google-analytics@c <@value@value@c> Google Analytics tracking code
@option@--template-config@c <@value@file@c> Template config file, default "@value@./templates/default/config.neon@c"
@option@--template-config@c <@value@file@c> Template config file, default "@value@{$this->config['templateConfig']}@c"
@option@--allowed-html@c <@value@list@c> List of allowed HTML tags in documentation, default "@value@b,i,a,ul,ol,li,p,br,var,samp,kbd,tt@c"
@option@--access-levels@c <@value@list@c> Generate documentation for methods and properties with given access level, default "@value@public,protected@c"
@option@--internal@c <@value@yes@c|@value@no@c> Generate documentation for elements marked as internal and display internal documentation parts, default "@value@no@c"
Expand All @@ -402,6 +409,7 @@ public function getHelp()
@option@--wipeout@c <@value@yes@c|@value@no@c> Wipe out the destination directory first, default "@value@yes@c"
@option@--quiet@c <@value@yes@c|@value@no@c> Don't display scaning and generating messages, default "@value@no@c"
@option@--progressbar@c <@value@yes@c|@value@no@c> Display progressbars, default "@value@yes@c"
@option@--colors@c <@value@yes@c|@value@no@c> Use colors, default "@value@no@c" on Windows, "@value@yes@c" on other systems
@option@--debug@c <@value@yes@c|@value@no@c> Display additional information in case of an error, default "@value@no@c"
@option@--help@c|@option@-h@c Display this help

Expand Down
6 changes: 3 additions & 3 deletions ApiGen/Exception.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

/**
* ApiGen 2.0.3 - API documentation generator.
* ApiGen 2.1.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011 Ondřej Nešpor (http://andrewsville.cz)
* Copyright (c) 2011 Jaroslav Hanslík (http://kukulich.cz)
* Copyright (c) 2011 Jaroslav Hanslík (https://github.com/kukulich)
* Copyright (c) 2011 Ondřej Nešpor (https://github.com/Andrewsville)
*
* For the full copyright and license information, please view
* the file LICENSE that was distributed with this source code.
Expand Down

0 comments on commit 6407654

Please sign in to comment.