Dodaje na początek stosu skrypt z pliku
@param string $src źródło
@param string $type typ
@param array $params dodatkowe parametry
@param string $conditional warunek np. ie6
@return \Mmi\Mvc\ViewHelper\HeadScript
776441
public function prependFile($src, $type = 'text/javascript', array $params = [], $conditional = '')
    {
        return $this->setFile($src, $type, $params, true, $conditional);
    }
702067
public function loadKey($type)
    {
        if (!in_array($type, [self::TYPE_PUBLIC, self::TYPE_PRIVATE])) {
            throw new \InvalidArgumentException(sprintf('The key type must be "public" or "private", "%s" given.', $type));
        }

        $rawKey = file_get_contents($this->getKeyPath($type));
        $key    = call_user_func_array("openssl_pkey_get_$type", self::TYPE_PRIVATE == $type ? [$rawKey, $this->getPassphrase()] : [$rawKey]);

        if (!$key) {
            $sslError = '';
            while ($msg = trim(openssl_error_string(), " \n\r\t\0\x0B\"")) {
                if ('error:' === substr($msg, 0, 6)) {
                    $msg = substr($msg, 6);
                }
                $sslError .= "\n $msg";
            }

            throw new \RuntimeException(
                sprintf('Failed to load %s key: %s', $type, $sslError)
            );
        }

        return $key;
    }
484938
private function sign($type, &$params)
	{

		ksort($params);
		$str4sign = implode('|', $params);
		$sign = md5($str4sign . $type . $this->configParams['secretKey']);

		return $sign;

	}
901829
public static function cast($value, Closure $condition, $type, $default = NULL) {
    return $condition($value) == TRUE ? settype($value, $type) : $default;
  }
360862
function blockHeaderFromRpc (blockParams) {
  const blockHeader = new BlockHeader({
    parentHash: blockParams.parentHash,
    uncleHash: blockParams.sha3Uncles,
    coinbase: blockParams.miner,
    stateRoot: blockParams.stateRoot,
    transactionsTrie: blockParams.transactionsRoot,
    receiptTrie: blockParams.receiptRoot || blockParams.receiptsRoot || ethUtil.SHA3_NULL,
    bloom: blockParams.logsBloom,
    difficulty: blockParams.difficulty,
    number: blockParams.number,
    gasLimit: blockParams.gasLimit,
    gasUsed: blockParams.gasUsed,
    timestamp: blockParams.timestamp,
    extraData: blockParams.extraData,
    mixHash: blockParams.mixHash,
    nonce: blockParams.nonce
  })

  // override hash incase something was missing
  blockHeader.hash = function () {
    return ethUtil.toBuffer(blockParams.hash)
  }

  return blockHeader
}
893485
public function send($type, $params) {
		if (empty($params['t']) && $type !== null) {
			$params['t'] = $type;
		}
		$params = $this->_appendDefaultParameters($params);
		$this->_client->setParameterPost($params);
		
		return $this->_client->request('POST', $params);
	}
1338524
public function error($type, $message, $field = null, $options = []) {
		// if its an array of message we process them one by one
		if (is_array($message)) {
			foreach ($message as $v) {
				$this->error($type, $v, $field, $options);
			}
			return;
		}
		// generate hash
		if (!empty($options['unique_options_hash'])) {
			$hash = sha1($message . serialize($options));
		} else {
			$hash = sha1($message);
		}
		// i18n
		if (empty($options['skip_i18n'])) {
			$message = i18n(null, $message, $options);
		}
		// set field error
		if (!empty($field)) {
			if ($type == 'reset') {
				unset($this->errors['fields'][$field]);
				// recalculate
				$this->errors['flag_error_in_fields'] = false;
				$this->errors['flag_warning_in_fields'] = false;
				if (!empty($this->errors['fields'])) {
					foreach ($this->errors['fields'] as $k => $v) {
						foreach ($v as $k2 => $v2) {
							if ($k2 == 'danger') $this->errors['flag_error_in_fields'] = true;
							if ($k2 == 'warning') $this->errors['flag_warning_in_fields'] = true;
						}
					}
				}
			} else {
				array_key_set($this->errors, ['fields', $field, $type, $hash], $message);
				// modals
				if (!empty($this->fields[$field])) {
					$container_link = $this->fields[$field]['options']['container_link'];
					if (($this->data[$container_link]['type'] ?? '') == 'modal') {
						$this->misc_settings['errors_in_modal'][$container_link] = $this->data[$container_link]['options']['modal_id'];
					}
				}
				// set special flag that we have error in fields
				if ($type == 'danger') {
					$this->errors['flag_error_in_fields'] = true;
					$this->errors['flag_num_errors']++;
				}
				if ($type == 'warning') {
					$this->errors['flag_warning_in_fields'] = true;
				}
				// format
				if (!empty($options['format'])) {
					array_key_set($this->errors, ['formats', $field, $type], 1);
				}
			}
		} else {
			if ($type == 'reset') {
				$this->errors['general'] = [];
				$_SESSION['numbers']['forms'][$this->options['parent_form_link'] ?? $this->form_link]['messages'] = [];
				return;
			}
			// subforms need to display messages on parent form
			if (!empty($this->options['on_success_refresh_parent']) && !empty($this->options['parent_form_link']) && $type != 'danger') {
				$_SESSION['numbers']['forms'][$this->options['parent_form_link']]['messages'][$type][$hash] = $message;
				$this->misc_settings['form_postponed_messages'] = true;
				return;
			}
			// regular postponed messages
			if (!empty($options['postponed'])) {
				$_SESSION['numbers']['forms'][$this->options['parent_form_link'] ?? $this->form_link]['messages'][$type][$hash] = $message;
				$this->misc_settings['form_postponed_messages'] = true;
				return;
			}
			// regular messages
			$this->errors['general'][$type][$hash] = $message;
			if ($type == 'danger') {
				$this->errors['flag_num_errors']++;
			}
		}
	}
