Implements InputMatchInterface::appliesTo().
195513
public function appliesTo($value, MediaTypeInterface $media_type) {
    if (is_numeric($value)) {
      $value = $this->entityTypeManager()->getStorage('file')->load($value);
    }

    if ($value instanceof FileInterface && ($field = $this->getSourceFieldDefinition($media_type))) {
      $extension = pathinfo($value->getFilename(), PATHINFO_EXTENSION);
      $extension = strtolower($extension);

      return in_array(
        $extension,
        preg_split('/,?\s+/', $field->getSetting('file_extensions'))
      );
    }
    return FALSE;
  }
1033512
public function apply()
    {
        if ($this->canApply()) {
            $before = self::cloneNodeWithNodeData($this->getSubject());
            $parent = $before->getParent();

            if ($this->nodeNameAvailableBelowNode($this->getSiblingNode()->getParent(), $this->getSubject())) {
                $this->getSubject()->moveAfter($this->getSiblingNode());
            } else {
                $nodeName = $this->generateUniqueNodeName($this->getSiblingNode()->getParent());
                $this->getSubject()->moveAfter($this->getSiblingNode(), $nodeName);
            }

            $updateParentNodeInfo = new UpdateNodeInfo();
            $updateParentNodeInfo->setNode($parent);

            $this->feedbackCollection->add($updateParentNodeInfo);

            $this->finish($before);
        }
    }
289116
public function useMinimumMatchFromTypoScript(): QueryBuilder
    {
        $searchConfiguration = $this->typoScriptConfiguration->getSearchConfiguration();
        if (!empty($searchConfiguration['query.']['minimumMatch'])) {
            return $this->useMinimumMatch($searchConfiguration['query.']['minimumMatch']);
        }

        return $this;
    }
581696
public function apply($input, $index, IntermediateContext $context)
    {
        if (! $context->memory->contains($this)) {
            $context->memory->offsetSet($this, 0);
        }

        $count = $context->memory->offsetGet($this);
        $context->memory->offsetSet($this, $count+1);

        $takeIt = $count >= $this->skip;

        $context->outUseItem     = $takeIt;
        $context->outCanContinue = true;

        return $input;
    }
1275700
public function apply()
    {
        $this->replacingLines = array();
        $this->init();
        if ($this->checkPreconditions()) {
            return $this->execute();
        } else {
            if (!empty($this->invoice[Tag::Customer][Tag::Invoice][Meta::CompletorStrategyPreconditionFailed])) {
                $this->invoice[Tag::Customer][Tag::Invoice][Meta::CompletorStrategyPreconditionFailed] .= ', ';
            } else {
                $this->invoice[Tag::Customer][Tag::Invoice][Meta::CompletorStrategyPreconditionFailed] = '';
            }
            $this->invoice[Tag::Customer][Tag::Invoice][Meta::CompletorStrategyPreconditionFailed] .= $this->getName();
            return false;
        }
    }
