Skip to content

Commit

Permalink
Rename BaseCompoent
Browse files Browse the repository at this point in the history
  • Loading branch information
cevro committed Oct 27, 2024
1 parent 841652d commit a4689b5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Fykosak\Utils\BaseComponent;
namespace Fykosak\Utils\Components;

use Fykosak\Utils\Localization\GettextTranslator;
use Nette\Application\UI\Control;
Expand All @@ -12,22 +12,16 @@
/**
* @property \Nette\Bridges\ApplicationLatte\Template $template
*/
abstract class BaseComponent extends Control
abstract class DIComponent extends Control
{
protected Container $container;
protected ?GettextTranslator $translator;

public function __construct(Container $container)
{
$this->container = $container;
public function __construct(
protected readonly Container $container
) {
$container->callInjects($this);
}

protected function getContext(): Container
{
return $this->container;
}

public function injectTranslator(?GettextTranslator $translator): void
{
$this->translator = $translator;
Expand Down
4 changes: 2 additions & 2 deletions src/UI/Navigation/NavigationItemComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace Fykosak\Utils\UI\Navigation;

use Fykosak\Utils\BaseComponent\BaseComponent;
use Fykosak\Utils\BaseComponent\DIComponent;

/**
* Compatible with bootstrap >=5.0
* tested version (5.0,5.1)
*/
class NavigationItemComponent extends BaseComponent
class NavigationItemComponent extends DIComponent
{
public function render(NavItem $item): void
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Tests/BaseComponent/DummyComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Fykosak\Utils\Tests\BaseComponent;

use Fykosak\Utils\BaseComponent\BaseComponent;
use Fykosak\Utils\BaseComponent\DIComponent;
use Fykosak\Utils\Tests\DummyService;

class DummyComponent extends BaseComponent
class DummyComponent extends DIComponent
{
public DummyService $dummyService;

Expand Down

0 comments on commit a4689b5

Please sign in to comment.