$this->validate($service);
parent::setService($name, $service);
}
/**
* @param class-string<InstanceType>|string $name Service name of plugin to retrieve.
* @param null|array<mixed> $options Options to use when creating the instance.
* @return mixed
* @psalm-return ($name is class-string<InstanceType> ? InstanceType : mixed)
* @throws Exception\ServiceNotFoundException If the manager does not have
* a service definition for the instance, and the service is not
* auto-invokable.
* @throws InvalidServiceException If the plugin created is invalid for the
* plugin context.
*/
public function get($name, ?array $options = null)
{
if (! $this->has($name)) {
if (! $this->autoAddInvokableClass || ! class_exists($name)) {
throw new Exception\ServiceNotFoundException(sprintf(
'A plugin by the name "%s" was not found in the plugin manager %s',
$name,
static::class
));
}
$this->setFactory($name, Factory\InvokableFactory::class);
}
$instance = ! $options ? parent::get($name) : $this->build($name, $options);
$this->validate($instance);
return $instance;
}
/**
* {@inheritDoc}
*
* @psalm-assert InstanceType $instance
*/
public function validate(mixed $instance)
Arguments
"A plugin by the name "serviceAwarePseudoConstructorInjection" was not found in the plugin manager Laminas\Mvc\Controller\PluginManager"
*/
protected $controller;
/**
* Retrieve a registered instance
*
* After the plugin is retrieved from the service locator, inject the
* controller in the plugin every time it is requested. This is required
* because a controller can use a plugin and another controller can be
* dispatched afterwards. If this second controller uses the same plugin
* as the first controller, the reference to the controller inside the
* plugin is lost.
*
* @param string $name
* @param null|array $options Options to use when creating the instance.
* @return DispatchableInterface
*/
public function get($name, array $options = null)
{
$plugin = parent::get($name, $options);
$this->injectController($plugin);
return $plugin;
}
/**
* Set controller
*
* @return PluginManager
*/
public function setController(DispatchableInterface $controller)
{
$this->controller = $controller;
return $this;
}
/**
* Retrieve controller instance
*
Arguments
"serviceAwarePseudoConstructorInjection"
null
* @return AbstractController
*/
public function setPluginManager(PluginManager $plugins)
{
$this->plugins = $plugins;
$this->plugins->setController($this);
return $this;
}
/**
* Get plugin instance
*
* @param string $name Name of plugin to return
* @param null|array $options Options to pass to plugin constructor (if not already instantiated)
* @return mixed
*/
public function plugin($name, array $options = null)
{
return $this->getPluginManager()->get($name, $options);
}
/**
* Method overloading: return/call plugins
*
* If the plugin is a functor, call it, passing the parameters provided.
* Otherwise, return the plugin instance.
*
* @param string $method
* @param array $params
* @return mixed
*/
public function __call($method, $params)
{
$plugin = $this->plugin($method);
if (is_callable($plugin)) {
return call_user_func_array($plugin, $params);
}
return $plugin;
Arguments
"serviceAwarePseudoConstructorInjection"
null
* @return mixed
*/
public function plugin($name, array $options = null)
{
return $this->getPluginManager()->get($name, $options);
}
/**
* Method overloading: return/call plugins
*
* If the plugin is a functor, call it, passing the parameters provided.
* Otherwise, return the plugin instance.
*
* @param string $method
* @param array $params
* @return mixed
*/
public function __call($method, $params)
{
$plugin = $this->plugin($method);
if (is_callable($plugin)) {
return call_user_func_array($plugin, $params);
}
return $plugin;
}
/**
* Register the default events for this controller
*
* @return void
*/
protected function attachDefaultListeners()
{
$events = $this->getEventManager();
$events->attach(MvcEvent::EVENT_DISPATCH, [$this, 'onDispatch']);
}
/**
* Transform an "action" token into a method name
Arguments
"serviceAwarePseudoConstructorInjection"
namespace Nitro\DataStructures;
use Interop\Container\ContainerInterface;
class ServiceAwarePseudoConstructorInjector implements \Laminas\ServiceManager\Factory\AbstractFactoryInterface
{
public function canCreate(ContainerInterface $container, $requestedName)
{
return class_exists($requestedName);
}
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$service = new $requestedName;
return $service->serviceAwarePseudoConstructorInjection($container);
}
}
Arguments
"serviceAwarePseudoConstructorInjection"
array:1 [
0 => Laminas\ServiceManager\ServiceManager {#10}
]
return $creationCallback();
}
/**
* Create a new instance with an already resolved name
*
* This is a highly performance sensitive method, do not modify if you have not benchmarked it carefully
*
* @return object
* @throws ServiceNotFoundException If unable to resolve the service.
* @throws ServiceNotCreatedException If an exception is raised when creating a service.
* @throws ContainerExceptionInterface If any other error occurs.
*/
private function doCreate(string $resolvedName, ?array $options = null)
{
try {
if (! isset($this->delegators[$resolvedName])) {
// Let's create the service by fetching the factory
$factory = $this->getFactory($resolvedName);
$object = $factory($this->creationContext, $resolvedName, $options);
} else {
$object = $this->createDelegatorFromName($resolvedName, $options);
}
} catch (ContainerExceptionInterface $exception) {
throw $exception;
} catch (Exception $exception) {
throw new ServiceNotCreatedException(sprintf(
'Service with name "%s" could not be created. Reason: %s',
$resolvedName,
$exception->getMessage()
), (int) $exception->getCode(), $exception);
}
foreach ($this->initializers as $initializer) {
$initializer($this->creationContext, $object);
}
return $object;
}
Arguments
Laminas\ServiceManager\ServiceManager {#10}
"PaidPak\Controller\PaidPakMemberActionController"
null
// We now deal with requests which may be aliases.
$resolvedName = $this->aliases[$name] ?? $name;
// Update shared service information as we checked if the alias was shared before.
if ($resolvedName !== $name) {
$sharedService = $this->shared[$resolvedName] ?? $sharedService;
}
// The following is only true if the requested service is a shared alias.
$sharedAlias = $sharedService && isset($this->services[$resolvedName]);
// If the alias is configured as a shared service, we are done.
if ($sharedAlias) {
$this->services[$name] = $this->services[$resolvedName];
return $this->services[$resolvedName];
}
// At this point, we have to create the object.
// We use the resolved name for that.
$object = $this->doCreate($resolvedName);
// Cache the object for later, if it is supposed to be shared.
if ($sharedService) {
$this->services[$resolvedName] = $object;
}
// Also cache under the alias name; this allows sharing based on the
// service name used.
if ($sharedAlias) {
$this->services[$name] = $object;
}
return $object;
}
/** {@inheritDoc} */
public function build($name, ?array $options = null)
{
// We never cache when using "build".
$name = $this->aliases[$name] ?? $name;
Arguments
"PaidPak\Controller\PaidPakMemberActionController"
* a service definition for the instance, and the service is not
* auto-invokable.
* @throws InvalidServiceException If the plugin created is invalid for the
* plugin context.
*/
public function get($name, ?array $options = null)
{
if (! $this->has($name)) {
if (! $this->autoAddInvokableClass || ! class_exists($name)) {
throw new Exception\ServiceNotFoundException(sprintf(
'A plugin by the name "%s" was not found in the plugin manager %s',
$name,
static::class
));
}
$this->setFactory($name, Factory\InvokableFactory::class);
}
$instance = ! $options ? parent::get($name) : $this->build($name, $options);
$this->validate($instance);
return $instance;
}
/**
* {@inheritDoc}
*
* @psalm-assert InstanceType $instance
*/
public function validate(mixed $instance)
{
if (method_exists($this, 'validatePlugin')) {
trigger_error(sprintf(
'%s::validatePlugin() has been deprecated as of 3.0; please define validate() instead',
static::class
), E_USER_DEPRECATED);
$this->validatePlugin($instance);
return;
}
Arguments
"PaidPak\Controller\PaidPakMemberActionController"
$controllerName = $routeMatch instanceof RouteMatch
? $routeMatch->getParam('controller', 'not-found')
: 'not-found';
$application = $e->getApplication();
$controllerManager = $this->controllerManager;
// Query abstract controllers, too!
if (! $controllerManager->has($controllerName)) {
$return = $this->marshalControllerNotFoundEvent(
$application::ERROR_CONTROLLER_NOT_FOUND,
$controllerName,
$e,
$application
);
return $this->complete($return, $e);
}
try {
$controller = $controllerManager->get($controllerName);
} catch (InvalidControllerException | InvalidServiceException $exception) {
$return = $this->marshalControllerNotFoundEvent(
$application::ERROR_CONTROLLER_INVALID,
$controllerName,
$e,
$application,
$exception
);
return $this->complete($return, $e);
} catch (Throwable $exception) {
$return = $this->marshalBadControllerEvent($controllerName, $e, $application, $exception);
return $this->complete($return, $e);
} catch (Exception $exception) { // @TODO clean up once PHP 7 requirement is enforced
$return = $this->marshalBadControllerEvent($controllerName, $e, $application, $exception);
return $this->complete($return, $e);
}
if ($controller instanceof InjectApplicationEventInterface) {
$controller->setEvent($e);
}
Arguments
"PaidPak\Controller\PaidPakMemberActionController"
}
if ($this->sharedManager) {
foreach ($this->sharedManager->getListeners($this->identifiers, $name) as $priority => $listeners) {
$listOfListenersByPriority[$priority][] = $listeners;
}
}
// Sort by priority in reverse order
krsort($listOfListenersByPriority);
// Initial value of stop propagation flag should be false
$event->stopPropagation(false);
// Execute listeners
$responses = new ResponseCollection();
foreach ($listOfListenersByPriority as $listOfListeners) {
foreach ($listOfListeners as $listeners) {
foreach ($listeners as $listener) {
$response = $listener($event);
$responses->push($response);
// If the event was asked to stop propagating, do so
if ($event->propagationIsStopped()) {
$responses->setStopped(true);
return $responses;
}
// If the result causes our validation callback to return true,
// stop propagation
if ($callback && $callback($response)) {
$responses->setStopped(true);
return $responses;
}
}
}
}
return $responses;
}
Arguments
Laminas\Mvc\MvcEvent {#430}
$event->setParams($argv);
}
return $this->triggerListeners($event, $callback);
}
/**
* @inheritDoc
*/
public function triggerEvent(EventInterface $event)
{
return $this->triggerListeners($event);
}
/**
* @inheritDoc
*/
public function triggerEventUntil(callable $callback, EventInterface $event)
{
return $this->triggerListeners($event, $callback);
}
/**
* @inheritDoc
*/
public function attach($eventName, callable $listener, $priority = 1)
{
if (! is_string($eventName)) {
throw new Exception\InvalidArgumentException(sprintf(
'%s expects a string for the event; received %s',
__METHOD__,
is_object($eventName) ? $eventName::class : gettype($eventName)
));
}
$this->events[$eventName][(int) $priority][0][] = $listener;
return $listener;
}
/**
Arguments
Laminas\Mvc\MvcEvent {#430}
Closure($r): bool {#2 …4}
$response = $result->last();
if ($response instanceof ResponseInterface) {
$event->setName(MvcEvent::EVENT_FINISH);
$event->setTarget($this);
$event->setResponse($response);
$event->stopPropagation(false); // Clear before triggering
$events->triggerEvent($event);
$this->response = $response;
return $this;
}
}
if ($event->getError()) {
return $this->completeRequest($event);
}
// Trigger dispatch event
$event->setName(MvcEvent::EVENT_DISPATCH);
$event->stopPropagation(false); // Clear before triggering
$result = $events->triggerEventUntil($shortCircuit, $event);
// Complete response
$response = $result->last();
if ($response instanceof ResponseInterface) {
$event->setName(MvcEvent::EVENT_FINISH);
$event->setTarget($this);
$event->setResponse($response);
$event->stopPropagation(false); // Clear before triggering
$events->triggerEvent($event);
$this->response = $response;
return $this;
}
$response = $this->response;
$event->setResponse($response);
return $this->completeRequest($event);
}
/**
* Complete the request
Arguments
Closure($r): bool {#2 …4}
Laminas\Mvc\MvcEvent {#430}
} catch(Exception $e) {
//var_dump(debug_backtrace());
$gtgggg=[];
$gtgggg['err']=$e->getMessage();
$gtgggg['line']=$e->getLine();
$gtgggg['file']=$e->getFile();
$gtgggg['trace']=$e->getTrace();
$gtgggg['code']=$e->getCode();
d($gtgggg);
}
else:
Application::init(require 'config/' . PROJECT_ID_STRING . '/application.config.php')->run();
endif;