104166
public function apply()
	{
		if (!$this->isActive()) return;
		
		foreach ($this->getInfo() as $f)
		{
			switch($f['filter_type']) 
			{
				case self::TYPE_NUMERIC:
				case self::TYPE_NUMERIC_SLIDER:
					if ($this->submittedValue($f['name'].'_min') !== null)
					{
						$this->iterator->where( $this->generateField($f['field']).' >= '.(float)$this->submittedValue($f['name'].'_min') );
					}
					if ($this->submittedValue($f['name'].'_max') !== null && $this->submittedValue($f['name'].'_max'))
					{
						$this->iterator->where( $this->generateField($f['field']).' <= '.(float)$this->submittedValue($f['name'].'_max') );
					}	
					break;
				case self::TYPE_RADIO:
				case self::TYPE_DROPDOWN:
					if ($this->submittedValue($f['name']) !== null) {
						$this->iterator->where( $this->generateField($f['field']).' = :'.$f['name'] )
									   ->setParameter($f['name'], $this->submittedValue($f['name']));
					}				
					break;
				case self::TYPE_CHECKBOX:
					if ($this->submittedValue($f['name']) !== null) {
						if (is_array($this->submittedValue($f['name']))) {
							$a = array();
							foreach ($this->submittedValue($f['name']) as $value => $dummy) {
								$a[] = '"'.$value.'"';
							}
							$this->iterator->where( $this->generateField($f['field']).' IN ('.implode(',',$a).')' );
						}
						else {
							if ($this->submittedValue($f['name'])) {
								$this->iterator->where( $this->generateField($f['field']).' > 0' );
							}
						}
					}
					break;
				case self::TYPE_DROPDOWN_MULTIPLE:
					if ($this->submittedValue($f['name']) !== null) {
						if (is_array($this->submittedValue($f['name']))) {
							$this->iterator->where( $this->generateField($f['field']).' IN ("'.implode('","',$this->submittedValue($f['name'])).'")' );
						}
					}
					break;                    
				case self::TYPE_DATE_INTERVAL:
					if ($f['value_min']) {
						$this->iterator->where( $this->generateField($f['field']).' >= STR_TO_DATE(:'.$f['name'].'_min,"%Y-%m-%d")' )
									   ->setParameter($f['name'].'_min', $f['value_min']);						
					}
					if ($f['value_max']) {
						$this->iterator->where( $this->generateField($f['field']).' <= DATE_ADD(STR_TO_DATE(:'.$f['name'].'_max,"%Y-%m-%d"), INTERVAL 1 DAY)' )
									   ->setParameter($f['name'].'_max', $f['value_max']);						
					}
					break;
				case self::TYPE_DATE:
					if ($f['value']) {
						$this->iterator->where( 'DATE_FORMAT('.$this->generateField($f['field']).',"%Y-%m-%d") = :'.$f['name'] )
									   ->setParameter($f['name'], $f['value']);						
					}				
					break;
				case self::TYPE_TEXT:
					if ($f['value']) {
						$this->iterator->where( $this->generateField($f['field']).' LIKE :'.$f['name'] )
									   ->setParameter($f['name'], '%'.$f['value'].'%');						
					}					
					break;
			}
		}
		$this->iterator->groupBy('main.id');
	}
325501
public function apply(object $object, ReflectionProperty $reflectionProperty, callable $objectCopier): void
    {
        $reflectionProperty->setAccessible(true);
        /** @var Collection $oldCollection */
        $oldCollection = $reflectionProperty->getValue($object);

        $newCollection = $oldCollection->map(
            function ($item) use ($objectCopier) {
                return $objectCopier($item);
            }
        );

        $reflectionProperty->setValue($object, $newCollection);
    }
1045058
public function apply($value)
    {
        if (is_int($value) || is_float($value)) {
            return $this->compare($value);
        } elseif (is_array($value)) {
            return $this->compare(count($value));
        } else {
            $value = (string) $value;

            return $this->compare(strlen($value));
        }
    }
165179
protected function parseInput()
    {
        foreach ($this->input as $key=>$value) {
            $this->applyParameter($key, $value);
        }
    }
445926
@Override
    public Object apply(Object value, Object... params) {

        return super.asString(value).replaceAll("[\n]", "<br />\n");
    }
712866
@Override
    public Object apply(Object value, Object... params) {

        return Filter.getFilter("escape").apply(value, params);
    }
634378
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
            ELException
    {
        String nameStr = getName(ctx);
        ValueExpression valueVE = getValue(ctx);
        //ctx.getVariableMapper().setVariable(nameStr, valueVE);
        apply(ctx, parent, nameStr, valueVE);
    }
62128
public function apply()
    {
        Schema::create('password_resets', function (Blueprint $table) {
            /** @noinspection PhpUndefinedMethodInspection */
            $table->string('email')->index();
            /** @noinspection PhpUndefinedMethodInspection */
            $table->string('token')->index();
            $table->timestamp('created_at');
        });
    }
257690
def apply_to_type(input_, input_type, func):
    
    if isinstance(input_, input_type):
        return func(input_)
    elif isinstance(input_, string_classes):
        return input_
    elif isinstance(input_, collections.Mapping):
        return {k: apply_to_type(sample, input_type, func) for k, sample in input_.items()}
    elif isinstance(input_, collections.Sequence):
        return [apply_to_type(sample, input_type, func) for sample in input_]
    else:
        raise TypeError(("input must contain {}, dicts or lists; found {}"
                         .format(input_type, type(input_))))
