Map named constructor.

@param string  $type
@param mixed[] $input

@return \PlanB\DS\Map\Map
767757
public static function typed(string $type, iterable $input = []): Map
    {
        $resolver = Resolver::typed($type);

        return new static($input, $resolver);
    }
446772
public function setTypes($attr, $type = null)
    {
        if (is_array($attr))
            $this->inputType = array_merge($this->inputType, $attr);
        else
            $this->inputType[$attr] = $type;

        return $this;
    }
927012
public function generateInput($type, array $data)
	{
		$class = $this->getElementInstance($type);

		if (array_key_exists('attributes', $data))
		{
			$class->setAttributes($data['attributes']);
		}

		if (array_key_exists('content', $data))
		{
			$class->setContents(
				  $this->generate($data['content'])
			);
		}

		if (array_key_exists('name', $data))
		{
			$class->setName($data['name']);
		}

		if (array_key_exists('value', $data))
		{
			$class->setValue($data['value']);
		}

		if (array_key_exists('label', $data))
		{
			$class->setLabel($data['label']);
		}

		return $class;
	}
1117722
public function create(Array $input)
    {
        $result = $this->model->create($input);

        return $this->export($result);
    }
446181
public function addInput(Input $input)
    {
        $reflection = new \ReflectionClass($input);

        $method = 'add'.$reflection->getShortName();

        if (method_exists($this, $method)) {
            $this->$method(...array_values($input->getAttributes()));
        }
    }
749632
public static function createFromArray(array $input)
    {
        if (3 != count($input)) {
            throw new InvalidArgumentException(
                sprintf("%s() expects an array with exactly three elements", __METHOD__)
            );
        }
        if (array_key_exists('A', $input) && array_key_exists('B', $input) && array_key_exists('C', $input)) {
            return new self($input['A'], $input['B'], $input['C']);
        }
        return new self(array_shift($input), array_shift($input), array_shift($input));
    }
457388
public function map($use, $type, $options = [])
    {
        if (!isset($this->_maps[$use])) {
            $this->_maps[$use] = [];
        }
        if ($options) {
            $this->_maps[$use] = array_merge([$type => $options], $this->_maps[$use]);
        } else {
            $this->_maps[$use] += [$type => []];
        }
    }
49224
public static function createFromArray(array $input)
    {
        if (!empty($input['empty'])) {
            return static::createEmpty();
        }
        foreach (['lower', 'upper', 'lowerInclusive', 'upperInclusive'] as $key) {
            if (array_key_exists($key, $input)) {
                return new static(
                    array_key_exists('lower', $input) ? $input['lower'] : null,
                    array_key_exists('upper', $input) ? $input['upper'] : null,
                    array_key_exists('lowerInclusive', $input) ? $input['lowerInclusive'] : true,
                    array_key_exists('upperInclusive', $input) ? $input['upperInclusive'] : false
                );
            }
        }
        return new static(array_shift($input), array_shift($input));
    }
1198092
public function create( $inputs = [] )
	{
		$columns = [];
		$placeholders = [];
		$values = [];

		foreach( $inputs as $column => $value )
		{
			$columns []= "`$column`";
			$placeholders []= ":$column";
			$values[":$column"] = $value;
		}

		$keys = implode(',', $columns);
		$placeholders = implode(',', $placeholders);

		$this->_exec_( "INSERT INTO `{$this->table}` ( $keys ) VALUES ( $placeholders )", $values );

		return $this->insert_id();
	}
1235278
public function getType($input)
    {
        // Make an array to loop through
        $inputs = explode('|', $input);

        foreach ($inputs as $index => $input) {
            $list = (bool) preg_match('/\[\]$/', $input);
            if ($list === true) {
                $input = substr($input, 0, -2);
            }

            // make the type case insensitive
            $type = strtolower(trim($input));

            // Check if we can convert the type to a known type
            if (array_key_exists($type, $this->phpTypeMapping) === true) {
                $type = $this->phpTypeMapping[$type];
            }

            // Check if it is a predefined type
            if (in_array($type, $this->phpTypes) === true) {
                $inputs[$index] = $type . ($list ? '[]' : '');
                continue;
            }

            // Reset the type. Maybe it is a class definition
            $type = $input;

            if (
                $this->isClassDefined($type) === true ||
                $this->isInterfaceDefined($type) === true ||
                $this->isTraitDefined($type) === true
            ) {
                $inputs[$index] = $type . ($list ? '[]' : '');
                continue;
            }

            throw Exception\Type::isNotDefined($type);
        }

        return implode('|', $inputs);
    }
