Permalink
Browse files

fixed doc blocks and license

  • Loading branch information...
1 parent 01364a7 commit ada4bda5823ffe1df8228e9dddefa38d6420f983 @everzet everzet committed May 1, 2012
Showing with 581 additions and 437 deletions.
  1. +2 −2 LICENSE
  2. +6 −6 src/Behat/Gherkin/Cache/CacheInterface.php
  3. +20 −9 src/Behat/Gherkin/Cache/FileCache.php
  4. +51 −44 src/Behat/Gherkin/Dumper/GherkinDumper.php
  5. +7 −3 src/Behat/Gherkin/Filter/FilterInterface.php
  6. +12 −4 src/Behat/Gherkin/Filter/LineFilter.php
  7. +13 −5 src/Behat/Gherkin/Filter/LineRangeFilter.php
  8. +12 −4 src/Behat/Gherkin/Filter/NameFilter.php
  9. +13 −5 src/Behat/Gherkin/Filter/TagFilter.php
  10. +9 −9 src/Behat/Gherkin/Gherkin.php
  11. +38 −14 src/Behat/Gherkin/Keywords/ArrayKeywords.php
  12. +2 −2 src/Behat/Gherkin/Keywords/CachedArrayKeywords.php
  13. +19 −9 src/Behat/Gherkin/Keywords/CucumberKeywords.php
  14. +25 −25 src/Behat/Gherkin/Keywords/KeywordsDumper.php
  15. +18 −18 src/Behat/Gherkin/Keywords/KeywordsInterface.php
  16. +38 −14 src/Behat/Gherkin/Keywords/SymfonyTranslationKeywords.php
  17. +37 −40 src/Behat/Gherkin/Lexer.php
  18. +8 −6 src/Behat/Gherkin/Loader/AbstractFileLoader.php
  19. +29 −21 src/Behat/Gherkin/Loader/ArrayLoader.php
  20. +12 −4 src/Behat/Gherkin/Loader/DirectoryLoader.php
  21. +2 −2 src/Behat/Gherkin/Loader/FileLoaderInterface.php
  22. +16 −8 src/Behat/Gherkin/Loader/GherkinFileLoader.php
  23. +4 −4 src/Behat/Gherkin/Loader/LoaderInterface.php
  24. +18 −8 src/Behat/Gherkin/Loader/YamlFileLoader.php
  25. +8 −8 src/Behat/Gherkin/Node/AbstractNode.php
  26. +15 −15 src/Behat/Gherkin/Node/AbstractScenarioNode.php
  27. +1 −1 src/Behat/Gherkin/Node/BackgroundNode.php
  28. +3 −2 src/Behat/Gherkin/Node/ExamplePyStringNode.php
  29. +4 −4 src/Behat/Gherkin/Node/ExampleStepNode.php
  30. +2 −2 src/Behat/Gherkin/Node/ExampleTableNode.php
  31. +30 −31 src/Behat/Gherkin/Node/FeatureNode.php
  32. +3 −3 src/Behat/Gherkin/Node/NodeVisitorInterface.php
  33. +4 −4 src/Behat/Gherkin/Node/OutlineNode.php
  34. +7 −7 src/Behat/Gherkin/Node/PyStringNode.php
  35. +8 −8 src/Behat/Gherkin/Node/ScenarioNode.php
  36. +1 −1 src/Behat/Gherkin/Node/StepArgumentNodeInterface.php
  37. +21 −20 src/Behat/Gherkin/Node/StepNode.php
  38. +36 −36 src/Behat/Gherkin/Node/TableNode.php
  39. +27 −29 src/Behat/Gherkin/Parser.php
