Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark authored and StyleCIBot committed Nov 20, 2020
1 parent a7a89a4 commit ba2727e
Show file tree
Hide file tree
Showing 12 changed files with 159 additions and 167 deletions.
9 changes: 5 additions & 4 deletions src/Breadcrumbs.php
Expand Up @@ -4,14 +4,14 @@

namespace Yiisoft\Yii\Bulma;

use JsonException;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Html\Html;

use function array_key_exists;
use function array_merge;
use function is_array;

use JsonException;
use function strtr;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Html\Html;

/**
* The Bulma breadcrumb is a simple navigation component.
Expand Down Expand Up @@ -68,6 +68,7 @@ public function encodeLabels(bool $value): self

/**
* Do not render home item.
*
* @return self
*/
public function withoutHomeItem(): self
Expand Down
14 changes: 7 additions & 7 deletions src/Dropdown.php
Expand Up @@ -4,14 +4,14 @@

namespace Yiisoft\Yii\Bulma;

use JsonException;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Html\Html;

use function array_key_exists;
use function array_merge;
use function implode;

use function is_array;
use JsonException;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Html\Html;

/**
* The dropdown component is a container for a dropdown button and a dropdown menu.
Expand Down Expand Up @@ -83,7 +83,7 @@ public function buttonLabelOptions(array $value): self
public function dividerClass(string $value): self
{
$new = clone $this;
$new->dividerClass = $value;
$new->dividerClass = $value;
return $new;
}

Expand All @@ -97,7 +97,7 @@ public function dividerClass(string $value): self
public function itemClass(string $value): self
{
$new = clone $this;
$new->itemClass = $value;
$new->itemClass = $value;
return $new;
}

Expand All @@ -111,7 +111,7 @@ public function itemClass(string $value): self
public function itemsClass(string $value): self
{
$new = clone $this;
$new->itemsClass = $value;
$new->itemsClass = $value;
return $new;
}

Expand Down
20 changes: 10 additions & 10 deletions src/Menu.php
Expand Up @@ -4,15 +4,15 @@

namespace Yiisoft\Yii\Bulma;

use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Html\Html;

use function array_merge;
use function array_values;

use function call_user_func;
use function count;
use function implode;
use function strtr;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Html\Html;

/**
* The Bulma menu is a vertical navigation component.
Expand Down Expand Up @@ -60,7 +60,7 @@ protected function run(): string
* Whether to automatically activate items according to whether their route setting matches the currently requested
* route.
*
* @var bool $value
* @var bool
*
* @return self
*
Expand Down Expand Up @@ -91,7 +91,7 @@ public function activateParents(bool $value): self
/**
* The CSS class to be appended to the active menu item.
*
* @var string $value
* @var string
*
* @return self
*/
Expand Down Expand Up @@ -148,7 +148,7 @@ public function encodeLabels(bool $value): self
* The CSS class that will be assigned to the first item in the main menu or each submenu. Defaults to null,
* meaning no such CSS class will be assigned.
*
* @var string $value
* @var string
*
* @return self
*/
Expand All @@ -163,7 +163,7 @@ public function firstItemCssClass(string $value): self
* Whether to hide empty menu items. An empty menu item is one whose `url` option is not set and which has no
* visible child menu items.
*
* @var bool $value
* @var bool
*
* @return self
*/
Expand Down Expand Up @@ -352,7 +352,7 @@ private function renderItems(array $items): string
if (!empty($item['items'])) {
$subMenuTemplate = ArrayHelper::getValue($item, 'subMenuTemplate', $this->subMenuTemplate);
$menu .= strtr($subMenuTemplate, [
'{items}' => $this->renderItems($item['items'])
'{items}' => $this->renderItems($item['items']),
]);
}

