Skip to content

Commit

Permalink
Merge pull request #374 from pxgamer/feature/logo-component
Browse files Browse the repository at this point in the history
Update Logo component to use Laminus Text
  • Loading branch information
owenvoke committed Jan 15, 2020
2 parents 9a7ee95 + 3d9ae8e commit b0f2ff7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"illuminate/log": "^6.0",
"illuminate/queue": "^6.0",
"illuminate/database": "^6.0",
"laminas/laminas-text": "^2.7",
"padraic/phar-updater": "^1.0.6",
"zendframework/zend-text": "^2.7",
"nunomaduro/laravel-console-menu": "^2.2",
"nunomaduro/laravel-console-dusk": "^1.4",
"hmazter/laravel-schedule-list": "^2.0"
Expand Down
19 changes: 10 additions & 9 deletions src/Components/Logo/FigletString.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace LaravelZero\Framework\Components\Logo;

use InvalidArgumentException;
use Zend\Text\Figlet\Figlet as ZendFiglet;
use Laminas\Text\Figlet\Figlet;

/**
* @internal
Expand All @@ -23,14 +23,15 @@ final class FigletString
{
private $string;

/** @var Figlet */
private $figlet;

public const DEFAULT_FONT = __DIR__.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR.'big.flf';

public function __construct(string $string, array $options)
{
$this->string = $string;
$this->figlet = new ZendFiglet();
$this->figlet = new Figlet();

$this->parseOptions($options);
}
Expand Down Expand Up @@ -66,16 +67,16 @@ private function justification(?string $justification)
{
switch ($justification) {
case 'left':
$this->figlet->setJustification(ZendFiglet::JUSTIFICATION_LEFT);
$this->figlet->setJustification(Figlet::JUSTIFICATION_LEFT);
break;
case 'center':
$this->figlet->setJustification(ZendFiglet::JUSTIFICATION_CENTER);
$this->figlet->setJustification(Figlet::JUSTIFICATION_CENTER);
break;
case 'right':
$this->figlet->setJustification(ZendFiglet::JUSTIFICATION_RIGHT);
$this->figlet->setJustification(Figlet::JUSTIFICATION_RIGHT);
break;
case null:
// Let ZendFiglet handle the justification
// Let Figlet handle the justification
break;
default:
throw new InvalidArgumentException('Invalid value given for the `logo.justification` option');
Expand All @@ -88,13 +89,13 @@ private function rightToLeft(?string $rightToLeft)
{
switch ($rightToLeft) {
case 'right-to-left':
$this->figlet->setRightToLeft(ZendFiglet::DIRECTION_RIGHT_TO_LEFT);
$this->figlet->setRightToLeft(Figlet::DIRECTION_RIGHT_TO_LEFT);
break;
case 'left-to-right':
$this->figlet->setRightToLeft(ZendFiglet::DIRECTION_LEFT_TO_RIGHT);
$this->figlet->setRightToLeft(Figlet::DIRECTION_LEFT_TO_RIGHT);
break;
case null:
// Let ZendFiglet handle this
// Let Figlet handle this
break;
default:
throw new \InvalidArgumentException('Invalid value given for the `logo.rightToLeft` option');
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Logo/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class Installer extends AbstractInstaller
*/
public function install(): void
{
$this->require('zendframework/zend-text "^2.7"');
$this->require('laminas/laminas-text "^2.7"');

$this->task(
'Creating default logo configuration',
Expand Down
5 changes: 2 additions & 3 deletions src/Components/Logo/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ final class Provider extends AbstractComponentProvider
*/
public function isAvailable(): bool
{
return class_exists(\Zend\Text\Figlet\Figlet::class) && is_array(
$this->app['config']->get('logo', false)
);
return class_exists(\Laminas\Text\Figlet\Figlet::class)
&& is_array($this->app['config']->get('logo', false));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/LogoInstallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testRequiredPackages(): void

$composerMock->expects($this->once())
->method('require')
->with('zendframework/zend-text "^2.7"');
->with('laminas/laminas-text "^2.7"');

$this->app->instance(ComposerContract::class, $composerMock);

Expand Down

0 comments on commit b0f2ff7

Please sign in to comment.