View
@@ -1,4 +1,4 @@
-Copyright (c) 2011 Konstantin Kudryashov <ever.zet@gmail.com>
+Copyright (c) 2012 Konstantin Kudryashov <ever.zet@gmail.com>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -19,4 +19,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
+OTHER DEALINGS IN THE SOFTWARE.
@@ -22,8 +22,8 @@
/**
* Checks that cache for feature exists and is fresh.
*
- * @param string $path feature path
- * @param integer $timestamp the last time feature was updated
+ * @param string $path Feature path
+ * @param integer $timestamp The last time feature was updated
*
* @return Boolean
*/
@@ -32,17 +32,17 @@ function isFresh($path, $timestamp);
/**
* Reads feature cache from path.
*
- * @param string $path feature path
+ * @param string $path Feature path
*
- * @return FeatureNode
+ * @return FeatureNode
*/
function read($path);
/**
* Caches feature node.
*
- * @param string $path feature path
- * @param FeatureNode $feature feature instance
+ * @param string $path Feature path
+ * @param FeatureNode $feature Feature instance
*/
function write($path, FeatureNode $feature);
}
@@ -4,8 +4,19 @@
use Behat\Gherkin\Node\FeatureNode;
+/*
+* This file is part of the Behat Gherkin.
+* (c) 2011 Konstantin Kudryashov <ever.zet@gmail.com>
+*
+* For the full copyright and license information, please view the LICENSE
+* file that was distributed with this source code.
+*/
+
/**
- * Features filecache.
+ * File cache.
+ * Caches feature into a file.
+ *
+ * @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class FileCache implements CacheInterface
{
@@ -14,7 +25,7 @@ class FileCache implements CacheInterface
/**
* Initializes file cache.
*
- * @param string $path path to the folder where to store caches.
+ * @param string $path Path to the folder where to store caches.
*/
public function __construct($path)
{
@@ -28,8 +39,8 @@ public function __construct($path)
/**
* Checks that cache for feature exists and is fresh.
*
- * @param string $path feature path
- * @param integer $timestamp the last time feature was updated
+ * @param string $path Feature path
+ * @param integer $timestamp The last time feature was updated
*
* @return Boolean
*/
@@ -47,9 +58,9 @@ public function isFresh($path, $timestamp)
/**
* Reads feature cache from path.
*
- * @param string $path feature path
+ * @param string $path Feature path
*
- * @return FeatureNode
+ * @return FeatureNode
*/
public function read($path)
{
@@ -59,8 +70,8 @@ public function read($path)
/**
* Caches feature node.
*
- * @param string $path feature path
- * @param FeatureNode $feature feature instance
+ * @param string $path Feature path
+ * @param FeatureNode $feature Feature instance
*/
public function write($path, FeatureNode $feature)
{
@@ -70,7 +81,7 @@ public function write($path, FeatureNode $feature)
/**
* Returns feature cache file path from features path.
*
- * @param string $path feature path
+ * @param string $path Feature path
*
* @return string
*/
@@ -22,18 +22,18 @@
/**
* Gherkin Dumper.
*
- * @author Jean-François Lépine <dev@lepine.pro>
+ * @author Jean-François Lépine <dev@lepine.pro>
*/
class GherkinDumper
{
private $keywords;
private $indent;
/**
- * Constructor
+ * Constructs dumper.
*
- * @param \Behat\Gherkin\Keywords\KeywordsInterface $keywords
- * @param string $indent
+ * @param KeywordsInterface $keywords Keywords container
+ * @param string $indent Indentation
*/
public function __construct(KeywordsInterface $keywords, $indent = ' ')
{
@@ -42,10 +42,12 @@ public function __construct(KeywordsInterface $keywords, $indent = ' ')
}
/**
- * Dump a feature
+ * Dumps a feature.
+ *
+ * @see dumpFeature()
+ *
+ * @param FeatureNode $feature Feature instance
*
- * @see Behat\Gherkin\dumpFeature()
- * @param Behat\Gherkin\Node\FeatureNode
* @return string
*/
public function dump(FeatureNode $feature)
@@ -54,9 +56,10 @@ public function dump(FeatureNode $feature)
}
/**
- * Dump background
+ * Dumps a background.
+ *
+ * @param BackgroundNode $background Background instance
*
- * @param Behat\Gherkin\Node\BackgroundNode
* @return string
*/
public function dumpBackground(BackgroundNode $background)
@@ -75,9 +78,10 @@ public function dumpBackground(BackgroundNode $background)
}
/**
- * Dump comment
+ * Dumps comment.
+ *
+ * @param string $comment Comment string
*
- * @param string $comment
* @return string
*/
public function dumpComment($comment)
@@ -86,29 +90,27 @@ public function dumpComment($comment)
}
/**
- * Dump feature
+ * Dumps feature.
+ *
+ * @param FeatureNode $feature Feature instance
*
- * @param \Behat\Gherkin\Node\FeatureNode $feature
* @return string
*/
public function dumpFeature(FeatureNode $feature)
{
$language = $feature->getLanguage();
$this->keywords->setLanguage($language);
- // Feature's infos
$content = ''
. $this->dumpLanguage($language)
. ($feature->getTags() ? PHP_EOL . $this->dumpTags($feature->getTags(), 0) : '')
. PHP_EOL . $this->dumpKeyword($this->keywords->getFeatureKeywords(), $feature->getTitle(), 0)
. PHP_EOL . $this->dumpText($feature->getDescription(), 1);
- // Background
if ($feature->getBackground()) {
$content .= $this->dumpBackground($feature->getBackground());
}
- // scenarios
$scenarios = $feature->getScenarios();
foreach ($scenarios as $scenario) {
$content .= PHP_EOL . $this->dumpScenario($scenario);
@@ -117,11 +119,12 @@ public function dumpFeature(FeatureNode $feature)
}
/**
- * Dump keyword
+ * Dumps keyword.
+ *
+ * @param string $keyword Keyword string
+ * @param string $text Text
+ * @param integer $indent Indentation
*
- * @param string $keyword
- * @param string $text
- * @param integer $indent
* @return string
*/
public function dumpKeyword($keyword, $text, $indent = 0)
@@ -135,29 +138,27 @@ public function dumpKeyword($keyword, $text, $indent = 0)
}
/**
- * Dump scenario
+ * Dumps scenario.
+ *
+ * @param ScenarioNode $scenario Scenario instance
*
- * @param \Behat\Gherkin\Node\ScenarioNode $scenario
* @return string
*/
public function dumpScenario(ScenarioNode $scenario)
{
$keyWordToUse = $scenario instanceof OutlineNode ? $this->keywords->getOutlineKeywords() : $this->keywords->getScenarioKeywords();
- // Main content
$content = ''
. (sizeof($scenario->getTags()) > 0 ? PHP_EOL . $this->dumpTags($scenario->getTags(), 1) : '')
. PHP_EOL . $this->dumpKeyword($keyWordToUse, $scenario->getTitle(), 1)
;
- // Steps
foreach ($scenario->getSteps() as $step) {
$content .=
PHP_EOL . $this->dumpIndent(2)
. $this->dumpStep($step);
}
- // Examples
if ($scenario instanceof OutlineNode) {
$content .= ''
. PHP_EOL . PHP_EOL . $this->dumpKeyword($this->keywords->getExamplesKeywords(), '', 1)
@@ -169,10 +170,10 @@ public function dumpScenario(ScenarioNode $scenario)
}
/**
- * Dump table node
+ * Dumps table node.
*
- * @param \Behat\Gherkin\Node\TableNode $tableNode
- * @param integer $indent
+ * @param TableNode $tableNode Table node
+ * @param integer $indent Indentation
* @return string
*/
public function dumpTableNode(TableNode $tableNode, $indent = 0)
@@ -187,9 +188,10 @@ public function dumpTableNode(TableNode $tableNode, $indent = 0)
}
/**
- * Dump indent
+ * Dumps indentation.
+ *
+ * @param integer $indent Indentation
*
- * @param integer $indent
* @return string
*/
public function dumpIndent($indent)
@@ -198,11 +200,13 @@ public function dumpIndent($indent)
}
/**
- * Dump step
+ * Dumps a step.
+ *
+ * @param StepNode $step Step node instance
*
- * @param \Behat\Gherkin\Node\StepNode $step
* @return string
- * @throws \Behat\Gherkin\Exception\Exception
+ *
+ * @throws Exception if invalid step type providen
*/
public function dumpStep(StepNode $step)
{
@@ -230,10 +234,11 @@ public function dumpStep(StepNode $step)
}
/**
- * Dump text
+ * Dumps text.
+ *
+ * @param string $text Text to dump
+ * @param integer $indent Indentation
*
- * @param string $text
- * @param integer $indent
* @return string
*/
public function dumpText($text, $indent = 0)
@@ -245,24 +250,26 @@ public function dumpText($text, $indent = 0)
}
/**
- * Dump tags
+ * Dumps tags.
+ *
+ * @param array $tags Array of tags
+ * @param integer $indent Indentation
*
- * @param array $tags
- * @param integer $indent
* @return string
*/
- public function dumpTags(array $array, $indent = 0)
+ public function dumpTags(array $tags, $indent = 0)
{
- if (empty($array)) {
+ if (empty($tags)) {
return '';
}
- return $this->dumpIndent($indent) . '@' . ltrim(implode(' @', $array));
+ return $this->dumpIndent($indent) . '@' . ltrim(implode(' @', $tags));
}
/**
- * Dump language tag
+ * Dumps language tag.
+ *
+ * @param string $language Language name
*
- * @param string $language
* @return string
*/
public function dumpLanguage($language)
@@ -16,21 +16,25 @@
/**
* Filter interface.
*
- * @author Konstantin Kudryashov <ever.zet@gmail.com>
+ * @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
interface FilterInterface
{
/**
* Checks if Feature matches specified filter.
*
- * @param Behat\Gherkin\Node\FeatureNode $feature
+ * @param FeatureNode $feature Feature instance
+ *
+ * @return Boolean
*/
function isFeatureMatch(FeatureNode $feature);
/**
* Checks if scenario or outline matches specified filter.
*
- * @param Behat\Gherkin\Node\ScenarioNode|Behat\Gherkin\Node\OutlineNode $scenario
+ * @param ScenarioNode $scenario Scenario or Outline node instance
+ *
+ * @return Boolean
*/
function isScenarioMatch(ScenarioNode $scenario);
}
Oops, something went wrong.

0 comments on commit ada4bda

Please sign in to comment.