Get Functions

@return array
338227
public function getFunctions()
	{
        // dump is safe if var_dump is overridden by xdebug
        $isDumpOutputHtmlSafe = extension_loaded('xdebug')
            // false means that it was not set (and the default is on) or it explicitly enabled
            && (false === ini_get('xdebug.overload_var_dump') || ini_get('xdebug.overload_var_dump'))
            // false means that it was not set (and the default is on) or it explicitly enabled
            // xdebug.overload_var_dump produces HTML only when html_errors is also enabled
            && (false === ini_get('html_errors') || ini_get('html_errors'))
            || 'cli' === PHP_SAPI;

		return [
			new Twig_SimpleFunction('d', [$this, 'd']),
			new Twig_SimpleFunction('dd', [$this, 'dd']),
            new Twig_Function('dump', [$this, 'dump'], [
                'is_safe'           => $isDumpOutputHtmlSafe ? ['html'] : [],
                'needs_context'     => true,
                'needs_environment' => true,
            ]),
		];
	}
279702
public function getFunctions()
    {
        return array(
            new Twig_SimpleFunction('max', 'max'),
            new Twig_SimpleFunction('min', 'min'),
            new Twig_SimpleFunction('range', 'range'),
            new Twig_SimpleFunction('constant', 'twig_constant'),
            new Twig_SimpleFunction('cycle', 'twig_cycle'),
            new Twig_SimpleFunction('random', 'twig_random', array('needs_environment' => true)),
            new Twig_SimpleFunction('date', 'twig_date_converter', array('needs_environment' => true)),
            new Twig_SimpleFunction('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))),
            new Twig_SimpleFunction('source', 'twig_source', array('needs_environment' => true, 'is_safe' => array('all'))),
        );
    }
295531
public function get(/* ... */) {
        $args = func_get_args();
        array_unshift($args, $this->cfg);
        return call_user_func_array(array($this, "_get"), $args);
    }
286840
function &functions()
    {
        $functions = array();
        $packages = $this->packages(); // not by reference so as not to move the internal array pointer
        foreach ($packages as $name => $package) {
            $packageFunctions = $this->_packages[$name]->functions(); // not by reference so as not to move the internal array pointer
            if ($packageFunctions) {
                foreach ($packageFunctions as $key => $pack) {
                    $functions[$name.'.'.$key] =& $packageFunctions[$key];
                }
            }
        }

        return $functions;
    }
417117
public function getFunctions() {
        return [
            new Twig_SimpleFunction(
                'plupload',
                function($view = null, $browse_button = null, $prefix = null, $additional_data = array()){

                    $view = (true === is_null($view)) ? \Config::get('plupload::plupload.view') : $view;
                    $prefix = (true === is_null($prefix)) ? 'plupload_'.uniqid() : $prefix;
                    $browse_button = (true === is_null($browse_button)) ? $prefix.'_browse' : $browse_button;

                    return \View::make($view, array(
                        'upload_handler' => \Config::get('plupload::plupload.upload_handler'),
                        'browse_button_id' => $browse_button,
                        'prefix' => $prefix,
                        'handler_gate' => \Config::get('plupload::plupload.upload_handler_gate'),
                        'max_file_size' => \Config::get('plupload::plupload.max_file_size'),
                        'additional_data' => $additional_data,
                    ));
                }
            )
        ];
    }
442134
def functions
      @functions ||= @api_info.fetch("functions").inject({}) do |acc, func|
        function = Function.new(func)
        acc.merge(function.name => function)
      end
    end
881960
public function getListFunctions() {
		if($this->listFunctions) return $this->listFunctions;

		$list = array ();
		foreach(ClassInfo::implementorsOf('SS_List') as $class) {
			$r = new ReflectionClass($class);			
			$methods = $r->getMethods();
			if($methods) {
				foreach($methods as $m) {
					$name = $m->getName();					
					if(preg_match("/[A-Z]/",$name[0])) {
						$list[] = strtolower($name);
					}											
				}
			}
		}

		return $this->listFunctions = $list;
	}
1021233
public function getFunctions()
    {
        return [
            new Twig_SimpleFunction('embedly_display', array($this->client, 'display')),
            new Twig_SimpleFunction('embedly_extract', array($this->client, 'extract')),
            new Twig_SimpleFunction('embedly_oembed', array($this->client, 'oembed')),
        ];
    }
1237991
public function get(): array
    {
        $pdoStatement = $this->provideStatement();
        $pdoStatement = $this->execute($pdoStatement);
        return $pdoStatement->fetchAll(\PDO::FETCH_OBJ);
    }
932452
public function getServices()
    {
        return [
            self::INFLECTOR           => function () { return Inflector::get('en');},
            self::APPLICATION_RUNTIME => function () { return new ApplicationRuntime();},
            self::CONFIG_FACTORY      => function () { return new ConfigFactory();}
        ];
    }
63455
public function getFunctions() {
        return [
            new TwigFunction("bootstrapAlertDanger", [$this, "bootstrapAlertDangerFunction"], ["is_safe" => ["html"]]),
            new TwigFunction("bsAlertDanger", [$this, "bootstrapAlertDangerFunction"], ["is_safe" => ["html"]]),

            new TwigFunction("bootstrapAlertInfo", [$this, "bootstrapAlertInfoFunction"], ["is_safe" => ["html"]]),
            new TwigFunction("bsAlertInfo", [$this, "bootstrapAlertInfoFunction"], ["is_safe" => ["html"]]),

            new TwigFunction("bootstrapAlertLink", [$this, "bootstrapAlertLinkFunction"], ["is_safe" => ["html"]]),
            new TwigFunction("bsAlertLink", [$this, "bootstrapAlertLinkFunction"], ["is_safe" => ["html"]]),

            new TwigFunction("bootstrapAlertSuccess", [$this, "bootstrapAlertSuccessFunction"], ["is_safe" => ["html"]]),
            new TwigFunction("bsAlertSuccess", [$this, "bootstrapAlertSuccessFunction"], ["is_safe" => ["html"]]),

            new TwigFunction("bootstrapAlertWarning", [$this, "bootstrapAlertWarningFunction"], ["is_safe" => ["html"]]),
            new TwigFunction("bsAlertWarning", [$this, "bootstrapAlertWarningFunction"], ["is_safe" => ["html"]]),
        ];
    }
41084
public function getFunctions()
    {
        return [
            /**
             * Evaluate a rule by name.
             */
            new ExpressionFunction(
                'money',
                function () {
                    throw new RuntimeException(
                        'Function "money" can\'t be compiled.'
                    );
                },
                function (array $context, $amount, $currencyIso = null) {

                    if ($currencyIso === null) {
                        $currency = $this
                            ->defaultCurrencyWrapper
                            ->get();
                    } else {
                        /**
                         * @var CurrencyInterface $currency
                         */
                        $currency = $this
                            ->currencyRepository
                            ->findOneBy([
                                'iso' => $currencyIso,
                            ]);
                    }

                    return Money::create(
                        $amount * 100,
                        $currency
                    );
                }
            ),
        ];
    }
859905
protected function getFunctions($type = null)
    {
        $funcs = \get_defined_functions();

        if ($type) {
            return $funcs[$type];
        } else {
            return \array_merge($funcs['internal'], $funcs['user']);
        }
    }
1352967
public function getFunctions () {
		return [
			//==============================================
			//base
			//==============================================
			new \Twig_Function('asset',					[$this, 'asset']),
			new \Twig_Function('asset_common',			[$this, 'assetCommon']),
			new \Twig_Function('asset_cdn',				[$this, 'assetCdn']),
			new \Twig_Function('make_url',				[$this, 'makeUrl']),
			new \Twig_Function('make_domain_url',		[$this, 'makeDomainUrl']),
			new \Twig_Function('make_force_domain_url',	[$this, 'makeForceDomainUrl']),
			new \Twig_Function('current_url',			[$this, 'currentUrl']),
			new \Twig_Function('current_full_url',		[$this, 'currentFullUrl']),
			new \Twig_Function('filter',				[$this, 'filter'], ['needs_environment' => true]),
			new \Twig_Function('replace_sub_domain',	[$this, 'replaceSubDomain']),
			new \Twig_Function('action_switch',			[$this, 'actionSwitch']),

			//==============================================
			//var type
			//==============================================
			new \Twig_Function('var_dump',		'var_dump'),

			new \Twig_Function('empty',			[$this, 'isEmpty']),

			new \Twig_Function('adjust_array',	'\ickx\fw2\vartype\arrays\Arrays::AdjustArray'),
			new \Twig_Function('array_unshift',	[$this, 'arrayUnshift']),
			new \Twig_Function('array_push',	[$this, 'arrayPush']),
			new \Twig_Function('array_add',		[$this, 'arrayAdd']),
			new \Twig_Function('array_merge',	[$this, 'merge']),
			new \Twig_Function('implode',		'implode'),
			new \Twig_Function('explode',		'explode'),
			new \Twig_Function('array_filter',	'array_filter'),

			new \Twig_Function('merge',			[$this, 'merge']),

			new \Twig_Function('late_array_bind',	[$this, 'lateArrayBind']),

			//==============================================
			//Native Functions
			//==============================================
			new \Twig_Function('time',	'time'),
			new \Twig_Function('date',	'date'),

			//==============================================
			//disp support
			//==============================================
			new \Twig_Function('adjust',		[$this, 'adjust']),
			new \Twig_Function('params_adjust',	[$this, 'paramsAdjust']),
			new \Twig_Function('sprintf',		'sprintf'),
			new \Twig_Function('has_validator',	[$this, 'hasValidator']),
			new \Twig_Function('elvis',			[$this, 'elvis']),
			new \Twig_Function('switch',		[$this, 'elvis']),

			new \Twig_Function('make_id',		[$this, 'makeId']),

			new \Twig_Function('json_encode',	[$this, 'jsonEncode']),
			new \Twig_Function('json_decode',	[$this, 'jsonDecode']),

			//==============================================
			//form data set
			//==============================================
			//form status
			new \Twig_Function('form_open',				[$this, 'formOpen']),
			new \Twig_Function('form_status',			[$this, 'formStatus']),
			new \Twig_Function('is_post_form',			[$this, 'isPostForm']),
			new \Twig_Function('form_close',			[$this, 'formClose']),
			//file upload
			new \Twig_Function('file_upload',			[$this, 'fileUpload']),
			//CURRENT REQUEST data
			new \Twig_Function('exist_request_data',	[$this, 'existRequestData']),
			new \Twig_Function('request_data',			[$this, 'getRequestData']),
			new \Twig_Function('request_data_set',		[$this, 'getRequestDataSet']),
			//GET parameter
			new \Twig_Function('exist_parameter',		[$this, 'existParameter']),
			new \Twig_Function('parameter',				[$this, 'getParameter']),
			new \Twig_Function('parameters',			[$this, 'getParameters']),
			//POST data
			new \Twig_Function('exist_form_data',		[$this, 'existFormData']),
			new \Twig_Function('form_data',				[$this, 'getFormData']),
			new \Twig_Function('form_data_set',			[$this, 'getFormDataSet']),
			//message
			//error
			new \Twig_Function('exist_errors',			[$this, 'existError']),
			new \Twig_Function('errors',				[$this, 'getError']),
			new \Twig_Function('errors_set',			[$this, 'getErrorSet']),
			//warn
			new \Twig_Function('exist_warns',			[$this, 'existWarn']),
			new \Twig_Function('warns',					[$this, 'getWarn']),
			new \Twig_Function('warns_set',				[$this, 'getWarnSet']),
			//info
			new \Twig_Function('exist_infos',			[$this, 'existInfo']),
			new \Twig_Function('infos',					[$this, 'getInfo']),
			new \Twig_Function('infos_set',				[$this, 'getInfoSet']),
		];
	}
1286568
public static function loadFunctions() {
		
		// load defaults
		$functionDir = Config::getOption("sourceDir").DIRECTORY_SEPARATOR."_twig-components/functions";
		$functionExt = Config::getOption("twigFunctionExt");
		$functionExt = $functionExt ? $functionExt : "function.php";
		
		if (is_dir($functionDir)) {
			
			// loop through the function dir...
			$finder = new Finder();
			$finder->files()->name("*\.".$functionExt)->in($functionDir);
			$finder->sortByName();
			foreach ($finder as $file) {
				
				// see if the file should be ignored or not
				$baseName = $file->getBasename();
				if ($baseName[0] != "_") {
					
					include($file->getPathname());
					
					// $function should be defined in the included file
					if (isset($function)) {
						self::$instance->addFunction($function);
						unset($function);
					}
					
				}
				
			}
			
		}
		
	}
488845
protected function getCustomDateTimeFunctions()
    {
        $functions = (array) $this->getOption('custom_datetime_functions');

        return array_filter(
            $functions,
            function ($name) {
                return is_string($name);
            },
            ARRAY_FILTER_USE_KEY
        );
    }
76062
public function getFunction($name)
    {
        if (!$this->initialized) {
            $this->initialize();
        }

        return isset($this->functions[$name]) ? $this->functions[$name] : null;
    }