Vector named constructor.

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

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

        return new static($input, $resolver);
    }
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);
    }
529224
public function findOrCreate($input)
    {
        if (is_null($input)) {
            return $input;
        }

        if (is_string($input) && is_object(json_decode($input)) && is_array(json_decode($input, true))) {
            $input = json_decode($input, true);
        }

        if (is_array($input)) {
            if (array_key_exists('id', $input) && $input['id']) {
                $object = $this->find($input['id']);
            } else {
                $object = $this->createEntity();
            }

            $object->setPropertiesEntity($input);

            return $object;
        }

        if (is_numeric($input) || is_string($input)) {
            return $this->find($input);
        }

        throw new \InvalidArgumentException('O parâmetro $input pode ser um null | string | array | numeric');
    }
328568
public function createObjectStateGroupFromInputStruct(InputStruct $input)
    {
        $objectStateGroup = new Group();

        $objectStateGroup->identifier = $input->identifier;
        $objectStateGroup->defaultLanguage = $input->defaultLanguage;
        $objectStateGroup->name = $input->name;
        $objectStateGroup->description = $input->description;

        $objectStateGroup->languageCodes = array();
        foreach ($input->name as $languageCode => $name) {
            $objectStateGroup->languageCodes[] = $languageCode;
        }

        return $objectStateGroup;
    }
535937
public function parse(string $input): Type
    {
        $this->lexer->setInput($input);
        $this->lexer->moveNext();

        return $this->parseInternal();
    }
363587
public function plainInput($type, $name, $value = null, $options = [])
    {
        return parent::input($type, $name, $value, $options);
    }
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();
	}
10575
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) {
                $inputs[$index] = $type . ($list ? '[]' : '');
                continue;
            }

            throw Exception\ClassFile::phpTypeDoesNotExists($type);
        }

        return implode('|', $inputs);
    }
696907
public static function handleInput(InputInterface $input)
    {
        $configOption = $input->getOption('configuration');
        $configFile = ConfigLocator::locate($configOption);
        $configuration = ConfigLoader::loadConfig($configFile);

        $phpunit = $configuration->getPHPUnitConfiguration();
        if (null !== $input->getOption('bootstrap')) {
            $phpunit['bootstrap'] = $input->getOption('bootstrap');
        }

        if (isset($phpunit['bootstrap'])) {
            FileLoader::loadFile($phpunit['bootstrap']);
        }

        return $configuration;
    }
121353
function createInputType(type) {
    return React.createClass({
        displayName: Input.displayName + type,
        render() {
            return <Input {...this.props} type={type.toLowerCase()} />;
        }
    });
}
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;
	}
241401
public function setInput($input)
    {
        if (is_resource($input)) {
            $input = stream_get_contents($input);
        }

        if (is_string($input)) {
            $reader = new SabreXml\Reader();
            $reader->elementMap['{'.self::XCAL_NAMESPACE.'}period']
                = 'Sabre\VObject\Parser\XML\Element\KeyValue';
            $reader->elementMap['{'.self::XCAL_NAMESPACE.'}recur']
                = 'Sabre\VObject\Parser\XML\Element\KeyValue';
            $reader->xml($input);
            $input = $reader->parse();
        }

        $this->input = $input;
    }
406218
protected function resolve(Input $input): Input
    {
        $this->call($input->value());
        $input->ignore();

        return $input;
    }
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;
    }
438795
public function firstOrCreate(array $input)
    {
        $this->cache->tags($this->getModel())->flush();
        return $this->repository->firstOrCreate($input);
    }
1064649
public function input($input): ProcessBuilder
    {
        if ($input === null) {
            $this->input = null;

            return $this;
        }

        if (is_resource($input)) {
            $this->input = $input;

            return $this;
        }

        if (is_scalar($input)) {
            $this->input = (string) $input;
        }

        return $this;
    }