* unecessary factory removed, layout / prefix had to be changed instead

This commit is contained in:
Danyi Dávid 2018-01-18 21:47:45 +01:00
parent 491e572228
commit 81b3f218e7
3 changed files with 3 additions and 38 deletions

View File

@ -1,6 +1,5 @@
<?php
use App\Helper as AppHelper;
use Zend\Expressive\Application;
use Zend\Expressive\Container;
use Zend\Expressive\Delegate;
@ -22,12 +21,12 @@ return [
// class name.
'invokables' => [
// Fully\Qualified\InterfaceName::class => Fully\Qualified\ClassName::class,
Helper\ServerUrlHelper::class => Helper\ServerUrlHelper::class,
],
// Use 'factories' for services provided by callbacks/factory classes.
'factories' => [
Application::class => Container\ApplicationFactory::class,
Delegate\NotFoundDelegate::class => Container\NotFoundDelegateFactory::class,
Helper\ServerUrlHelper::class => AppHelper\ServerUrlHelperFactory::class,
Helper\ServerUrlMiddleware::class => Helper\ServerUrlMiddlewareFactory::class,
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
Helper\UrlHelperMiddleware::class => Helper\UrlHelperMiddlewareFactory::class,

View File

@ -1,34 +0,0 @@
<?php
namespace App\Helper;
use Psr\Container\ContainerInterface;
use Zend\Diactoros\Uri;
use Zend\Expressive\Helper\ServerUrlHelper;
class ServerUrlHelperFactory
{
/**
* Create a UrlHelper instance.
*
* @param ContainerInterface $container
* @return ServerUrlHelper
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function __invoke(ContainerInterface $container)
{
$config = $container->get('config');
$path = array_key_exists('los_basepath', $config) && !empty($config['los_basepath'])
? $config['los_basepath']
: null;
$serverUrlHelper = new ServerUrlHelper();
if ($path) {
$uri = (new Uri())->withPath($path);
$serverUrlHelper->setUri($uri);
}
return $serverUrlHelper;
}
}

View File

@ -26,8 +26,8 @@
<script>
var changeDelay = <?=$changeDelay ?>;
var refreshInterval = <?=$refreshInterval ?>;
var cameraImageApiUrl = '<?=$this->serverurl("/api/get-latest-camera-pictures") ?>';
var cameraImageBaseUrl = '<?=$this->serverurl("/show-image/") ?>';
var cameraImageApiUrl = '<?=$this->serverurl("api/get-latest-camera-pictures") ?>';
var cameraImageBaseUrl = '<?=$this->serverurl("show-image/") ?>';
</script>
<script src="<?= $this->serverurl("scripts/camera-image-handler.js") ?>"></script>
<?php $this->end() ?>