Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Issue #2912 - Fix for LicenseTag generation #3250

Closed
wants to merge 1 commit into from

2 participants

@robertboloc

Fixed the license tag generation

Issue #2912

@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/3250'
Close #3250
Fix #2912
47db7c0
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/3250' into develop
Forward port #3250
c530158
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 19, 2012
  1. @robertboloc
This page is out of date. Refresh to see the latest.
View
19 library/Zend/Code/Generator/DocBlock/Tag/LicenseTag.php
@@ -26,6 +26,22 @@ class LicenseTag extends Tag
protected $url = null;
/**
+ * @param array $options
+ */
+ public function __construct(array $options = array())
+ {
+ parent::__construct($options);
+
+ if (isset($options['url'])) {
+ $this->setUrl($options['url']);
+ }
+
+ if(empty($this->name)) {
+ $this->setName('license');
+ }
+ }
+
+ /**
* fromReflection()
*
* @param ReflectionDocBlockTag $reflectionTagLicense
@@ -71,6 +87,9 @@ public function getUrl()
*/
public function generate()
{
+ $output = '@' . $this->name
+ . (($this->url != null) ? ' ' . $this->url : '')
+ . (($this->description != null) ? ' ' . $this->description : '');
return $output;
}
View
9 tests/ZendTest/Code/Generator/DocBlockTagGeneratorTest.php
@@ -11,6 +11,7 @@
namespace ZendTest\Code\Generator;
use Zend\Code\Generator\DocBlock\Tag;
+use Zend\Code\Generator\DocBlock\Tag\LicenseTag;
/**
* @category Zend
@@ -47,6 +48,14 @@ public function testCanPassDescriptionToConstructor()
$this->assertEquals('Foo', $tag->getDescription());
}
+ public function testCanGenerateLicenseTag()
+ {
+ $tag = new LicenseTag(array('url' => 'http://test.license.com',
+ 'description' => 'Test License'));
+ $this->assertEquals('@license http://test.license.com Test License',
+ $tag->generate());
+ }
+
public function testNameGetterAndSetterPersistValue()
{
$this->tag->setName('Foo');
Something went wrong with that request. Please try again.