MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
HelperSet.php
Ir para a documentação deste ficheiro.
1<?php
2
4
6
7/*
8 * This file is part of the Symfony framework.
9 *
10 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
11 *
12 * This source file is subject to the MIT license that is bundled
13 * with this source code in the file LICENSE.
14 */
15
22{
23 protected $helpers;
24 protected $command;
25
29 public function __construct(array $helpers = array())
30 {
31 $this->helpers = array();
32 foreach ($helpers as $alias => $helper) {
33 $this->set($helper, is_int($alias) ? null : $alias);
34 }
35 }
36
43 public function set(HelperInterface $helper, $alias = null)
44 {
45 $this->helpers[$helper->getName()] = $helper;
46 if (null !== $alias) {
47 $this->helpers[$alias] = $helper;
48 }
49
50 $helper->setHelperSet($this);
51 }
52
60 public function has($name)
61 {
62 return isset($this->helpers[$name]);
63 }
64
74 public function get($name)
75 {
76 if (!$this->has($name)) {
77 throw new \InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
78 }
79
80 return $this->helpers[$name];
81 }
82
88 public function setCommand(Command $command = null)
89 {
90 $this->command = $command;
91 }
92
98 public function getCommand()
99 {
100 return $this->command;
101 }
102}
__construct(array $helpers=array())
Definição HelperSet.php:29