Documentation

內容目录

上一个主题

< Abstract class Phalcon\Di\Injectable

下一个主题

Class Phalcon\Di\Service\Builder >

本页

Class Phalcon\Di\Service

implements Phalcon\Di\ServiceInterface

Source on GitHub

Represents individually a service in the services container

<?php

 $service = new \Phalcon\Di\Service('request', 'Phalcon\Http\Request');
 $request = service->resolve();
<?php

Methods

final public __construct (string $name, mixed $definition, [boolean $shared])

public getName ()

Returns the service’s name

public setShared (unknown $shared)

Sets if the service is shared or not

public isShared ()

Check whether the service is shared or not

public setSharedInstance (mixed $sharedInstance)

Sets/Resets the shared instance related to the service

public setDefinition (mixed $definition)

Set the service definition

public mixed getDefinition ()

Returns the service definition

public mixed resolve ([array $parameters], [Phalcon\DiInterface $dependencyInjector])

Resolves the service

public setParameter (unknown $position, array $parameter)

Changes a parameter in the definition without resolve the service

public array getParameter (int $position)

Returns a parameter in a specific position

public isResolved ()

Returns true if the service was resolved

public static __set_state (array $attributes)

Restore the internal state of a service

Follow along: