Skip to content
This repository has been archived by the owner on Feb 4, 2019. It is now read-only.

Commit

Permalink
Fixed CR comments
Browse files Browse the repository at this point in the history
* Removed spryker/container dependency on project level
* Using core level ApplicationDependencyProvider to extend project level ApplicaitonDependencyProvider
* Using core level YvesBootstrap to extend project level YvesBootstrap
* Reverted changes of UrlGenerator
  • Loading branch information
Mykola Ostrizhnii committed Jan 24, 2019
1 parent 14abdbd commit ead1e72
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 124 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"mandrill/mandrill": "~1.0.55",
"monolog/monolog": "^1.21.0",
"nesbot/carbon": "~1.13.0",
"spryker/container": "^1.0.0",
"predis/predis": "^1.1.1",
"propel/propel": "2.0.0-alpha8",
"psr/log": "^1.0.0",
Expand Down
6 changes: 3 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions src/Pyz/Shared/Application/Business/Routing/UrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class UrlGenerator extends SymfonyUrlGenerator
{
public const HOME = 'home';
public const ERROR_PATH = '/error/404';
protected const ROUTE_NOT_FOUND_URL = '';

/**
* @var \Pimple
Expand All @@ -47,9 +46,6 @@ public function generate($name, $parameters = [], $referenceType = self::ABSOLUT
{
$route = $this->routes->get($name);

if ($route === null) {
return static::ROUTE_NOT_FOUND_URL;
}
$compiledRoute = $route->compile();
$parameters = $this->convertParameters($parameters, $route);

Expand Down
22 changes: 3 additions & 19 deletions src/Pyz/Yves/Application/ApplicationDependencyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
namespace Pyz\Yves\Application;

use Pyz\Yves\Twig\Plugin\TwigYves;
use Spryker\Yves\Kernel\AbstractBundleDependencyProvider;
use Spryker\Yves\Application\ApplicationDependencyProvider as SprykerApplicationDependencyProvider;
use Spryker\Yves\Kernel\Container;
use Spryker\Yves\Kernel\Plugin\Pimple;

class ApplicationDependencyProvider extends AbstractBundleDependencyProvider
class ApplicationDependencyProvider extends SprykerApplicationDependencyProvider
{
public const SERVICE_UTIL_DATE_TIME = 'util date time service';

Expand All @@ -27,19 +27,17 @@ class ApplicationDependencyProvider extends AbstractBundleDependencyProvider
public const PLUGIN_APPLICATION = 'application plugin';
public const PLUGIN_TWIG = 'twig plugin';

public const PLUGINS_APPLICATION = 'PLUGINS_APPLICATION';

/**
* @param \Spryker\Yves\Kernel\Container $container
*
* @return \Spryker\Yves\Kernel\Container
*/
public function provideDependencies(Container $container)
{
$container = parent::provideDependencies($container);
$container = $this->provideClients($container);
$container = $this->providePlugins($container);
$container = $this->addUtilDateTimeService($container);
$container = $this->addApplicationPlugins($container);

return $container;
}
Expand Down Expand Up @@ -97,20 +95,6 @@ protected function addUtilDateTimeService(Container $container)
return $container;
}

/**
* @param \Spryker\Yves\Kernel\Container $container
*
* @return \Spryker\Yves\Kernel\Container
*/
protected function addApplicationPlugins(Container $container): Container
{
$container->set(static::PLUGINS_APPLICATION, function (Container $container): array {
return $this->getApplicationPlugins();
});

return $container;
}

