Symfony\Component\DependencyInjection\ContainerInterface::set PHP Method

set() public method

Sets a service.
public set ( string $id, object $service, string $scope = self::SCOPE_CONTAINER )
$id string The service identifier
$service object The service instance
$scope string The scope of the service
    function set($id, $service, $scope = self::SCOPE_CONTAINER);

Usage Example

Esempio n. 1
0
 protected function setUp()
 {
     // Global $config required by unique_id
     global $config, $phpbb_root_path, $phpEx;
     if (!is_array($config)) {
         $config = new \phpbb\config\config(array());
     }
     $config['rand_seed'] = '';
     $config['rand_seed_last_update'] = time() + 600;
     $this->request = $this->getMock('\\phpbb\\request\\request');
     $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper();
     $this->filesystem = new \phpbb\filesystem\filesystem();
     $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
     $guessers = array(new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(), new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(), new \phpbb\mimetype\content_guesser(), new \phpbb\mimetype\extension_guesser());
     $guessers[2]->set_priority(-2);
     $guessers[3]->set_priority(-2);
     $this->mimetype_guesser = new \phpbb\mimetype\guesser($guessers);
     $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
     $this->container->set('files.filespec', new \phpbb\files\filespec($this->filesystem, $this->language, $this->php_ini, new \FastImageSize\FastImageSize(), $phpbb_root_path, new \phpbb\mimetype\guesser(array('mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser()))));
     $this->factory = new \phpbb\files\factory($this->container);
     $plupload = new \phpbb\plupload\plupload($phpbb_root_path, $config, $this->request, new \phpbb\user($this->language, '\\phpbb\\datetime'), $this->php_ini, $this->mimetype_guesser);
     $this->container->set('files.types.form', new \phpbb\files\types\form($this->factory, $this->language, $this->php_ini, $plupload, $this->request), phpbb_mock_container_builder::SCOPE_PROTOTYPE);
     $this->container->set('files.types.local', new \phpbb\files\types\local($this->factory, $this->language, $this->php_ini, $this->request), phpbb_mock_container_builder::SCOPE_PROTOTYPE);
     $this->path = __DIR__ . '/fixture/';
     $this->phpbb_root_path = $phpbb_root_path;
 }
All Usage Examples Of Symfony\Component\DependencyInjection\ContainerInterface::set