@param string $name
@param array $input
@param string $type

@throws Exception

@return mixed
506875
private function parseRequiredClass($name, array $input, $type)
    {
        if (isset($input[$name]) && $input[$name] instanceof $type) {
            return $input[$name];
        }

        throw new Exception(sprintf("'%s' must be an instance of '%s'.", $name, $type));
    }
308448
protected static function _method($name, $value, $input, $type)
    {
        if( empty($name) )
        {
            return $input;
        }

        # @value parametresi boş değilse 5.4.7[edited]
        if( $value !== NULL )
        {
            switch( $type )
            {
                case 'post'    : $_POST[$name]    = $value; break;
                case 'get'     : $_GET[$name]     = $value; break;
                case 'request' : $_REQUEST[$name] = $value; break;
                case 'env'     : $_ENV[$name]     = $value; break;
                default        : $_POST[$name]    = $value; break;
            }

            return true;
        }

        if( isset($input[$name]) )
        {
            if( is_scalar($input[$name]) )
            {
                if( Json::check($input[$name]) )
                {
                    return $input[$name];
                }
                else
                {
                    return htmlspecialchars($input[$name], ENT_QUOTES, "utf-8");
                }
            }
            elseif( is_array($input[$name]) )
            {
                return array_map('ZN\Security\Html::encode', $input[$name]);
            }

            return $input[$name];
        }

        return false;
    }
598883
public static function isExistByNameType( $name, $type, $config = [] ) {

		$model	= self::findByNameType( $name, $type, $config );

		return isset( $model );
	}
158903
public function input($name, $val = null) {
        return isset($this->_requests[$name]) ?
                    $this->_requests[$name] :
                    $val;
    }
787946
public function requestField(string $type, string $name): void
    {
        $this->fields[$type][] = $name;
        $this->updateUriQuery();
    }
1295525
public function spitOutHtmlForModelInputToConsume($type, $input)
    {
        if ($type === 'select') {
            return $this->select([
                'default_text' => 'Please select a '.trim($input, '_id'),
                'type'         => $type,
                'name'         => $input,
            ], [
                false => 'No',
                true  => 'Yes',
            ]);
        } elseif (in_array($type, ['text', 'file', 'password', 'email', 'date', 'number'])) {
            return $this->input([
                'type'  => $type,
                'name'  => $input,
                'class' => 'form-control',
                'id'    => $this->genId($input),
                'value' => !method_exists($this->model, $input) && in_array($input, $this->model->getFillable())? $this->model->$input:  ''
            ]);
        }

        return $this->textarea(['type' => $type, 'name' => $input, 'id' => $this->genId($input)],
            (!empty($this->model->$input) && !(stripos($input,
                        'password') !== false)) ? $this->model->$input : '');
    }
376742
public function input($filename, $input)
    {
        if (substr($filename, strlen($this->_settings['ext']) * -1) !== $this->_settings['ext']) {
            return $input;
        }
        if (!class_exists('lessc')) {
            throw new \Exception('Cannot not load "lessc" class. Make sure it is installed.');
        }
        $lc = new lessc($filename);
        return $lc->parse();
    }
998070
public function begin($name, $type = 'replace')
    {
        $stacks = [$name, $type];
        if (!isset($this->opens[$name])) {
            $stacks[] = $this->placeholder($name);
        } elseif ($this->opens[$name]) {
            throw new BlockException($name, 'is opened');
        }

        $this->opens[$name] = true;
        $this->stacks[] = $stacks;
        ob_start();
    }
1220618
protected function createQuestion(string $name, $type): Question
    {
        if (!is_int($type)) {
            $type = strtoupper($type);
            $types = static::getRecordTypes();
            if (!array_key_exists($type, $types)) {
                throw new InvalidTypeError($type);
            }
            $type = $types[$type];
        } elseif (0 > $type || 0xffff < $type) {
            throw new InvalidTypeError($type);
        }

        $question = $this->questionFactory->create($type);
        $question->setName($name);

        return $question;
    }