/**
* @return \Spryker\Shared\ApplicationExtension\Dependency\Plugin\ApplicationPluginInterface[]
*/
Expand Down
99 changes: 2 additions & 97 deletions src/Pyz/Yves/Application/YvesBootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
use Silex\Provider\ServiceControllerServiceProvider;
use Silex\Provider\SessionServiceProvider;
use Silex\Provider\ValidatorServiceProvider;
use Spryker\Shared\Application\Application;
use Spryker\Shared\Application\ServiceProvider\FormFactoryServiceProvider;
use Spryker\Shared\Application\ServiceProvider\HeadersSecurityServiceProvider;
use Spryker\Shared\Application\ServiceProvider\RoutingServiceProvider;
Expand All @@ -53,13 +52,9 @@
use Spryker\Yves\Application\Plugin\ServiceProvider\AssertUrlConfigurationServiceProvider;
use Spryker\Yves\Application\Plugin\ServiceProvider\KernelLogServiceProvider;
use Spryker\Yves\Application\Plugin\ServiceProvider\SslServiceProvider;
use Spryker\Yves\Application\YvesBootstrap as SprykerYvesBootstrap;
use Spryker\Yves\CmsContentWidget\Plugin\CmsContentWidgetServiceProvider;
use Spryker\Yves\Currency\Plugin\CurrencySwitcherServiceProvider;
use Spryker\Yves\Kernel\AbstractBundleDependencyProvider;
use Spryker\Yves\Kernel\Application as SilexApplication;
use Spryker\Yves\Kernel\BundleDependencyProviderResolverAwareTrait;
use Spryker\Yves\Kernel\Container;
use Spryker\Yves\Kernel\Dependency\Injector\DependencyInjector;
use Spryker\Yves\Messenger\Plugin\Provider\FlashMessengerServiceProvider;
use Spryker\Yves\Money\Plugin\ServiceProvider\TwigMoneyServiceProvider;
use Spryker\Yves\Monitoring\Plugin\ServiceProvider\MonitoringRequestTransactionServiceProvider;
Expand All @@ -76,51 +71,8 @@
use Spryker\Yves\ZedRequest\Plugin\ServiceProvider\ZedRequestHeaderServiceProvider;
use Spryker\Yves\ZedRequest\Plugin\ServiceProvider\ZedRequestLogServiceProvider;

class YvesBootstrap
class YvesBootstrap extends SprykerYvesBootstrap
{
use BundleDependencyProviderResolverAwareTrait;

/**
* @var \Spryker\Yves\Kernel\Application
*/
protected $application;

/**
* @var \Pyz\Yves\Application\ApplicationConfig
*/
protected $config;

/**
* @var \Spryker\Shared\Application\Application
*/
protected $sprykerApplication;

public function __construct()
{
$this->application = new SilexApplication();

$this->sprykerApplication = new Application($this->application);
$this->config = new ApplicationConfig();
}

/**
* @return \Spryker\Shared\Application\Application
*/
public function boot()
{
$this->registerServiceProviders();

$this->setupApplication();

$this->registerRouters();
$this->registerControllerProviders();

$this->application->boot();
$this->sprykerApplication->boot();

return $this->sprykerApplication;
}

/**
* @return void
*/
Expand Down Expand Up @@ -224,51 +176,4 @@ protected function getControllerProviderStack($isSsl)
new PriceControllerProvider($isSsl),
];
}

/**
* @return void
*/
protected function setupApplication(): void
{
foreach ($this->getApplicationPlugins() as $applicationExtension) {
$this->sprykerApplication->registerApplicationPlugin($applicationExtension);
}
}

/**
* @return \Spryker\Shared\ApplicationExtension\Dependency\Plugin\ApplicationPluginInterface[]
*/
protected function getApplicationPlugins(): array
{
return $this->getProvidedDependency(ApplicationDependencyProvider::PLUGINS_APPLICATION);
}

/**
* @param \Spryker\Yves\Kernel\AbstractBundleDependencyProvider $dependencyProvider
* @param \Spryker\Yves\Kernel\Container $container
*
* @return \Spryker\Yves\Kernel\Container
*/
protected function provideExternalDependencies(AbstractBundleDependencyProvider $dependencyProvider, Container $container): Container
{
$container = $dependencyProvider->provideDependencies($container);

return $container;
}

/**
* @param \Spryker\Yves\Kernel\Dependency\Injector\DependencyInjector $dependencyInjector
* @param \Spryker\Yves\Kernel\Container $container
*
* @return \Spryker\Yves\Kernel\Container
*/
protected function injectExternalDependencies(DependencyInjector $dependencyInjector, Container $container): Container
{
/**
* @var \Spryker\Yves\Kernel\Container
*/
$container = $dependencyInjector->inject($container);

return $container;
}
}

0 comments on commit ead1e72

Please sign in to comment.