PEEL Shopping
Open source ecommerce : PEEL Shopping
SimpleFunction.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of Twig.
5  *
6  * (c) 2010-2012 Fabien Potencier
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
18 {
19  protected $name;
20  protected $callable;
21  protected $options;
22  protected $arguments = array();
23 
24  public function __construct($name, $callable, array $options = array())
25  {
26  $this->name = $name;
27  $this->callable = $callable;
28  $this->options = array_merge(array(
29  'needs_environment' => false,
30  'needs_context' => false,
31  'is_safe' => null,
32  'is_safe_callback' => null,
33  'node_class' => 'Twig_Node_Expression_Function',
34  ), $options);
35  }
36 
37  public function getName()
38  {
39  return $this->name;
40  }
41 
42  public function getCallable()
43  {
44  return $this->callable;
45  }
46 
47  public function getNodeClass()
48  {
49  return $this->options['node_class'];
50  }
51 
52  public function setArguments($arguments)
53  {
54  $this->arguments = $arguments;
55  }
56 
57  public function getArguments()
58  {
59  return $this->arguments;
60  }
61 
62  public function needsEnvironment()
63  {
64  return $this->options['needs_environment'];
65  }
66 
67  public function needsContext()
68  {
69  return $this->options['needs_context'];
70  }
71 
72  public function getSafe(Twig_Node $functionArgs)
73  {
74  if (null !== $this->options['is_safe']) {
75  return $this->options['is_safe'];
76  }
77 
78  if (null !== $this->options['is_safe_callback']) {
79  return call_user_func($this->options['is_safe_callback'], $functionArgs);
80  }
81 
82  return array();
83  }
84 }
__construct($name, $callable, array $options=array())
Represents a node in the AST.
Definition: Node.php:18
Represents a template function.
setArguments($arguments)
getSafe(Twig_Node $functionArgs)

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:19 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.