1321215
public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type)
    {
        $params     = $compiler->getCompiledParams($params);
        $func       = $params['__funcname'];
        $pluginType = $params['__functype'];
        $params     = $params['*'];

        if ($pluginType & Core::CUSTOM_PLUGIN) {
            $customPlugins = $compiler->getCore()->getCustomPlugins();
            $callback      = $customPlugins[$func]['callback'];
            if (is_array($callback)) {
                if (is_object($callback[0])) {
                    $callback = '$this->customPlugins[\'' . $func . '\'][0]->' . $callback[1] . '(';
                } else {
                    $callback = '' . $callback[0] . '::' . $callback[1] . '(';
                }
            } else {
                $callback = $callback . '(';
            }
        } else {
            $callback = 'smarty_block_' . $func . '(';
        }

        $paramsOut = '';
        foreach ($params as $i => $p) {
            $paramsOut .= var_export($i, true) . ' => ' . $p . ',';
        }

        $curBlock                      = &$compiler->getCurrentBlock();
        $curBlock['params']['postOut'] = Compiler::PHP_OPEN . ' $_block_content = ob_get_clean(); $_block_repeat=false; echo ' . $callback . '$_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);' . Compiler::PHP_CLOSE;

        return Compiler::PHP_OPEN . $prepend . ' if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(' . $paramsOut . '); $_block_repeat=true; ' . $callback . '$_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();' . Compiler::PHP_CLOSE;
    }
230731
protected function bindCondition($type, $key, $values = [])
    {
        $conditionHolder = "{$type}Conditions";
        if (!is_array($values)) {
            $values = [$values];
        }

        array_push($this->$conditionHolder, [$key, $values]);

        return $this;
    }
973327
public function random($length = 32, $type = self::RAND_ALL)
    {
        $string = '';

        // todo: make to halper?
        foreach ($this->dictionary as $pos => $item)
        {
            $key = (1 << $pos);
            if ($type >= $key)
            {
                $string .= $item;
                $type -= $key;
            }
        }

        if (empty($string))
        {
            throw new \InvalidArgumentException("Invalid random string type [{$type}].");
        }

        return $this->rand($string, $length);
    }
1370532
public function encodeParameter($type, $param)
    {
        if (!is_string($type)) {
            throw new InvalidArgumentException('The type to encodeParameter must be string.');
        }
        return $this->encodeParameters([$type], [$param]);
    }
978229
final protected function createSourceElement($type, $src)
    {
        // Tag attributes
        $attrs = array(
            'src' => $src,
            'type' => $type
        );

        $node = new NodeElement();

        return $node->openTag('source')
                    ->addAttributes($attrs)
                    ->finalize(true);
    }
519923
public static function run($type = 'web', $session = true)
    {
        $lumos = $type == 'lumos' ? true : false;
        static::init($type);

        //Support Surface
        static::support();

        //Version Surface
        static::version();

        //Logging Surface
        static::logging();

        //Input Surface
        static::input();

        if ($type == 'test') {
            //Mock Surface
            static::mock();
        }

        //Config Surface
        static::config($type == 'test' ? true : false);

        //Environment Surface
        static::environment();

        //Maintenance Surface
        static::maintenance($lumos);

        //Time Surface
        static::time();

        //Initiate the Logging Surface
        static::initLogging();

        //Component Surface
        static::component();

        //Cubes Surface
        static::cubes();

        //Collections Surface
        static::collections();

        //Storage Surface
        static::storage($session);

        //Strings Surface
        static::string();

        //Access Surface
        static::access();

        //Validation Surface
        static::validation();

        //Call Faker Surface if enabled in Component surface
        if (Component::isOn('faker')) {
            static::faker();
        }

        //Cookie Surface
        static::cookie();

        //Router Surface
        static::router();

        //Caches Surface
        static::caches();

        //Security Surface
        static::security();

        //Auth Surface
        static::auth();

        //Call Database Surface if enabled in Component surface
        if (Component::isOn('database')) {
            static::database();
        }

        //HTTP Surface
        static::http();

        //Assets Surface
        static::assets();

        //HTML Surface
        static::html();

        //Hypertext Surface
        //Depracted
        static::Hypertext();

        //Translator Surface
        static::translator();

        //Model Surface
        static::model();

        //Relations Surface
        static::relations();

        //Media Surface
        static::media();

        //Views Surface
        static::view();

        //Controllers Surface
        static::controller();

        //Mail Surface
        static::mail();

        //Data Collection Surface
        static::dataCollection();

        //Files Surface
        static::file();

        //Intro Surface
        static::intro();

        //Plugins Surface
        static::plugins();

        //Lumos Surface
        static::lumos();

        //Atomium Surface
        static::atomium();

        //Proccess Surface
        static::proccess();

        //Setup Surface
        static::setup();

        //Events Surface
        static::event();

        //Tests Surface
        static::test();
    }
1357667
public static function createFromSource($source, $type, array $options = []) {
		if (isset(self::$readers[$type])) {
			$reader = self::$readers[$type];
		} else {
			$class  = self::READERS_NAMESPACE . '\\' . ucfirst($type);
			$reader = new $class();

			if (! $reader instanceof ReaderInterface) {
				throw new InvalidReader('Reader must implement the "ReaderInterface"');
			}
			
			self::$readers[$type] = $reader;
		}
		
		// Read only lock resolve
		if (isset($options[self::OPTION_READONLY])) {
			$readOnly = (bool) $options[self::OPTION_READONLY];
			unset($options[self::OPTION_READONLY]);
		} else {
			$readOnly = true;
		}
		
		return self::create($reader->parse($source, $options), $readOnly);
	}
318608
public static <T> T deepBoxAs(Object src, Class<T> type) {
        return (T) deepBox(type, src);
    }
85074
public static function altEncrypt(
        $value,
        $hash = false,
        $method = self::DEFAULT_CHIPPER
    ) {
        /**
         * Serialize Element
         */
        $string = @serialize([
            $value
        ]);
        if (!$string) {
            throw new \ErrorException(
                sprintf(
                    'Could not serialize input of %s',
                    gettype($string)
                )
            );
        }
        $passKey   = self::createPassKey($hash);
        $crypt_arr = self::cryptStandard(
            $passKey[1],
            $string,
            $method
        );

        $microtime = microtime(true);
        $iv = self::safeBase64Encode($method . $crypt_arr[2]);
        $json_value = json_encode([
            'micro'  => $microtime,
            'method' => $crypt_arr[1],
            'iv'     => $iv,
            'value'  => $crypt_arr[0],
        ]);

        // save as bse64 encode safe
        $crypt_text = trim(
            self::safeBase64Encode(
                $json_value .
                json_encode([
                    sha1($microtime . $passKey[1] . $iv)
                ])
            )
        );

        /**
         * ------------------------------------
         * Inject Result of with sign
         * ------------------------------------
         */
        $pos = abs(round(strlen($passKey[0]) / 3));
        $separator = self::safeBase64Encode(sha1($passKey[1]) . self::STANDARD_MIDDLE);
        if (strlen($crypt_text) > $pos) {
            return substr_replace($crypt_text, $separator . $pos, $pos, 0);
        } else {
            return substr_replace($crypt_text, $separator . $pos, 2, 0);
        }
    }
1361505
static function of ($src)
  {
    $x = new static;
    switch (true) {
      case is_array ($src):
        $x->A = $src;
        break;
      case $src instanceof IteratorAggregate:
        $x->A = iterator_to_array ($src->getIterator ());
        break;
      case $src instanceof Iterator:
        $x->A = iterator_to_array ($src);
        break;
      default:
        throw new InvalidArgumentException;
    }
    return $x;
  }