Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

Commit

Permalink
Rename setBanner() to just banner()
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed May 20, 2013
1 parent 3449f1a commit 7272bfb
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 61 deletions.
44 changes: 22 additions & 22 deletions src/lib/Herrera/Box/StubGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ class StubGenerator
*/
private $alias;

/**
* The top header comment banner text.
*
* @var string.
*/
private $banner = 'Generated by Box.
@link https://github.com/herrera-io/php-box/';

/**
* The location within the Phar of index script.
*
Expand Down Expand Up @@ -80,24 +89,29 @@ class StubGenerator
private $web = false;

/**
* The top header comment banner text.
* Sets the alias to be used in "phar://" URLs.
*
* @var string.
* @param string $alias The alias.
*
* @return StubGenerator The stub generator.
*/
private $banner = 'Generated by Box.
public function alias($alias)
{
$this->alias = $alias;

@link https://github.com/herrera-io/php-box/';
return $this;
}

/**
* Sets the alias to be used in "phar://" URLs.
* Sets the top header comment banner text.
*
* @param string $alias The alias.
* @param string $banner The banner text.
*
* @return StubGenerator The stub generator.
*/
public function alias($alias)
public function banner($banner)
{
$this->alias = $alias;
$this->banner = $banner;

return $this;
}
Expand Down Expand Up @@ -279,20 +293,6 @@ public function rewrite($function)
return $this;
}

/**
* Sets the top header comment banner text.
*
* @param string $banner The banner text.
*
* @return StubGenerator The stub generator.
*/
public function setBanner($banner)
{
$this->banner = $banner;

return $this;
}

/**
* Use Phar::webPhar() instead of Phar::mapPhar()?
*
Expand Down
78 changes: 39 additions & 39 deletions src/tests/Herrera/Box/Tests/StubGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,45 @@ public function testAlias()
);
}

public function testBanner()
{
$this->generator->banner('Phar creation
does work
indented');

$this->assertEquals(
'Phar creation
does work
indented',
$this->getPropertyValue($this->generator, 'banner')
);

$this->assertEquals(
<<<STUB
#!/usr/bin/env php
<?php
/**
* Phar creation
*
* does work
*
*
* indented
*/
__HALT_COMPILER();
STUB
,
$this->generator->generate()
);
}

public function testCreate()
{
$this->assertInstanceOf(
Expand Down Expand Up @@ -170,45 +209,6 @@ public function testRewrite()
);
}

public function testSetBanner()
{
$this->generator->setBanner('Phar creation
does work
indented');

$this->assertEquals(
'Phar creation
does work
indented',
$this->getPropertyValue($this->generator, 'banner')
);

$this->assertEquals(
<<<STUB
#!/usr/bin/env php
<?php
/**
* Phar creation
*
* does work
*
*
* indented
*/
__HALT_COMPILER();
STUB
,
$this->generator->generate()
);
}

public function testWeb()
{
$this->generator->web(true);
Expand Down

0 comments on commit 7272bfb

Please sign in to comment.