Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
ksup
Commits
b9c162dd
Commit
b9c162dd
authored
Oct 28, 2019
by
David Surville
Browse files
Merge branch 'zf-3.x'
parents
b9709199
ec64a0f1
Pipeline
#5602
failed with stage
in 11 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/UnicaenKsup/Mvc/Service/ViewKsupStrategyFactory.php
View file @
b9c162dd
...
...
@@ -3,6 +3,7 @@
namespace
UnicaenKsup\Mvc\Service
;
use
Application\View\Renderer\PhpRenderer
;
use
Interop\Container\ContainerInterface
;
use
UnicaenKsup\Service\KsupService
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -11,16 +12,27 @@ use UnicaenKsup\View\Strategy\KsupStrategy;
class
ViewKsupStrategyFactory
implements
FactoryInterface
{
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
/**
* @param ContainerInterface $container
* @param string $requestedName
* @param array|null $options
* @return object|KsupStrategy
*/
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
/** @var PhpRenderer $renderer */
$renderer
=
$
serviceLocato
r
->
get
(
'ViewRenderer'
);
$renderer
=
$
containe
r
->
get
(
'ViewRenderer'
);
/** @var KsupService $service */
$service
=
$
serviceLocato
r
->
get
(
'ksup'
);
$service
=
$
containe
r
->
get
(
'ksup'
);
$strategy
=
new
KsupStrategy
(
$renderer
);
$strategy
->
setServiceKsup
(
$service
);
return
$strategy
;
}
}
public
function
createService
(
ServiceLocatorInterface
$container
)
{
return
$this
(
$container
,
KsupStrategy
::
class
);
}
}
\ No newline at end of file
src/UnicaenKsup/Service/KsupServiceFactory.php
View file @
b9c162dd
...
...
@@ -2,29 +2,41 @@
namespace
UnicaenKsup\Service
;
use
Interop\Container\ContainerInterface
;
use
UnicaenKsup\View\Strategy\KsupStrategy
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
use
Zend\View\Helper\BasePath
;
class
KsupServiceFactory
implements
FactoryInterface
{
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
/**
* @param ContainerInterface $container
* @param string $requestedName
* @param array|null $options
* @return object|KsupService
*/
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$service
=
new
KsupService
();
$config
=
$
serviceLocato
r
->
get
(
'config'
);
if
(
isset
(
$config
[
'unicaen-ksup'
])){
$config
=
$
containe
r
->
get
(
'config'
);
if
(
isset
(
$config
[
'unicaen-ksup'
]))
{
$config
=
$config
[
'unicaen-ksup'
];
}
else
{
}
else
{
$config
=
[];
}
$service
->
setConfig
(
$config
);
/** @var BasePath $basePath */
$basePath
=
$
serviceLocato
r
->
get
(
'
v
iewHelperManager'
)
->
get
(
'basePath'
);
$basePath
=
$
containe
r
->
get
(
'
V
iewHelperManager'
)
->
get
(
'basePath'
);
$service
->
setBasePath
(
$basePath
);
return
$service
;
}
public
function
createService
(
ServiceLocatorInterface
$container
)
{
return
$this
(
$container
,
KsupService
::
class
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment