Adds requirements.

This method implements a fluent interface.

@param array $requirements The requirements

@return $this
486441
public function addRequirements(array $requirements)
    {
        foreach ($requirements as $key => $regex) {
            $this->requirements[$key] = $this->sanitizeRequirement($key, $regex);
        }
        $this->compiled = null;

        return $this;
    }
1170474
public function add($goal)
    {
        if (is_array($goal)) {
            $this->collection[] = new Goal($goal);
        } elseif (is_object($goal) && $goal instanceof Goal) {
            $this->collection[] = $goal;
        }

        return $this;
    }
392511
public function setRequiredFields($fields) {
		$this->requiredFields = $fields;
		$this->setValidator($this->getValidator());
		return $this;
	}
987738
public function addMethods(array $methods)
    {
        foreach ($methods as $key => $method) {
            $this->addMethod($method, $key);
        }
        return $this;
    }
901292
public function pushCriteria($criteria)
    {
        if (is_string($criteria)) {
            $criteria = new $criteria;
        }
        if (!$criteria instanceof CriteriaInterface) {
            throw new RepositoryException("Class " . get_class($criteria) . " must be an instance of Prettus\\Repository\\Contracts\\CriteriaInterface");
        }
        $this->criteria->push($criteria);

        return $this;
    }
413421
public function add($key, $type, $default = null, $required = false)
    {
        $required = (Boolean) $required;
        $this->fields[$key] = [
            'type'      => $type,
            'required'  => $required,
            'default'   => $default,
        ];
        return $this;
    }
512087
public function set($name, Dependency $dependency)
    {
        $required = isset($this->dependencies[$name]) && $this->dependencies[$name]->isRequired();
        $this->dependencies[$name] = new Requirement($dependency, $required);

        return $this;
    }
451182
public function addProperties(array $values)
    {
        foreach ($values as $key => $value) {
            $this->add($key, $value);
        }

        return $this;
    }
151353
public function addRequireDev($require, $version = '*', $overwrite = false)
    {
        if (!isset($this->getRequireDev()->$require) || $overwrite) {
            $this->getRequireDev()->$require = $version;
        }

        return $this;
    }
1209710
public function addDependency(string $dependencyName): self
    {
        if (!property_exists($this->loadInfos, 'require')) {
            $this->loadInfos->require = [];
        }
        
        if (!is_array($this->loadInfos->require)) {
            $this->loadInfos->require = [$this->loadInfos->require];
        }
        
        $this->loadInfos->require[] = $dependencyName;
        
        return $this;
    }
1333265
protected function addWhereConstraints()
    {
        $this->query->where(
            $this->getQualifiedForeignKeyName(), '=', $this->parent->getKey()
        );

        return $this;
    }
956300
public function addFormProperties(array $properties)
    {
        foreach ($properties as $propertyIdent => $property) {
            $this->addFormProperty($propertyIdent, $property);
        }

        return $this;
    }
142742
public function add(\Caridea\Validate\Rule ...$rules): self
    {
        $this->rules = array_merge($this->rules, $rules);
        return $this;
    }
713137
public function addPropertyConstraints($property, array $constraints)
    {
        foreach ($constraints as $constraint) {
            $this->addPropertyConstraint($property, $constraint);
        }

        return $this;
    }
1262417
public function setRequired(bool $required) : self
    {
        $required = (bool)$required;
        $this->required = $required;
        return $this;
    }
755369
public function setHost($pattern, array $defaults = [], array $requirements = [])
    {
        foreach ($this->routes as $route) {
            $route->setHost($pattern);
            $route->addDefaults($defaults);
            $route->addRequirements($requirements);
        }
    }
1242010
protected function validate_requirements( $requirements ) {
		if ( ! count( $requirements ) ) {
			return;
		}

		if ( ! empty( $requirements['params'] ) ) {
			$this->set_params( $requirements['params'] );
		}

		foreach ( $requirements as $key => $data ) {
			switch ( $key ) {
				case 'php':
					$this->validate_php( $data );
					break;
				case 'mysql':
					$this->validate_mysql( $data );
					break;
				case 'wordpress':
					$this->validate_wordpress( $data );
					break;
			}
		}
	}