Initialize the call properties from a form call.

@param array $call
979111
private function initializeFromForm($call)
    {

        $this->action   = $call['extAction']; unset($call['extAction']);
        $this->method   = $call['extMethod']; unset($call['extMethod']);
        $this->type     = $call['extType']; unset($call['extType']);
        $this->tid      = $call['extTID']; unset($call['extTID']);
        $this->upload = $call['extUpload']; unset($call['extUpload']);

        foreach ($call as $key => $value) {
            $this->data[$key] = $value;
        }
    }
1209405
public function call($call, array $params = array())
    {
        $startTime = microtime(true);

        if (!array_key_exists('culture', $params)) {
            $params['culture'] = $this->culture;
        }

        $url = $this->generateUrl($call, $params);
        $this->logger->debug('call start', array(
            'url'      => $url,
        ));

        $key = $this->cache->generateCacheKey($url);
        $content = $this->cache->get($key);
        if ($content !== false) {
            $this->logger->debug('call end', array(
                'url'      => $url,
                'cache'    => true,
                'time'     => microtime(true) - $startTime,
                'response' => $content,
            ));

            return $content;
        }

        $request = $this->createRequest($url);

        if (!ini_get('open_basedir') && filter_var(ini_get('safe_mode'), FILTER_VALIDATE_BOOLEAN) === false) {
            $request->setOption(CURLOPT_FOLLOWLOCATION, true);
        }

        $response = $request->get();

        if ($request->getError()) {
            $this->throwError('The Api call returned an error: "' . $request->getError() . '"');
        }

        if ($request->getStatusCode() == 401) {
            $this->throwError('Bad Username / Password ' . $request->getStatusCode(), '\Justimmo\Exception\AuthenticationException');
        }

        if ($request->getStatusCode() == 404) {
            $this->throwError('Api call not found: ' . $request->getStatusCode(), '\Justimmo\Exception\NotFoundException');
        }

        if ($request->getStatusCode() >= 400 && $request->getStatusCode() < 500) {
            $exception = new InvalidRequestException('The Api call returned status code ' . $request->getStatusCode());
            $exception->setResponse($request->getContent());
            $this->logger->error($exception->getMessage());

            throw $exception;
        }

        if ($request->getStatusCode() != 200) {
            $this->throwError('The Api call returned status code ' . $request->getStatusCode(), '\Justimmo\Exception\StatusCodeException');
        }

        $this->cache->set($key, $response);

        $this->logger->debug('call end', array(
            'url'      => $url,
            'cache'    => false,
            'time'     => microtime(true) - $startTime,
            'response' => $response,
        ));

        return $response;
    }
1244854
public function init($args)
    {
        if (empty($args)) {
            return;
        }

        // Special case
        if (is_bool($args) && $args) {
            $args = $this->available;
        }

        // Iterate on all
        foreach ($args as $plugin => $settings) {
            $plugin = strtolower($plugin);

            if (!array_key_exists($plugin, $this->available)) {
                continue;
            }

            $plugin = str_replace('_', '-', $plugin);

            $function = Helpers::toFunctionFormat($plugin);
            $function = 'plugin'.ucfirst($function);
            $this->$function($settings);
        }
    }
1076439
protected function _initialize($property, $method) {
		if (is_string($method)) {
			$mode = self::MODE_JOIN;
			$sourcePrimary = null;
		}
		elseif (is_array($method)) {
			if (isset($method[self::SOURCE_METHOD], $method[self::SOURCE_MODE])) {
				$sourcePrimary = isset($method[self::SOURCE_PRIMARY]) ? $method[self::SOURCE_PRIMARY] : null;
				
				$mode   = $method[self::SOURCE_MODE];
				$method = $method[self::SOURCE_METHOD];
			}
			elseif (isset($method[0], $method[1])) {
				$sourcePrimary = isset($method[2]) ? $method[2] : null;
				
				$mode   = $method[1];
				$method = $method[0];
			}
			else {
				throw new Exception('Invalid source definition');
			}
		}
		else {
			throw new Exception('Source must be specified as a string or an array');
		}
		
		if ($this->hasCollection()) {
			$this->_initMany($property, $method, $mode, $sourcePrimary);
		} else {
			$this->_initOne($property, $method, $mode);
		}
	}
