| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Metricool\Features\Onboarding; |
| 6 |
|
| 7 |
use Metricool\Features\AbstractLoader; |
| 8 |
use Metricool\Services\DashboardService; |
| 9 |
use Metricool\Support\Helpers\Storages\EnvironmentConfig; |
| 10 |
use Metricool\Support\Helpers\Storages\RequestStorage; |
| 11 |
use Metricool\Traits\HasAllowlistControl; |
| 12 |
|
| 13 |
class OnboardingLoader extends AbstractLoader |
| 14 |
{ |
| 15 |
use HasAllowlistControl; |
| 16 |
|
| 17 |
private DashboardService $dashboard; |
| 18 |
|
| 19 |
public function __construct(EnvironmentConfig $env, RequestStorage $request, DashboardService $dashboard) |
| 20 |
{ |
| 21 |
parent::__construct($env, $request); |
| 22 |
|
| 23 |
$this->dashboard = $dashboard; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* @inheritDoc |
| 28 |
*/ |
| 29 |
public function isEnabled(): bool |
| 30 |
{ |
| 31 |
return $this->dashboard->isOnboardingCompleted() === false; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* @inheritDoc |
| 36 |
*/ |
| 37 |
public function inScope(): bool |
| 38 |
{ |
| 39 |
return $this->userCanManage(); |
| 40 |
} |
| 41 |
} |
| 42 |
|