187057
private function modelIdFromParameter(InputProviderInterface $input, $name)
    {
        if ($input->hasParameter($name) && ($value = $input->getParameter($name))) {
            return ModelId::fromSerialized($value);
        }

        return null;
    }
399092
public function call($name, $input)
	{
		$normalized_name = strtolower($name);

		if ( ! isset($this->handlers[$normalized_name]))
		{
			throw new UnexpectedValueException('No required handler: ' . $name, 1);
		}

		return $this->handlers[$normalized_name]($input);
	}
848540
private function instanciateField(string $name, string $type): FieldInterface
    {
        $fieldClass = $this->getFieldClass($type);
        $field = new $fieldClass($name);

        if (!$field instanceof FieldInterface) {
            throw new Exception("Field class \"{$fieldClass}\" must implements ".FieldInterface::class);
        }

        if ($field instanceof TranslatorAwareFieldInterface) {
            $field->setTranslator($this->translator);
        }
        if ($field instanceof TwigAwareFieldInterface) {
            $field->setTwig($this->twig);
        }

        return $field;
    }
153242
protected function _postback($name, &$default, $type = NULL)
    {
        if( isset($this->postback['bool']) && $this->postback['bool'] === true )
        {
            $method = ! empty($this->method) ? $this->method : $this->postback['type'];
    
            $this->postback = [];

            if( $type === 'checkbox' || $type === 'radio' )
            {
                if( $method::$name() === $default )
                {
                    $this->checked();
                }    
            }
            else
            {
                $default = Singleton::class('ZN\Validation\Data')->postBack($name, $method) ?: $default;
            }   
        }
    }
906141
private function getUserData(array $input, string $name)
    {
        if (stripos($name, '[') !== false) {
            $names = explode('[', str_replace(']', '', $name));

            $ref = &$input;
            $leave = false;

            while ($leave == false) {
                $key = array_shift($names);

                if ($key === '') {
                    $leave = true;
                } elseif (is_null($key)) {
                    $leave = true;
                } else {
                    $ref = &$ref[$key];
                }
            }

            if (is_array($ref) && array_key_exists(0, $ref) && (is_null($ref[0]) || $ref[0] === '')) {
                $ref = [];
            }

            return $ref;
        } else {
            return $input[$name] ?? null;
        }
    }
306228
public function parseOneFromArray(array $input)
    {
        if (true !== ($result = $this->hasRequiredKeys($input)))
        {
            throw new \Exception('Required elements not present: ' . print_r($result, true) . ' missing.' . PHP_EOL);
        }

        //Initialize item
        try
        {
            $item = $this->itemInit($input);
        } catch (\Exception $e)
        {
            throw new \Exception('Unable to initialize Item: ' . $e->getMessage() . PHP_EOL);
        }

        //Append data
        if (isset($input[static::DATA_KEY]))
        {
            $data = $input[static::DATA_KEY];
            if (true !== $this->isValidDataArray($data))
            {
                throw new \Exception('Item data cannot be parsed. Check it\'s format is the following
                \'data\' => array( array( \'name\', \'value\', \'prompt\') ). You can add as many inner arrays as you
                like, name and value are required fields.');
            }
            foreach ($data as $object)
            {
                $name = current($object);
                next($object);
                $value  = current($object);
                $prompt = '';
                if (next($object))
                {
                    $prompt = current($object);
                }
                $item->addData($name, $value, $prompt);
            }
        }

        return $item;
    }
262634
public static function getType($name, &$type=null) {
		if( !isset(static::$types[$name]) ) {
			throw new Exception('unknownType_'.$name);
		}
		$type	= &static::$types[$name];
		return $type;
	}
566258
public function on($type, $name, $callback)
    {
        $name = $type . '.' . $name;
        if (!isset($this->events[$name])) {
            $this->events[] = [];
        }

        $this->events[$name][] = $callback;
    }