Skip to content

Commit

Permalink
Merge pull request #22 from spryker-sdk/feature/sc-455/master-define-…
Browse files Browse the repository at this point in the history
…the-current-environment-in-config

SC-455: Define the current environment in config
  • Loading branch information
Incognito authored Jul 2, 2019
2 parents 12606d5 + bf89221 commit 723220e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"require": {
"php": ">=7.1",
"spryker-sdk/spryk": "^0.1.0 || ^0.2.0",
"spryker/config": "^3.1.3",
"spryker/development": "^3.12.0",
"spryker/graph": "^3.0.0",
"spryker/kernel": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace SprykerSdk\Zed\SprykGui\Communication\Controller;

use Spryker\Shared\Config\Environment;
use Spryker\Zed\Kernel\Communication\Controller\AbstractController as SprykerAbstractController;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

Expand All @@ -34,10 +33,9 @@ public function initialize(): void
*/
protected function assertNonProductionEnvironment(): void
{
$isProductionEnvironment = Environment::isProduction();
$isCli = PHP_SAPI === 'cli';

if (!$isProductionEnvironment || $isCli) {
if ($isCli || $this->getFactory()->getConfig()->isSprykWebInterfaceEnabled()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
/**
* @method \SprykerSdk\Zed\SprykGui\Communication\SprykGuiCommunicationFactory getFactory()
* @method \SprykerSdk\Zed\SprykGui\Business\SprykGuiFacadeInterface getFacade()
* @method \SprykerSdk\Zed\SprykGui\Persistence\SprykGuiQueryContainerInterface getQueryContainer()
*/
class GraphController extends AbstractController
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
/**
* @method \SprykerSdk\Zed\SprykGui\Communication\SprykGuiCommunicationFactory getFactory()
* @method \SprykerSdk\Zed\SprykGui\Business\SprykGuiFacadeInterface getFacade()
* @method \SprykerSdk\Zed\SprykGui\Persistence\SprykGuiQueryContainerInterface getQueryContainer()
*/
class ListController extends AbstractController
{
Expand Down
15 changes: 12 additions & 3 deletions src/SprykerSdk/Zed/SprykGui/SprykGuiConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace SprykerSdk\Zed\SprykGui;

use Spryker\Shared\Config\Config;
use Spryker\Shared\Kernel\KernelConstants;
use Spryker\Zed\Kernel\AbstractBundleConfig;

Expand All @@ -18,14 +17,24 @@ class SprykGuiConfig extends AbstractBundleConfig
*/
public function getCoreNamespaces(): array
{
return Config::get(KernelConstants::CORE_NAMESPACES, []);
return $this->get(KernelConstants::CORE_NAMESPACES, []);
}

/**
* @return array
*/
public function getProjectNamespaces(): array
{
return Config::get(KernelConstants::PROJECT_NAMESPACES, []);
return $this->get(KernelConstants::PROJECT_NAMESPACES, []);
}

/**
* @deprecated Method will be removed without replacement.
*
* @return bool
*/
public function isSprykWebInterfaceEnabled(): bool
{
return APPLICATION_ENV !== 'production';
}
}

0 comments on commit 723220e

Please sign in to comment.