Expand Down Expand Up @@ -387,9 +387,9 @@ private function renderItem(array $item, array $linkOptions): string
$url = '"' . Html::encode($item['url']) . '"';
}
return strtr($template, [
'{url}' => $url,
'{url}' => $url,
'{label}' => $item['label'],
'{icon}' => $htmlIcon
'{icon}' => $htmlIcon,
]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Message.php
Expand Up @@ -254,7 +254,7 @@ private function renderCloseButton(): ?string

$tag = ArrayHelper::remove($this->closeButtonOptions, 'tag', 'button');
$label = ArrayHelper::remove($this->closeButtonOptions, 'label', Html::tag('span', '×', [
'aria-hidden' => 'true'
'aria-hidden' => 'true',
]));

if ($tag === 'button') {
Expand Down
18 changes: 9 additions & 9 deletions src/Nav.php
Expand Up @@ -4,14 +4,14 @@

namespace Yiisoft\Yii\Bulma;

use JsonException;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Html\Html;

use function array_key_exists;
use function implode;
use function is_array;

use JsonException;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Html\Html;

final class Nav extends Widget
{
private bool $activateItems = true;
Expand Down Expand Up @@ -188,7 +188,7 @@ private function isChildActive(array $items, bool &$active): array
* currentPath for the item and the rest of the elements are the associated parameters. Only when its currentPath
* and parameters match {@see currentPath}, respectively, will a menu item be considered active.
*
* @param array|string|object $item the menu item to be checked
* @param array|object|string $item the menu item to be checked
*
* @return bool whether the menu item is active
*/
Expand All @@ -198,11 +198,11 @@ private function isItemActive($item): bool
return ArrayHelper::getValue($item, 'active');
}

if (isset($item['url']) && $this->currentPath !== '/' && $item['url'] === $this->currentPath && $this->activateItems) {
return true;
}
return (bool) (isset($item['url']) && $this->currentPath !== '/' && $item['url'] === $this->currentPath && $this->activateItems)



return false;
;
}

private function renderIcon(string $label, string $icon, array $iconOptions): string
Expand Down
6 changes: 3 additions & 3 deletions src/NavBar.php
Expand Up @@ -5,10 +5,10 @@
namespace Yiisoft\Yii\Bulma;

use JsonException;
use function strpos;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Html\Html;

use function strpos;
use Yiisoft\Html\Html;

/**
* The navbar component is a responsive and versatile horizontal navigation bar.
Expand All @@ -32,7 +32,7 @@ final class NavBar extends Widget
'aria-expanded' => 'false',
'aria-label' => 'menu',
'class' => 'navbar-burger',
'role' => 'button'
'role' => 'button',
];

public function start(): string
Expand Down
4 changes: 2 additions & 2 deletions src/Widget.php
Expand Up @@ -4,10 +4,10 @@

namespace Yiisoft\Yii\Bulma;

use function strpos;
use Yiisoft\Html\Html;
use Yiisoft\Widget\Widget as BaseWidget;

use function strpos;
use Yiisoft\Widget\Widget as BaseWidget;

abstract class Widget extends BaseWidget
{
Expand Down
12 changes: 6 additions & 6 deletions tests/BreadcrumbsTest.php
Expand Up @@ -53,8 +53,8 @@ public function testBreadcrumbsEncodeLabels(): void
[
[
'label' => 'Seeting & profile',
'url' => '/about'
]
'url' => '/about',
],
]
)
->render();
Expand Down Expand Up @@ -212,7 +212,7 @@ public function testBreadcrumbsLinksException(): void
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The "label" element is required for each link.');
$html = Breadcrumbs::widget()
->items([['url' => '/about', 'template' => "<div>{link}</div>"]])
->items([['url' => '/about', 'template' => '<div>{link}</div>']])
->render();

$expected = <<<HTML
Expand Down Expand Up @@ -281,7 +281,7 @@ public function testBreadcrumbsIcons(): void
'label' => 'Index',
'url' => '/index',
'icon' => 'fas fa-home',
'iconOptions' => ['class' => 'icon']
'iconOptions' => ['class' => 'icon'],
]
)
->items(
Expand All @@ -290,8 +290,8 @@ public function testBreadcrumbsIcons(): void
'label' => 'About',
'url' => '/about',
'icon' => 'fas fa-thumbs-up',
'iconOptions' => ['class' => 'icon']
]
'iconOptions' => ['class' => 'icon'],
],
]
)
->options(['class' => 'is-centered'])
Expand Down

0 comments on commit ba2727e

Please sign in to comment.