364447
@Override
    public Object map(Object input) {
        Number n = (Number) input;
        if (inputSchema.getMetaData(columnNumber).isValid(new IntWritable(n.intValue()))) {
            return input;
        } else {
            return value;
        }
    }
474767
public function with_input( array $input = null ) {
		$this->get_session()->flash_input(
			$this->clean_input( ! is_null( $input ) ? $input : $this->get_request()->input() )
		);

		return $this;
	}
697227
private function createConstructor(array $types)
    {
        $classmap = [];

        foreach ($types as $name => $type) {
            if ($type instanceof GeneratorInterface) {
                $classmap[] = sprintf("        '%s' => '%s',", $name, $type->getPhpIdentifier());
            }
        }

        $classmap = implode("\n", $classmap);

        $generator = new MethodGenerator('__construct');
        $generator->setDocBlock('Constructor.');
        $generator->setBody(
            <<<CODE
        parent::__construct(\$user->resolveWsdl(self::ENDPOINT), \$dispatcher, \$user, [
    'classmap' => [
{$classmap}
    ]
]);
CODE
        );
        $generator->setParameter($this->createParameter('dispatcher', 'EventDispatcherInterface'));
        $generator->setParameter($this->createParameter('user', 'User'));

        $this->addTag($generator, $this->createParamTag('dispatcher', 'EventDispatcherInterface'));
        $this->addTag($generator, $this->createParamTag('user', 'User'));

        return $generator;
    }
292587
public function load($input)
    {
        foreach ($this->strategies as $strategy) {
            if ($strategy->supports($input)) {
                return array_map([$this, 'createJsonDefinition'], $strategy->load($input));
            }
        }

        return [];
    }
539478
protected function _genericPut($key, $value, $type)
    {
        $listName = $this->_getCorrectList($type);

        if (is_array($key)) {
            $this->$listName = array_merge($this->$listName, $key);
        } else {
            $list       = &$this->$listName;
            $list[$key] = $value;
        }

        return $this;
    }
302773
public function create($input)
	{
		$mapper = $this->getMapper();
		$admin  = $mapper->getAdmin();

		$model      = $this->getModel();
		$primaryKey = (new $model)->getKeyName();

		$this->setInput($input);

		// Field pre update
		foreach ($mapper->getFields() as $field) {
			$field->preUpdate();
			$input = $this->getInput();

			// Is this a multiple field?
			if ($field->isMultiple()) {
				$value = Value::encode(Config::get('bauhaus::admin.multiple-serializer'), $input[$field->getName()]);
				$this->setInputVariable($field->getName(), $value);
			}

			if ($field->hasSaving()) {
				$saving = $field->getSaving();
				$this->setInputVariable($field->getName(), $saving($input[$field->getName()]));
			}
		}

		// Model before create hook
		if (method_exists($admin, 'beforeCreate')) {
			$admin->beforeCreate($input);
		}

		// Validate
		if (property_exists($model, 'rules')) {
			$validator = Validator::make($this->getInput(), $model::$rules);
			if ($validator->fails()) {
				return $validator;
			}
		}

		// Model create hook
		if (method_exists($admin, 'create')) {
			$model = $admin->create($this->getInput());
		} else {
			$model = $model::create($this->getInput());
		}

		// Set the primary id from the `new` model
		$this->setIdentifier($model->{$primaryKey});

		// Field post update
		foreach ($mapper->getFields() as $field) {
			$field->postUpdate($this->getInput());
		}

		// Model after create hook
		if (method_exists($admin, 'afterCreate')) {
			$result = $admin->afterCreate($this->getInput());

			if ($result instanceof \Illuminate\Http\RedirectResponse) {
				$result->send();
			}
		}

		return $this;
	}
715657
@Override
    public Object map(Object input) {
        return new Text(map.get(input.toString()));
    }