87874
public function init()
    {
        parent::init();

        if (!isset($this->options['options'])) {
            $this->options['options'] = [];
        }

        $this->options['multiple'] = $this->multiple;

        $this->parseItems();
        $this->insertPlaceholder();

        $this->registerPlugin('FormSelect');
    }
290608
function init() {
        $this->does_generate = ACTION_NONE;
        $this->title     = strtolower(get_class($this));
        $this->str       = array();
        $this->output    = NULL;
        $this->errormsg  = NULL;
        $this->subaction = NULL;
        $this->sesskey_protected = true;
    }
1022052
public function init()
    {
        $libPhoneNumber = PhoneNumberUtil::getInstance();
        $optionsList    = [];

        foreach ($libPhoneNumber->getSupportedRegions() as $code) {
            $fullTextCountry = \Locale::getDisplayRegion('en_' . $code, 'en');
            $optionsList[$code] = $fullTextCountry;
        }

        asort($optionsList);

        $this->setValueOptions($optionsList);
    }
778478
public function setProperties(array $properties = [])
    {
        foreach ($properties as $property => $value) {
            $method = 'set'.ucfirst($property);
            if (!method_exists($this, $method)) {
                throw new \RuntimeException("Undefined method $method.");
            }

            if (!in_array($property, $this->validProperties)) {
                throw new \Exception('You are trying to set invalid properties. Please check valid properties.');
            }

            $this->{$method}($value);
        }
    }
738866
public static function init($settings = null)
	{
		if (!is_null($settings))
			self::$settings = array_replace_recursive(self::$settings, $settings);
	}
1008838
private function validateCall(\stdClass $call)
    {
        $result = null;
        $error = null;
        $data = null;
        $id = is_object($call) && property_exists($call, 'id') ? $call->id : null;
        do {
            if (!is_object($call)) {
                $error = self::INVALIDREQUEST;
                break;
            }

            // hack for inputEx smd tester
            if (property_exists($call, 'version')) {
                if ($call->version == 'json-rpc-2.0') {
                    $call->jsonrpc = '2.0';
                }
            }

            if (!property_exists($call, 'jsonrpc') || $call->jsonrpc != '2.0') {
                $error = self::INVALIDREQUEST;
                break;
            }

            $fullMethod = property_exists($call, 'method') ? $call->method : '';
            $methodInfo = explode('.', $fullMethod, 2);
            $namespace = array_key_exists(1, $methodInfo) ? $methodInfo[0] : '';
            $method = $namespace ? $methodInfo[1] : $fullMethod;
            if (!$method || !array_key_exists($namespace, $this->instances) ||
                !method_exists($this->instances[$namespace], $method) ||
                in_array(strtolower($method), $this->hiddenMethods)) {
                $error = self::METHODNOTFOUND;
                break;
            }

            if (!array_key_exists($fullMethod, $this->reflectionMethods)) {
                $this->reflectionMethods[$fullMethod] = new \ReflectionMethod($this->instances[$namespace], $method);
            }

            /** @var $params array */
            $params = property_exists($call, 'params') ? $call->params : null;
            $paramsType = gettype($params);
            if ($params !== null && $paramsType != 'array' && $paramsType != 'object') {
                $error = self::INVALIDPARAMS;
                $data = 'Cast of params error';
                break;
            }

            // check parameters
            switch ($paramsType) {
                case 'array':
                    $totalRequired = 0;
                    // doesn't hold required, null, required sequence of params
                    foreach ($this->reflectionMethods[$fullMethod]->getParameters() as $param) {
                        if (!$param->isDefaultValueAvailable()) {
                            $totalRequired++;
                        }
                    }

                    if (count($params) < $totalRequired) {
                        $error = self::INVALIDPARAMS;
                        $data = sprintf(
                            'Check numbers of required params (got %d, expected %d)',
                            count($params),
                            $totalRequired
                        );
                    }
                    break;
                case 'object':
                    foreach ($this->reflectionMethods[$fullMethod]->getParameters() as $param) {
                        if (!$param->isDefaultValueAvailable() && !array_key_exists($param->getName(), $params)) {
                            $error = self::INVALIDPARAMS;
                            $data = $param->getName() . ' not found';

                            break 3;
                        }
                    }
                    break;
                case 'NULL':
                    if ($this->reflectionMethods[$fullMethod]->getNumberOfRequiredParameters() > 0) {
                        $error = self::INVALIDPARAMS;
                        $data = 'Empty required params';
                        break 2;
                    }
                    break;
            }
        } while (false);

        if ($error) {
            $result = [$error, $id, $data];
        }

        return $result;
    }