382529
protected function applyCast(string $key): void
    {
        $casts = $this->casts();

        if ( ! count($casts) || ! array_key_exists($key, $casts)) {
            return;
        }

        if ( ! isset($this->attributes[ $key ])) {
            $value = null;
        } else {
            $value = $this->attributes[ $key ];
        }

        // If the cast type is a simple scalar, apply it and return
        if (in_array($casts[ $key ], static::SCALAR_CASTS)) {
            $this->attributes[ $key ] = call_user_func([$this, 'castValueAs' . ucfirst($casts[ $key ])], $value);
            return;
        }

        // Otherwise attempt a data object cast
        $dataObjectClass = $casts[ $key ];
        $dataObjectArray = false;

        // If the model is postfixed with [], an array of models is expected
        if (substr($dataObjectClass, -2) === '[]') {
            $dataObjectClass = substr($dataObjectClass, 0, -2);
            $dataObjectArray = true;
        }

        if (null === $value) {
            if ($dataObjectArray) {
                $this->attributes[ $key ] = [];
                return;
            }

            if ($this->castUnsetObjects) {
                $this->attributes[ $key ] = $this->makeNestedDataObject($dataObjectClass, [], $key);
            }
            return;
        }

        if ($dataObjectArray) {

            if (is_array($this->attributes[ $key ])) {

                foreach ($this->attributes[ $key ] as $index => &$item) {

                    if (null === $item && ! $this->castUnsetObjects) {
                        continue;
                    }

                    if ( ! ($item instanceof $dataObjectClass)) {

                        $item = $this->makeNestedDataObject($dataObjectClass, $item ?: [], $key . '.' . $index);
                    }
                }
            }

            unset($item);

            return;
        }

        // Single data object
        if ( ! ($this->attributes[ $key ] instanceof $dataObjectClass)) {
            $this->attributes[ $key ] = $this->makeNestedDataObject(
                $dataObjectClass,
                $this->attributes[ $key ],
                $key
            );
        }
    }
1295778
def apply(self, mapping):
        """"""
        mapping = {name: self.str(value, tolerant=self.tolerant)
                   for name, value in mapping.items()
                   if value is not None or self.tolerant}

        if self.tolerant:
            return self.template.safe_substitute(mapping)

        return self.template.substitute(mapping)
40304
public function set( $key, $value = null, $inputValidate = null )
    {

        // decide on the level of input validation
        if( $inputValidate === null ) {
            $inputValidate = static::$inputValidate;
        }

        // set a array / Symfony ParameterBag of properties
        if( is_array($key) || ( $key instanceof \Traversable ) ) {
            $numSet = 0;
            foreach( $key as $_key => $_value ) {
                $numSet += call_user_func( array($this,__FUNCTION__), $_key, $_value, $inputValidate ) ? 1 : 0;
            }
            return $numSet;
        }

        // readonly safety check
        if( $this->readOnlySafetyCheck() ) {
            return false;
        }

        // You can't set a objects id externally
        if( in_array( $key, static::$unsetableProperties ) ) {
            return false;
        }

        // late load. You can't set a property on a unloaded object
        $this->load();

        switch( true ) {

            // got key or we're configured to accept any inputs
            case $inputValidate === self::VALIDATE_DISABLE:
            case array_key_exists( $key, $this->data ):

                if( $value === '' ) {
                    $value = null;
                }

                // validate item ?
                // implementation undecided
                $callback = array( $this, "set_{$key}" );

                $value = is_callable( $callback )
                    ? call_user_func( $callback, $value, $inputValidate )
                    : $value
                    ;

                // anything changed?
                if( isset( $this->data[$key] ) and $this->data[$key] === $value ) {
                    return false;
                }

                $this->initalPropertySet( $key, $value );
                $this->data[$key] = $value;
                return true;

            // unknown property. Class configured to ignore.
            case $inputValidate === self::VALIDATE_STRIP:

                return false;

            // unknown property. Class configured for Exception.
            case $inputValidate === self::VALIDATE_EXCEPTION:

                throw new BadPropertyException( $key, $this, "set() VALIDATE_EXCEPTION." );

            // odd that we should have got this far.
            // debugging check - ensure $inputValidate is one of our allowed inputs
            case !in_array( $inputValidate, array( self::VALIDATE_DISABLE, self::VALIDATE_STRIP, self::VALIDATE_EXCEPTION ), true ):

                throw new \InvalidArgumentException("Bad argument `{$inputValidate}` argument passed to ->set(,,\$inputValidate);");
                return false;

        }

        return false;

    }