601625
private function initSettings($call, $settings = [])
    {
        if (!empty($settings['url']) && is_string($settings['url'])) {
            $this->settings['url'] = $settings['url'];
        } else {
            $this->settings['url'] = $this->url;
        }

        if (!empty($settings['version']) && is_string($settings['version'])) {
            $this->settings['version'] = $settings['version'];
        } else {
            $this->settings['version'] = $this->version;
        }

        $settings['call'] = $call;
        if (isset($settings['call']) && is_bool($settings['call'])) {
            $this->settings['call'] = $settings['call'];
        } else {
            $this->settings['call'] = $this->call;
        }

        if (isset($settings['secured']) && is_bool($settings['secured'])) {
            $this->settings['secured'] = $settings['secured'];
        } else {
            $this->settings['secured'] = $this->secure;
        }

        $this->changed = false;
    }
419145
public function processCall(Call $call)
    {
        if ($call->getRegistration() !== null) {
            throw new \Exception('Registration already set when asked to process call');
        }
        $call->setRegistration($this);

        $this->calls[] = $call;

        $this->session->incPendingCallCount();
        $callCount = count($this->calls);
        if ($callCount === 1) {
            // we just became busy
            $this->busyStart = microtime(true);
        }
        if ($callCount > $this->maxSimultaneousCalls) {
            $this->maxSimultaneousCalls = $callCount;
        }
        $this->invocationCount++;
        $this->lastCallStartedAt = new \DateTime();

        $this->getSession()->sendMessage($call->getInvocationMessage());
    }
878905
static function init(&$arr, $key, $default = null) 
    {
        if (! isset($arr[$key])) {
            $arr[$key] = $default;
        }
        return $arr[$key];
    }
541264
public function initialize()
    {
        if (empty($this->columnFilters)) {
            return;
        }

        $this->validNumberOfFilters();

        foreach ($this->all() as $filter) {
            if ($filter instanceof Initializable) {
                $filter->initialize();
            }
        }

        $this->validNumberOfFilters();

        $filters = collect($this->columnFilters);

        if ($filters->last() === null) {
            $filters->pop();
            $filters->push(new Control());
        }

        $this->columnFilters = $filters;

        $this->prepareView();
    }
350863
public function initFromArray(array $data) {

        $this->traitInitFromArray($data);

        if (!empty($data['funding'])) {
            $this->setFunding((new FundingPart())->initFromArray($data['funding']));
        }

        if (!empty($data['margin_call'])) {
            $this->setMarginCall((new MarginCallPart())->initFromArray($data['margin_call']));
        }

        if (!empty($data['accounts'])) {

            $this->setAccounts([]);

            foreach ($data['accounts'] as $currency => $details) {
                $details['currency'] = $currency;
                $this->accounts[] = (new AccountPart())->initFromArray($details);
            }

        }

        if (!empty($data['position'])) {
            $this->setPosition((new PositionPart())->initFromArray($data['position']));
        }

        return $this;

    }
1083079
protected function initialize()
    {
        $this->data = new stdClass();
        $this->data->method = self::METHOD_CREDIT_CARD;
        $this->data->creditCard = new stdClass();
        $this->data->creditCard->holder = new stdClass();
        $this->data->creditCard->holder->taxDocument = new stdClass();
        $this->data->creditCard->holder->phone = new stdClass();
    }
777189
@Override
    public void initialise(String root) {
        functionCalls.clear();
        variables.clear();
        initCreator(root);
    }